From: Sedat Dilek <sedat.dilek@gmail.com> To: Nick Desaulniers <ndesaulniers@google.com> Cc: Nathan Chancellor <nathan@kernel.org>, Kees Cook <keescook@chromium.org>, David Gow <davidgow@google.com>, Jeff Dike <jdike@addtoit.com>, Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Masahiro Yamada <masahiroy@kernel.org>, linux-um@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS Date: Fri, 4 Mar 2022 12:42:54 +0100 [thread overview] Message-ID: <CA+icZUXf9m13GrqvCLkDRsnQt0X2VQ=yVrJRYz=6fhCJXR4-Xg@mail.gmail.com> (raw) In-Reply-To: <CAKwvOdkA1c3U6+-6hB3Nj9m2Z8eYzsFWm5X4se2eq_cF3NB2jA@mail.gmail.com> On Thu, Mar 3, 2022 at 9:43 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Thu, Mar 3, 2022 at 10:26 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > On Thu, Mar 03, 2022 at 10:04:28AM -0800, Kees Cook wrote: > > > How does -mno-global-merge get KBUILD_CFLAGS in the first place? If it's > > > arm/arm64 only, shouldn't that get relocated to those architectures? > > > > > > *time travel* found it: > > > > > > 61163efae020 ("kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang") > > > > > > So I think this may have been universally true long ago, and now only > > > arm/arm64 need it? > > Looks like that's the case from LLVM sources. > > <snip> > > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > > index a2391b8de5a5..dcab28c44c26 100644 > > > --- a/arch/arm/Makefile > > > +++ b/arch/arm/Makefile > > > @@ -48,6 +48,13 @@ CHECKFLAGS += -D__ARMEL__ > > > KBUILD_LDFLAGS += -EL > > > endif > > > > > > +ifdef CONFIG_CC_IS_CLANG > > > +# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the > > > +# source of a reference will be _MergedGlobals and not on of the whitelisted names. > > I think there's a typo in the original comment. > s/on of/one of/ ? > > Also, I'm not sure what's meant by _MergedGlobals. Perhaps this is an > opportunity to make this clearer? > > "Clang's "global-merge" pass (implemented only for arm and aarch64) > may break modpost Pattern 2 if symbols are renamed and thus don't > appear on modpost's allowlist. > > > > +# See modpost pattern 2 > > > +KBUILD_CFLAGS += -mno-global-merge > > > +endif > > > + > I can remember on x86-64 I was able to build and boot by dropping it entirely. - Sedat - > > > -- > Thanks, > ~Nick Desaulniers
WARNING: multiple messages have this Message-ID (diff)
From: Sedat Dilek <sedat.dilek@gmail.com> To: Nick Desaulniers <ndesaulniers@google.com> Cc: Nathan Chancellor <nathan@kernel.org>, Kees Cook <keescook@chromium.org>, David Gow <davidgow@google.com>, Jeff Dike <jdike@addtoit.com>, Richard Weinberger <richard@nod.at>, Anton Ivanov <anton.ivanov@cambridgegreys.com>, Masahiro Yamada <masahiroy@kernel.org>, linux-um@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS Date: Fri, 4 Mar 2022 12:42:54 +0100 [thread overview] Message-ID: <CA+icZUXf9m13GrqvCLkDRsnQt0X2VQ=yVrJRYz=6fhCJXR4-Xg@mail.gmail.com> (raw) In-Reply-To: <CAKwvOdkA1c3U6+-6hB3Nj9m2Z8eYzsFWm5X4se2eq_cF3NB2jA@mail.gmail.com> On Thu, Mar 3, 2022 at 9:43 PM Nick Desaulniers <ndesaulniers@google.com> wrote: > > On Thu, Mar 3, 2022 at 10:26 AM Nathan Chancellor <nathan@kernel.org> wrote: > > > > On Thu, Mar 03, 2022 at 10:04:28AM -0800, Kees Cook wrote: > > > How does -mno-global-merge get KBUILD_CFLAGS in the first place? If it's > > > arm/arm64 only, shouldn't that get relocated to those architectures? > > > > > > *time travel* found it: > > > > > > 61163efae020 ("kbuild: LLVMLinux: Add Kbuild support for building kernel with Clang") > > > > > > So I think this may have been universally true long ago, and now only > > > arm/arm64 need it? > > Looks like that's the case from LLVM sources. > > <snip> > > > > diff --git a/arch/arm/Makefile b/arch/arm/Makefile > > > index a2391b8de5a5..dcab28c44c26 100644 > > > --- a/arch/arm/Makefile > > > +++ b/arch/arm/Makefile > > > @@ -48,6 +48,13 @@ CHECKFLAGS += -D__ARMEL__ > > > KBUILD_LDFLAGS += -EL > > > endif > > > > > > +ifdef CONFIG_CC_IS_CLANG > > > +# CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the > > > +# source of a reference will be _MergedGlobals and not on of the whitelisted names. > > I think there's a typo in the original comment. > s/on of/one of/ ? > > Also, I'm not sure what's meant by _MergedGlobals. Perhaps this is an > opportunity to make this clearer? > > "Clang's "global-merge" pass (implemented only for arm and aarch64) > may break modpost Pattern 2 if symbols are renamed and thus don't > appear on modpost's allowlist. > > > > +# See modpost pattern 2 > > > +KBUILD_CFLAGS += -mno-global-merge > > > +endif > > > + > I can remember on x86-64 I was able to build and boot by dropping it entirely. - Sedat - > > > -- > Thanks, > ~Nick Desaulniers _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um
next prev parent reply other threads:[~2022-03-04 11:43 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-03 9:06 [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS David Gow 2022-03-03 9:06 ` David Gow 2022-03-03 17:30 ` Nathan Chancellor 2022-03-03 17:30 ` Nathan Chancellor 2022-03-03 18:04 ` Kees Cook 2022-03-03 18:26 ` Nathan Chancellor 2022-03-03 18:26 ` Nathan Chancellor 2022-03-03 18:39 ` Nick Desaulniers 2022-03-03 18:39 ` Nick Desaulniers 2022-03-04 11:42 ` Sedat Dilek [this message] 2022-03-04 11:42 ` Sedat Dilek 2022-03-04 6:51 ` David Gow 2022-03-04 6:51 ` David Gow
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CA+icZUXf9m13GrqvCLkDRsnQt0X2VQ=yVrJRYz=6fhCJXR4-Xg@mail.gmail.com' \ --to=sedat.dilek@gmail.com \ --cc=anton.ivanov@cambridgegreys.com \ --cc=davidgow@google.com \ --cc=jdike@addtoit.com \ --cc=keescook@chromium.org \ --cc=kunit-dev@googlegroups.com \ --cc=linux-hardening@vger.kernel.org \ --cc=linux-kbuild@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-kselftest@vger.kernel.org \ --cc=linux-um@lists.infradead.org \ --cc=llvm@lists.linux.dev \ --cc=masahiroy@kernel.org \ --cc=nathan@kernel.org \ --cc=ndesaulniers@google.com \ --cc=richard@nod.at \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.