On Thu, Mar 3, 2022 at 10:26 AM Nathan Chancellor <nathan@xxxxxxxxxx> 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 > > + -- Thanks, ~Nick Desaulniers