[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 3 Mar 2022 10:39:58 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Kees Cook <keescook@...omium.org>, David Gow <davidgow@...gle.com>,
Jeff Dike <jdike@...toit.com>,
Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Masahiro Yamada <masahiroy@...nel.org>,
linux-um@...ts.infradead.org, linux-kbuild@...r.kernel.org,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
llvm@...ts.linux.dev, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] um: clang: Strip out -mno-global-merge from USER_CFLAGS
On Thu, Mar 3, 2022 at 10:26 AM Nathan Chancellor <nathan@...nel.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
> > +
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists