Skip to content

Conversation

@parth-07
Copy link
Contributor

Until now, the linker was not evaluating output section end symbol assignments in partial links. This commit fixes this behavior.

Resolves #479

@partaror partaror force-pushed the MissingSectionsEndAssignEvalPartialLink branch from a4eefc7 to 4bf9855 Compare November 24, 2025 15:05
@quic-seaswara
Copy link
Contributor

This is a good start but I am not sure about what is its effect on symbol values that are specified in the output section.

cat > 1.c <<  \!
int foo(float x) { return 0; }
!

cat > s.t << \!
SECTIONS {
  .foo : {
    *(.text.foo)
    u1 = 0x100;
  }
}
!

/usr/bin/clang -c 1.c -ffunction-sections -fno-asynchronous-unwind-tables
#eld
ld.eld -r 1.o -o r.o -T s.t
readelf -s r.o | grep u1
ld.eld r.o -o out.eld && readelf -s out.eld | grep u1
#bfd
ld.bfd -r 1.o -o r.o -T s.t
readelf -s r.o | grep u1
ld.bfd r.o -o out.bfd && readelf -s out.bfd | grep u1
#lld
ld.lld -r 1.o -o r.o -T s.t
readelf -s r.o | grep u1
ld.lld r.o -o out.lld && readelf -s out.lld | grep u1

Please document this behavior.

@partaror partaror force-pushed the MissingSectionsEndAssignEvalPartialLink branch from 4bf9855 to 8d0996b Compare January 5, 2026 13:16
@parth-07
Copy link
Contributor Author

parth-07 commented Jan 6, 2026

This is a good start but I am not sure about what is its effect on symbol values that are specified in the output section.

This patch does not affect the evaluations of symbol assignments that are specified in the output section. The above example shared behaves as expected, that is, the value of u1 is 0x100 with and without this patch changes.

Please document this behavior.

Symbol assignment evaluation order should be the same for both the usual and the partial link. We have the symbol assignment
evaluation order docs: https://qualcomm.github.io/eld/documentation/linker_script.html#assignment-evaluation-order. This patch makes the partial linking assignment evaluation order to what the docs states.

@quic-seaswara quic-seaswara force-pushed the MissingSectionsEndAssignEvalPartialLink branch from 8d0996b to d20333c Compare January 7, 2026 22:05
Until now, the linker was not evaluating output section end symbol
assignments in partial links. This commit fixes this behavior.

Resolves qualcomm#479

Signed-off-by: Parth Arora <[email protected]>
@partaror partaror force-pushed the MissingSectionsEndAssignEvalPartialLink branch from d20333c to 3819016 Compare January 8, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

linker script assignments are not evaluated for partial links

2 participants