Linking Linux kernel aspeed_g5_defconfig fails #44169
On mainline Linux:
$ make -j$(nproc) -s ARCH=arm CC=clang CROSS_COMPILE=arm-linux-gnueabi- LD=ld.lld O=out.arm32 distclean aspeed_g5_defconfig vmlinux
The text was updated successfully, but these errors were encountered:
The example shows up three nasty problems:
Unfortunately there is no clean way of finding out how to mark the .ARM.exidx.text.exit section as non-live with the current code base. My current thoughts are that we add a function to LinkerScript to say something like onMatchDiscard(InputSections, callback) so that we could take the list of ExidxSections that the ARMExidxSyntheticSection contains can be filtered against the /DISCARD/ patterns.
2.) The linker script has a non-monotonic order of OutputSection address, in particular 0xffff0000 for the .vectors section. This breaks the assumption that OuputSection::sectionIndex is sufficient to order the .ARM.exidx synthetic table. We will have to do it after the first call to assignAddresses() to be correct.
3.) The .vectors placed at 0xffff0000 (On ArmV5 the vector table can be at either 0x0 or 0xffff0000) are too far away from the .ARM.exidx table (close to 0x80000000) to generate a synthetic table entry. There is no point in generating a table entry when the destination is out of range. Unfortunately we won't know that until after the initial address allocation what the ranges are.
It is likely that 2 and 3 can be fixed as they both dependent on address allocation. 1 is independent.
I've submitted https://reviews.llvm.org/D78422 to move the location of .ARM.exidx sorting. This won't fix anything yet, but it will enable the vector table out of range to be solved as address information will be available.
Reproducers in LLD test form for the problems:
Vector table synthesised .ARM.exidx section out of range
// RUN: llvm-mc --arm-add-build-attributes --triple=armv7a-linux-gnueabihf -filetype=obj %s -o %t.o
.section .vectors, "ax", %progbits
// REQUIRES: arm
// CHECK-NOT: .exit.text
Discarding of .ARM.exidx but not the executable section with a link to it.
/// The /DISCARD/ is evaluated after sections have been assigned to the
.section .text.__aeabi_unwind_cpp_pr0, "ax", %progbits
Submitted https://reviews.llvm.org/D79687 to fix the /DISCARD/ of a subset of the .ARM.exidx sections.
https://reviews.llvm.org/D79289 landed with rG48aebfc908ba: [ELF][ARM] Do not create .ARM.exidx sections for out of range inputs
master with D79687 should permit this particular configuration to succeed.