Skip to content

Commit 6cbfce7

Browse files
author
George Rimar
committedDec 15, 2016
[ELF] - Make LLD accept Ttext-segment X/Ttext-segment=X aliases for -Ttext.
It os used in work/emulators/qemu-user-static port. Which tries to use -Ttext-segment and then: # In case ld does not support -Ttext-segment, edit the default linker # script via sed to set the .text start addr. This is needed on FreeBSD # at least. <here it calls -verbose to extract and edit default bfd linker script.> Actually now we are do not fully support -Ttext properly (see D27613), but we also seems never will provide anything close to default script, like bfd do, so at least this patch introduces proper alias handling. llvm-svn: 289827
1 parent 0ca1987 commit 6cbfce7

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

‎lld/ELF/Options.td

+2
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ def alias_Tdata: J<"Tdata=">, Alias<Tdata>;
283283
def alias_trace: Flag<["-"], "t">, Alias<trace>;
284284
def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>;
285285
def alias_Ttext: J<"Ttext=">, Alias<Ttext>;
286+
def alias_Ttext_segment: S<"Ttext-segment">, Alias<Ttext>;
287+
def alias_Ttext_segment_eq: J<"Ttext-segment=">, Alias<Ttext>;
286288
def alias_undefined_eq: J<"undefined=">, Alias<undefined>;
287289
def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
288290
def alias_version_V: Flag<["-"], "V">, Alias<version>;

‎lld/test/ELF/sectionstart.s

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
# RUN: ld.lld %t.o -Ttext=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4
2121
# RUN: llvm-objdump -section-headers %t4 | FileCheck %s
2222

23+
## Check Ttext-segment X and Ttext-segment=X forms.
24+
# RUN: ld.lld %t.o -Ttext-segment=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4
25+
# RUN: llvm-objdump -section-headers %t4 | FileCheck %s
26+
# RUN: ld.lld %t.o -Ttext-segment 0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4
27+
# RUN: llvm-objdump -section-headers %t4 | FileCheck %s
28+
2329
## The same, but dropped "0x" prefix.
2430
# RUN: ld.lld %t.o -Ttext=100000 -Tdata=110000 -Tbss=200000 -o %t5
2531
# RUN: llvm-objdump -section-headers %t5 | FileCheck %s

0 commit comments

Comments
 (0)