[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNAQBYxZ4s4Eg2TPMoLA+NDWXsNrnq2ch1ZQsBgcCXPk7Sw@mail.gmail.com>
Date: Wed, 7 Apr 2021 23:24:30 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Alexander Lobakin <alobakin@...me>
Cc: Sami Tolvanen <samitolvanen@...gle.com>,
Kees Cook <keescook@...omium.org>,
Jessica Yu <jeyu@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Emil Velikov <emil.l.velikov@...il.com>,
Sean Christopherson <seanjc@...gle.com>,
"linux-hardening@...r.kernel.org" <linux-hardening@...r.kernel.org>,
linux-kbuild <linux-kbuild@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kbuild: merge module sections under CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
too
On Tue, Apr 6, 2021 at 11:42 PM Alexander Lobakin <alobakin@...me> wrote:
>
> On Friday, 2 April 2021, 18:09, Sami
> Tolvanen <samitolvanen@...gle.com> wrote:
>
> > On Fri, Apr 2, 2021 at 5:40 AM Alexander Lobakin alobakin@...me wrote:
> >
> > > When building with CONFIG_LD_DEAD_CODE_DATA_ELIMINATION,
> > > -fdata-sections and -ffunction-sections are being enabled by the
> > > top-level Makefile, and module section merging is also needed.
> > > Expand the ifdef (and the comment block) to cover that case too.
> > > Fixes: 6a3193cdd5e5 ("kbuild: lto: Merge module sections if and only if CONFIG_LTO_CLANG is enabled")
Did you test this patch before submission?
See the top Makefile closely:
ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
KBUILD_CFLAGS_KERNEL += -ffunction-sections -fdata-sections
LDFLAGS_vmlinux += --gc-sections
endif
-ffunction-sections -fdata-sections are passed to only
built-in objects, but not to module objects in the
first place.
KBUILD_CFLAGS_KERNEL is only passed to built-in objects.
The situation you claimed never happens.
> > Wouldn't this trigger the ld.bfd bug described in the commit message
> > when LD_DEAD_CODE_DATA_ELIMINATION is enabled? LTO_CLANG always uses
> > LLD, so it won't have this issue.
>
> LD_DEAD_CODE_DATA_ELIMINATION is marked
> “EXPERIMENTAL“ in the config prompt, and
> arches have to opt-in
> HAS_LD_DEAD_CODE_DATA_ELIMINATION to give
> an access to it (only a few does). This
> should be relatively safe.
>
> > Sami
>
> Thanks,
> Al
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists