This repository was archived by the owner on Mar 22, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Expand file tree Collapse file tree 4 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -464,11 +464,6 @@ void LinkerScript::fabricateDefaultCommands() {
464
464
OSCmd->Sec = Sec;
465
465
SecToCommand[Sec] = OSCmd;
466
466
467
- // Prefer user supplied address over additional alignment constraint
468
- auto I = Config->SectionStartMap .find (Sec->Name );
469
- if (I != Config->SectionStartMap .end ())
470
- OSCmd->AddrExpr = [=] { return I->second ; };
471
-
472
467
Commands.push_back (OSCmd);
473
468
if (Sec->Sections .size ()) {
474
469
auto *ISD = make<InputSectionDescription>(" " );
Original file line number Diff line number Diff line change @@ -1231,6 +1231,13 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
1231
1231
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
1232
1232
OutputSectionCommands.push_back (Cmd);
1233
1233
1234
+ // Prefer command line supplied address over other constraints.
1235
+ for (OutputSectionCommand *Cmd : OutputSectionCommands) {
1236
+ auto I = Config->SectionStartMap .find (Cmd->Name );
1237
+ if (I != Config->SectionStartMap .end ())
1238
+ Cmd->AddrExpr = [=] { return I->second ; };
1239
+ }
1240
+
1234
1241
// This is a bit of a hack. A value of 0 means undef, so we set it
1235
1242
// to 1 t make __ehdr_start defined. The section number is not
1236
1243
// particularly relevant.
Original file line number Diff line number Diff line change
1
+ # REQUIRES: x86
2
+ # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3
+ # RUN: echo "SECTIONS { .text 0x200000 : { *(.text) } }" > %t.script
4
+ # RUN: ld.lld -T %t.script -Ttext 0x100000 %t.o -o %t
5
+ # RUN: llvm-readobj --elf-output-style=GNU -s %t | FileCheck %s
6
+
7
+ # CHECK: .text PROGBITS 0000000000100000
8
+
9
+ .global _start
10
+ _start:
11
+ nop
Original file line number Diff line number Diff line change @@ -42,5 +42,5 @@ global-symbols:
42
42
...
43
43
44
44
# CHECK-NOT: _myHidden
45
- # CHECK: 0x00000FFD _myRegular
46
- # CHECK: 0x00000FFE _myWeak [weak_def]
45
+ # CHECK: 0x100000FFD _myRegular
46
+ # CHECK: 0x100000FFE _myWeak [weak_def]
You can’t perform that action at this time.
0 commit comments