qualcomm / qualcomm/eld

`Assignment::Level::AFTER_SECTIONS` should be evaluated after evaluating `SECTIONS` command.

Open
#485 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.