Skip to content
This repository was archived by the owner on Mar 22, 2019. It is now read-only.

Commit d31b429

Browse files
author
jenkins
committed
Merge branch amd-master into amd-common
2 parents 5ad0b83 + e94f5a7 commit d31b429

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

ELF/LinkerScript.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,6 @@ void LinkerScript::fabricateDefaultCommands() {
464464
OSCmd->Sec = Sec;
465465
SecToCommand[Sec] = OSCmd;
466466

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-
472467
Commands.push_back(OSCmd);
473468
if (Sec->Sections.size()) {
474469
auto *ISD = make<InputSectionDescription>("");

ELF/Writer.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,6 +1231,13 @@ template <class ELFT> void Writer<ELFT>::finalizeSections() {
12311231
if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base))
12321232
OutputSectionCommands.push_back(Cmd);
12331233

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+
12341241
// This is a bit of a hack. A value of 0 means undef, so we set it
12351242
// to 1 t make __ehdr_start defined. The section number is not
12361243
// particularly relevant.

test/ELF/linkerscript/ttext-script.s

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

test/mach-o/executable-exports.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@ global-symbols:
4242
...
4343

4444
# CHECK-NOT: _myHidden
45-
# CHECK: 0x00000FFD _myRegular
46-
# CHECK: 0x00000FFE _myWeak [weak_def]
45+
# CHECK: 0x100000FFD _myRegular
46+
# CHECK: 0x100000FFE _myWeak [weak_def]

0 commit comments

Comments
 (0)