`Assignment::Level::AFTER_SECTIONS` should be evaluated after evaluating `SECTIONS` command.
Open
@parth-07 is already working on this.
Since Nov 6, 2025.
bug
- Dominant language
- C++
- Stars
- 259
- Forks
- 84
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 72
Description
Currently, AFTER_SECTIONS symbols are evaluated before evaluating SECTIONS command. This is incorrect and can result in incorrect assignments.
Reproducer:
cat > 1.c << '!'
int foo() { return 1; }
int bar() { return foo(); }
!
cat > script.t << '!'
u = 0x100;
SECTIONS {
v = u;
}
u = 0x300;
!
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
done
llvm-readelf -s 1.eld.out | grep 'ABS v'
v value is 0x300 but it should be 0x100.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.