diff options
author | George Rimar <grimar@accesssoftek.com> | 2016-12-15 16:12:34 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2016-12-15 16:12:34 +0000 |
commit | 6cbfce77857689da66ba10b1e03f41f44ef98eb8 (patch) | |
tree | 0c1eb7f1253067d6a4158d773557c7f869f9e30a | |
parent | 0ca19879778c7f958a6d0fd9f04d98f249187fca (diff) | |
download | bcm5719-llvm-6cbfce77857689da66ba10b1e03f41f44ef98eb8.tar.gz bcm5719-llvm-6cbfce77857689da66ba10b1e03f41f44ef98eb8.zip |
[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
-rw-r--r-- | lld/ELF/Options.td | 2 | ||||
-rw-r--r-- | lld/test/ELF/sectionstart.s | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lld/ELF/Options.td b/lld/ELF/Options.td index 4530796e7a5..1bf6490ce26 100644 --- a/lld/ELF/Options.td +++ b/lld/ELF/Options.td @@ -283,6 +283,8 @@ def alias_Tdata: J<"Tdata=">, Alias<Tdata>; def alias_trace: Flag<["-"], "t">, Alias<trace>; def alias_trace_symbol_y : JoinedOrSeparate<["-"], "y">, Alias<trace_symbol>; def alias_Ttext: J<"Ttext=">, Alias<Ttext>; +def alias_Ttext_segment: S<"Ttext-segment">, Alias<Ttext>; +def alias_Ttext_segment_eq: J<"Ttext-segment=">, Alias<Ttext>; def alias_undefined_eq: J<"undefined=">, Alias<undefined>; def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>; def alias_version_V: Flag<["-"], "V">, Alias<version>; diff --git a/lld/test/ELF/sectionstart.s b/lld/test/ELF/sectionstart.s index 31cfbbb3b8d..23574c14748 100644 --- a/lld/test/ELF/sectionstart.s +++ b/lld/test/ELF/sectionstart.s @@ -20,6 +20,12 @@ # RUN: ld.lld %t.o -Ttext=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 # RUN: llvm-objdump -section-headers %t4 | FileCheck %s +## Check Ttext-segment X and Ttext-segment=X forms. +# RUN: ld.lld %t.o -Ttext-segment=0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 +# RUN: llvm-objdump -section-headers %t4 | FileCheck %s +# RUN: ld.lld %t.o -Ttext-segment 0x100000 -Tdata=0x110000 -Tbss=0x200000 -o %t4 +# RUN: llvm-objdump -section-headers %t4 | FileCheck %s + ## The same, but dropped "0x" prefix. # RUN: ld.lld %t.o -Ttext=100000 -Tdata=110000 -Tbss=200000 -o %t5 # RUN: llvm-objdump -section-headers %t5 | FileCheck %s |