Re: [PATCH] arm/build: Always handle .ARM.exidx and .ARM.extab sections

From: Nick Desaulniers
Date: Wed Oct 14 2020 - 05:24:03 EST


On Mon, Oct 12, 2020 at 8:26 PM Nathan Chancellor
<natechancellor@xxxxxxxxx> wrote:
>
> On Mon, Oct 12, 2020 at 02:26:52PM -0700, Kees Cook wrote:
> > On Mon, Oct 12, 2020 at 02:22:03PM -0700, Fāng-ruì Sòng wrote:
> > > On Mon, Oct 12, 2020 at 2:11 PM 'Nick Desaulniers' via Clang Built
> > > Linux <clang-built-linux@xxxxxxxxxxxxxxxx> wrote:
> > > >
> > > > Please submit to:
> > > > https://www.arm.linux.org.uk/developer/patches/add.php
>
> This should go through the tip tree (hence sending it straight to Ingo)
> since the patch that this fixes was there. I guess it does not
> necessarily matter now that the breakage is in mainline but basing a
> set of patches on a non -rc tag is a little taboo I thought so not sure
> it is appropriate to go through Russell for now. It is up to the
> maintainers though, I will submit it wherever it needs to go.

Ah got it, yeah I don't really care which tree this goes up in.

>
> > > > >
> > > > > Fixes: 5a17850e251a ("arm/build: Warn on orphan section placement")
> > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1152
> > > > > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > > > > Signed-off-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
> > > > > ---
> > > > > arch/arm/kernel/vmlinux.lds.S | 4 ++++
> > > > > 1 file changed, 4 insertions(+)
> > > > >
> > > > > diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
> > > > > index 5f4922e858d0..a2c0d96b0580 100644
> > > > > --- a/arch/arm/kernel/vmlinux.lds.S
> > > > > +++ b/arch/arm/kernel/vmlinux.lds.S
> > > > > @@ -40,6 +40,10 @@ SECTIONS
> > > > > ARM_DISCARD
> > > > > #ifndef CONFIG_SMP_ON_UP
> > > > > *(.alt.smp.init)
> > > > > +#endif
> > > > > +#ifndef CONFIG_ARM_UNWIND
> > > > > + *(.ARM.exidx*)
> > > >
> > > > I don't think we need the wildcard, as without this line, I see:
> > > >
> > > > ld.lld: warning: <internal>:(.ARM.exidx) is being placed in '.ARM.exidx'
> > >
> > > We may need the wildcard if there are -ffunction-sections builds.
> > > In clang, .ARM.exidx* cannot be removed even with -fno-unwind-tables
> > > -fno-exceptions.
> >
> > Does it need to be:
> >
> > *(.ARM.exidx) *(.ARM.exidx.*)
> > *(.ARM.extab) *(.ARM.extab.*)
> >
> > ?
>
> I tested the patch and saw no warnings with what I sent. I can change it
> to that if it is more proper though!

We don't have LTO working on 32b ARM yet, so I'm not worried about
-ffunction-sections for this (yet). The ld.bfd linker scripts didn't
seem to use the non-wildcard and wildcard suggestion; just the
wildcarded. (Maybe they have the same "bug?") I'm happy to revisit
though if we plan to get LTO up and running on 32b ARM.
--
Thanks,
~Nick Desaulniers