After turning on warnings for orphan section placement, enabling
CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes
thousands of warnings when clang + ld.lld are used:
$ scripts/config --file arch/arm/configs/multi_v7_defconfig \
-d CONFIG_UNWINDER_ARM \
-e CONFIG_UNWINDER_FRAME_POINTER
$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab'
These sections are handled by the ARM_UNWIND_SECTIONS define, which is
only added to the list of sections when CONFIG_ARM_UNWIND is set.
CONFIG_ARM_UNWIND is a hidden symbol that is only selected when
CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never
handles these sections. According to the help text of
CONFIG_UNWINDER_ARM, these sections should be discarded so that the
kernel image size is not affected.
Fixes: 5a17850e251a ("arm/build: Warn on orphan section placement")
Link: https://github.com/ClangBuiltLinux/linux/issues/1152
Reported-by: kernel test robot <redacted>
Signed-off-by: Nathan Chancellor <redacted>
---
arch/arm/kernel/vmlinux.lds.S | 4 ++++
1 file changed, 4 insertions(+)
From: Nick Desaulniers <ndesaulniers@google.com> Date: 2020-10-12 21:11:04
On Mon, Sep 28, 2020 at 3:49 PM Nathan Chancellor
[off-list ref] wrote:
After turning on warnings for orphan section placement, enabling
CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes
thousands of warnings when clang + ld.lld are used:
$ scripts/config --file arch/arm/configs/multi_v7_defconfig \
-d CONFIG_UNWINDER_ARM \
-e CONFIG_UNWINDER_FRAME_POINTER
$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab'
These sections are handled by the ARM_UNWIND_SECTIONS define, which is
only added to the list of sections when CONFIG_ARM_UNWIND is set.
CONFIG_ARM_UNWIND is a hidden symbol that is only selected when
CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never
handles these sections. According to the help text of
CONFIG_UNWINDER_ARM, these sections should be discarded so that the
kernel image size is not affected.
My apologies for taking so long to review this.
I have a suspicion that these come from forcing on configs that
Kconfig/menuconfig would block, and aren't clang or lld specific, yet
are exposed by the new linker warnings for orphan section placement
(good). That said, we definitely have OEMs in Android land that still
prefer the older unwinder.
From https://developer.arm.com/documentation/ihi0038/b/ (click
download in top left), section 4.4.1 "Sections" has a note:
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'
though I do see binutils linker scripts use precisely what you have.
So I guess that's fine.
I guess we can't reuse `ARM_UNWIND_SECTIONS` since the ALIGN and
linker-script-defined-symbols would be weird in a DISCARD clause?
On Mon, Oct 12, 2020 at 2:11 PM 'Nick Desaulniers' via Clang Built
Linux [off-list ref] wrote:
On Mon, Sep 28, 2020 at 3:49 PM Nathan Chancellor
[off-list ref] wrote:
quoted
After turning on warnings for orphan section placement, enabling
CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes
thousands of warnings when clang + ld.lld are used:
$ scripts/config --file arch/arm/configs/multi_v7_defconfig \
-d CONFIG_UNWINDER_ARM \
-e CONFIG_UNWINDER_FRAME_POINTER
$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab'
These sections are handled by the ARM_UNWIND_SECTIONS define, which is
only added to the list of sections when CONFIG_ARM_UNWIND is set.
CONFIG_ARM_UNWIND is a hidden symbol that is only selected when
CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never
handles these sections. According to the help text of
CONFIG_UNWINDER_ARM, these sections should be discarded so that the
kernel image size is not affected.
My apologies for taking so long to review this.
I have a suspicion that these come from forcing on configs that
Kconfig/menuconfig would block, and aren't clang or lld specific, yet
are exposed by the new linker warnings for orphan section placement
(good). That said, we definitely have OEMs in Android land that still
prefer the older unwinder.
From https://developer.arm.com/documentation/ihi0038/b/ (click
download in top left), section 4.4.1 "Sections" has a note:
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.
though I do see binutils linker scripts use precisely what you have.
So I guess that's fine.
I guess we can't reuse `ARM_UNWIND_SECTIONS` since the ALIGN and
linker-script-defined-symbols would be weird in a DISCARD clause?
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 [off-list ref] wrote:
quoted
On Mon, Sep 28, 2020 at 3:49 PM Nathan Chancellor
[off-list ref] wrote:
quoted
After turning on warnings for orphan section placement, enabling
CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes
thousands of warnings when clang + ld.lld are used:
$ scripts/config --file arch/arm/configs/multi_v7_defconfig \
-d CONFIG_UNWINDER_ARM \
-e CONFIG_UNWINDER_FRAME_POINTER
$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab'
These sections are handled by the ARM_UNWIND_SECTIONS define, which is
only added to the list of sections when CONFIG_ARM_UNWIND is set.
CONFIG_ARM_UNWIND is a hidden symbol that is only selected when
CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never
handles these sections. According to the help text of
CONFIG_UNWINDER_ARM, these sections should be discarded so that the
kernel image size is not affected.
My apologies for taking so long to review this.
I have a suspicion that these come from forcing on configs that
Kconfig/menuconfig would block, and aren't clang or lld specific, yet
are exposed by the new linker warnings for orphan section placement
(good). That said, we definitely have OEMs in Android land that still
prefer the older unwinder.
From https://developer.arm.com/documentation/ihi0038/b/ (click
download in top left), section 4.4.1 "Sections" has a note:
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.*)
?
quoted
though I do see binutils linker scripts use precisely what you have.
So I guess that's fine.
I guess we can't reuse `ARM_UNWIND_SECTIONS` since the ALIGN and
linker-script-defined-symbols would be weird in a DISCARD clause?
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:
quoted
On Mon, Oct 12, 2020 at 2:11 PM 'Nick Desaulniers' via Clang Built
Linux [off-list ref] wrote:
quoted
On Mon, Sep 28, 2020 at 3:49 PM Nathan Chancellor
[off-list ref] wrote:
quoted
After turning on warnings for orphan section placement, enabling
CONFIG_UNWINDER_FRAME_POINTER instead of CONFIG_UNWINDER_ARM causes
thousands of warnings when clang + ld.lld are used:
$ scripts/config --file arch/arm/configs/multi_v7_defconfig \
-d CONFIG_UNWINDER_ARM \
-e CONFIG_UNWINDER_FRAME_POINTER
$ make -skj"$(nproc)" ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- LLVM=1 defconfig zImage
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(main.o):(.ARM.extab.ref.text) is being placed in '.ARM.extab.ref.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(do_mounts_rd.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(do_mounts_initrd.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(initramfs.o):(.ARM.extab) is being placed in '.ARM.extab'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab.init.text) is being placed in '.ARM.extab.init.text'
ld.lld: warning: init/built-in.a(calibrate.o):(.ARM.extab) is being placed in '.ARM.extab'
These sections are handled by the ARM_UNWIND_SECTIONS define, which is
only added to the list of sections when CONFIG_ARM_UNWIND is set.
CONFIG_ARM_UNWIND is a hidden symbol that is only selected when
CONFIG_UNWINDER_ARM is set so CONFIG_UNWINDER_FRAME_POINTER never
handles these sections. According to the help text of
CONFIG_UNWINDER_ARM, these sections should be discarded so that the
kernel image size is not affected.
My apologies for taking so long to review this.
I have a suspicion that these come from forcing on configs that
Kconfig/menuconfig would block, and aren't clang or lld specific, yet
are exposed by the new linker warnings for orphan section placement
(good). That said, we definitely have OEMs in Android land that still
prefer the older unwinder.
From https://developer.arm.com/documentation/ihi0038/b/ (click
download in top left), section 4.4.1 "Sections" has a note:
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.
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!
quoted
quoted
though I do see binutils linker scripts use precisely what you have.
So I guess that's fine.
I guess we can't reuse `ARM_UNWIND_SECTIONS` since the ALIGN and
linker-script-defined-symbols would be weird in a DISCARD clause?
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.
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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel