[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmSo=BWGnaVeejez6K0Tukny2niWXrr52YvOPDYnXbOsg@mail.gmail.com>
Date: Mon, 4 Nov 2019 09:54:48 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Ilie Halip <ilie.halip@...il.com>
Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>,
Fangrui Song <maskray@...gle.com>
Subject: Re: [PATCH] x86/boot: explicitly place .eh_frame after .rodata
On Mon, Nov 4, 2019 at 1:03 AM Ilie Halip <ilie.halip@...il.com> wrote:
>
> When using GCC as compiler and LLVM's lld as linker, linking
> setup.elf fails:
> LD arch/x86/boot/setup.elf
> ld.lld: error: init sections too big!
>
> This happens because ld.lld has different rules for placing
> orphan sections (i.e. sections not mentioned in a linker script)
> compared to ld.bfd.
>
> Particularly, in this case, the merged .eh_frame section is
> placed before __end_init, which triggers an assert in the script.
>
> Explicitly place this section after .rodata, in accordance with
> ld.bfd's behavior.
>
> Signed-off-by: Ilie Halip <ilie.halip@...il.com>
> Link: https://github.com/ClangBuiltLinux/linux/issues/760
Thanks for the patch Ilie! Quoting Fangrui:
"This is related to the orphan placement rule. An orphan section is a
section that is not described by the linker script. The orphan section
placement is not well documented and the rule used by ld.bfd is not
very clear. Being more explicit is the way to go."
https://github.com/ClangBuiltLinux/linux/issues/760#issuecomment-549064237
Looks like Clang doesn't even produce a .eh_frame section.
> ---
> arch/x86/boot/setup.ld | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/boot/setup.ld b/arch/x86/boot/setup.ld
> index 0149e41d42c2..4e02eab11b59 100644
> --- a/arch/x86/boot/setup.ld
> +++ b/arch/x86/boot/setup.ld
> @@ -25,6 +25,7 @@ SECTIONS
>
> . = ALIGN(16);
> .rodata : { *(.rodata*) }
> + .eh_frame : { *(.eh_frame*) }
The wildcard on the end can be left off; we don't need to glob
different sections with the prefix `.eh_frame`. Would you mind
sending a V2 with that removed? (I know .rodata and .data in this
linker script globs, but they may actually be putting data in separate
sections which we want to munge back together; certainly for
-fdata-sections).
>
> .videocards : {
> video_cards = .;
> --
> 2.17.1
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists