-
Notifications
You must be signed in to change notification settings - Fork 40
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
In some cases, layout reiteration that happens in eld causes incorrect linker script symbol value. This happens because layout reiteration causes reevaluation of some assignments with newer symbol values than what they should use.
Reproducer:
#!/usr/bin/env bash
cat >1.c <<\EOF
int foo() { return 1; }
int val = 3;
EOF
cat > script.t << '!'
u = 0x100;
SECTIONS {
v = u;
.text : { *(.text*) }
u = 0x300;
.data : { *(.data*) }
}
!
LDs=(ld.eld)
SFs=(eld)
clang -o 1.o --target=riscv64-unknown-elf 1.c -c -ffunction-sections
for i in "${!SFs[@]}"; do
${LDs[$i]} -o 1.${SFs[$i]}.out 1.o -T script.t -Map 1.${SFs[$i]}.map.txt
done
llvm-readelf -s 1.eld.out | grep 'ABS v'
EOF
**Output**13: 0000000000000300 0 NOTYPE GLOBAL DEFAULT ABS v
The expected value of `v` is 0x100.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working