-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Description/Background
At least one Zephyr test is exceeding memory limits when building with eld, I think because we aren't able to remove duplicate .ARM.exidx sections--eld ends up with a final .ARM.exidx section of ~19,000 bytes (and overflows the memory region) whereas bfd and lld collapse the section down to 8/16 bytes, respectively.
I don't know exactly how this is supposed to work, but I think it was implemented (in part) in lld here and the description goes into some detail: https://reviews.llvm.org/D40967
Example
The original test where I was seeing this was in tests/bluetooth/shell/bluetooth.shell.shell_br for qemu_cortex_m3 in Zephyr v4.1. Below is just a very simple example that I think demonstrates the approximate same idea?
cat > main.c << '!'
int foo(int a) { return a; }
int bar(int a) { return a; }
int baz(int a) { return a; }
int main(int argc, char *argv[]) { return 0; }
!
clang --target=arm-none-eabi -ffunction-sections -c main.c
# [ 2] .ARM.exidx ARM_EXIDX 0000805c 00105c 000008 00 AL 1 0 4
arm-none-eabi-ld.bfd main.o
# [ 1] .ARM.exidx ARM_EXIDX 000100f4 0000f4 000010 00 AL 2 0 4
ld.lld main.o
# [ 2] .ARM.exidx ARM_EXIDX 0000005c 00105c 000020 00 AL 1 0 4
ld.eld main.o
Reactions are currently unavailable