Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/Target/GNULDBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2597,6 +2597,7 @@ bool GNULDBackend::setOutputSectionOffset() {
if (isCurAlloc && cur->size())
changeSymbolsFromAbsoluteToGlobal(*out);
prev = cur;
evaluateAssignmentsAtEndOfOutputSection(*out);
++out;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extern int u1;
int foo() { return 1; }
int bar() { return u1; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
u1 = 0x100;
SECTIONS {
u2 = 0x300;
foo : {
*(.text.foo)
u3 = 0x500;
}
u4 = 0x700;
bar : {
u5 = 0x900;
*(.text.bar)
}
u5 = 0x1100;
}
u6 = 0x1300;
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#---PartialLinkWithOutputSectionEndAssignments.test----- Executable,LS -----#
#BEGIN_COMMENT
# This test verifies that the linker properly evaluates the output section end
# symbol assignments when partial linking.
#END_COMMENT
#START_TEST
RUN: %clang %clangopts -o %t1.1.o %p/Inputs/1.c -c -ffunction-sections
RUN: %link %linkopts -o %t1.1.out %t1.1.o -T %p/Inputs/script.t -r
RUN: %readelf -s %t1.1.out | %filecheck %s
#END_TEST

CHECK: 100 {{.*}} u1
CHECK: 300 {{.*}} u2
CHECK: 500 {{.*}} u3
CHECK: 700 {{.*}} u4
CHECK: 1100 {{.*}} u5
CHECK: 1300 {{.*}} u6
Loading