Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp776172pxj; Thu, 10 Jun 2021 12:25:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOp3UWKhFejVsOKZ1y+xQpAY6RnIOBwdVI+bTiFpmv04Xe2vGp2BahydilJAYvRg6zIxRQ X-Received: by 2002:a05:6402:42cb:: with SMTP id i11mr72492edc.242.1623353120445; Thu, 10 Jun 2021 12:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623353120; cv=none; d=google.com; s=arc-20160816; b=T/qItD3nfeHaWOrxiwftHdK+25F3VZRQ/S3iFwJLj6IkRKnDrAijZ9vR2s3b6BfN3m 9nb2OHvbI5uYAGdMH7DsjgsziCZJYf1dQkvHn/jKpVUBPi1e1JHGKLukTm+BsSqoE6iP YNGANU0h8dNYGSljDQ2I+i2C1Wh7TQlXGDZR3rVvFfCxnt3EAAm8bunAtfnt6aNW5OEt QPDb+G+Pt26yZHfGecutZRZIQR/LA9IjGFAOsR0Ytz7kWaEQuSYI6WxsC/WAikDWksSU K/ALciLMFtNaEIni7uo5ezMEfYrqq7mafiB61+cMTRUVVzXWuO9wLrJmbkO2rbBc12Hu MmvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TCR4wjdITK+kupOKjLE86TVEkMZcR5bv/LNyb8r3Nyc=; b=t5qrKDQYm1cBvgJPO9kiu5G6O91wOVa0pf/iFfask5ca7+WEDAdf2m1S31O2b+LSkl C9rcHr6uYbNeFSSGRlaIGirrQRnwSR0/WADzQfEt7a54tYM4WUrhy315S/FOi8pkA5OJ Xg2JFnTAML3IPJrri9WQmppG+4ejZxwjCeIbv9e9cm7j7fUlKNEzI9eBNAeVX6Iifh6u mYkCXseS3Kk6ykPa5t5GXKtm0Ayt0cSGQuGsdk6AaCMBrtfHMcaVCNRCa0x3SNZN9vTB jKscq0jeK624i/+yP1oWaYRnoXCVLqRWOmMo+I/b1bedES5XE6CVaQBfw65Dw3v8viG+ YY7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LL56kf5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n6si2934913edo.119.2021.06.10.12.24.57; Thu, 10 Jun 2021 12:25:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LL56kf5W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230134AbhFJTXu (ORCPT + 99 others); Thu, 10 Jun 2021 15:23:50 -0400 Received: from mail-lj1-f177.google.com ([209.85.208.177]:42567 "EHLO mail-lj1-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbhFJTXt (ORCPT ); Thu, 10 Jun 2021 15:23:49 -0400 Received: by mail-lj1-f177.google.com with SMTP id r16so6410970ljk.9 for ; Thu, 10 Jun 2021 12:21:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TCR4wjdITK+kupOKjLE86TVEkMZcR5bv/LNyb8r3Nyc=; b=LL56kf5WNorUp6A/BtmQdId+ZgvFAEKdiDs120Ls5oqTDleh+FXwNezoG3o0xz3/qX tzp/Tfx6PsqR4ov6sucNa7m8+gshcxH0LmYKavfQPwjKFyKdaKiSxYpfcsPwM7mD9755 GE2QRdjM3hpFMYUfu8UQ+W9K3wJJvRe2x67ACeH5hxm2QWlKs0BA3+A2nS+ZBWA70Vb6 l8Qd3G55ifmzUzKGWWglKBZVhItqKzdGF9ufZ4xGiqOmNhcLMMTef6WmJGl8rTFMJEty r5GAHe1wLdD2VjyhpAbEH3Js0/66tRhnoRYvDj4q2t01eG/LQf9Pb/hTvnZ235m0nTBO 9Gyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TCR4wjdITK+kupOKjLE86TVEkMZcR5bv/LNyb8r3Nyc=; b=uT+7PPyRZ8Rw09lL3ia8RvtjHIlLkgdCFkL0leqng+ufekLpCZyJAcoKR5CHSaMnm8 BzUPJ7HneIFieVlwKmOi5kTNc9UQ8a5DznOA5IFArD2MCrcrQevNoaA/aDMEIpVEW00c vQ87RIPNbOyseMeHar/qUqtUUfAIYVwsZvTNRFT38zJBffbNRzfVm+1jjOxMHfsl0Mfk /KVpUp5y8WnZWci2r1xEBt1M2aQPHKtWl5MJU/cztwozvyJ41CA5fqrt6DBFJsyCSYRr tqkYRpWTiDXy3pLQ6+48p8nzLRhm+Me3cU6+BT8ixVIM20cfd5ZvjJNVBvvdIeZJfZLC UFuA== X-Gm-Message-State: AOAM533FRzWFgILKm6udN2CEPdj6mZxTFb/DN8Rz1w17HCZCJTDk8Fgc gXuwOVzBcSlCguOuVo57pDYRAHP3tyq/Py6m9ePmHQ== X-Received: by 2002:a2e:b5b5:: with SMTP id f21mr79310ljn.479.1623352844553; Thu, 10 Jun 2021 12:20:44 -0700 (PDT) MIME-Version: 1.0 References: <214134496.67043.1623317284090@office.mailbox.org> In-Reply-To: <214134496.67043.1623317284090@office.mailbox.org> From: Nick Desaulniers Date: Thu, 10 Jun 2021 12:20:33 -0700 Message-ID: Subject: Re: [PATCH] x86/Makefile: make -stack-alignment conditional on LLD < 13.0.0 To: Tor Vic Cc: "linux-kernel@vger.kernel.org" , "nathan@kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "stable@vger.kernel.org" , "clang-built-linux@googlegroups.com" , "x86@kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 10, 2021 at 2:28 AM wrote: > > Since LLVM commit 3787ee4, the '-stack-alignment' flag has been dropped [1], > leading to the following error message when building a LTO kernel with > Clang-13 and LLD-13: > > ld.lld: error: -plugin-opt=-: ld.lld: Unknown command line argument > '-stack-alignment=8'. Try 'ld.lld --help' > ld.lld: Did you mean '--stackrealign=8'? > > It also appears that the '-code-model' flag is not necessary anymore starting > with LLVM-9 [2]. > > Drop '-code-model' and make '-stack-alignment' conditional on LLD < 13.0.0. Please include this additional context in v2: ``` These flags were necessary because these flags were not encoded in the IR properly, so the link would restart optimizations without them. Now there are properly encoded in the IR, and these flags exposing implementation details are no longer necessary. ``` That way it doesn't sound like we're not using an 8B stack alignment on x86; we very much are so; AMDGPU GPFs without it! Cut the below paragraph out on v2. Thanks for the patch and keep up the good work! > > This is for linux-stable 5.12. > Another patch will be submitted for 5.13 shortly (unless there are objections). > > Discussion: https://github.com/ClangBuiltLinux/linux/issues/1377 > [1]: https://reviews.llvm.org/D103048 > [2]: https://reviews.llvm.org/D52322 > > Signed-off-by: Tor Vic > --- > arch/x86/Makefile | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 1f2e5bf..2855a1a 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -192,8 +192,9 @@ endif > KBUILD_LDFLAGS += -m elf_$(UTS_MACHINE) > > ifdef CONFIG_LTO_CLANG > -KBUILD_LDFLAGS += -plugin-opt=-code-model=kernel \ > - -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) > +ifeq ($(shell test $(CONFIG_LLD_VERSION) -lt 130000; echo $$?),0) > +KBUILD_LDFLAGS += -plugin-opt=-stack-alignment=$(if $(CONFIG_X86_32),4,8) > +endif > endif > > ifdef CONFIG_X86_NEED_RELOCS > -- > 2.32.0 -- Thanks, ~Nick Desaulniers