[ELF] - Allow "-Ttext xxx", "-Tbss xxx", "-Tdata bss" commandline.

So patch just defines an alias for -Txxx=YYY forms,
this is consistent with ld and should fix PR30814.

llvm-svn: 285824
This commit is contained in:
George Rimar 2016-11-02 16:06:00 +00:00
parent 560ae565e9
commit 6a0855470f
2 changed files with 13 additions and 6 deletions

View File

@ -27,11 +27,11 @@ def L: JoinedOrSeparate<["-"], "L">, MetaVarName<"<dir>">,
def O: Joined<["-"], "O">, HelpText<"Optimize output file size">;
def Tbss: J<"Tbss=">, HelpText<"Same as --section-start with .bss as the sectionname">;
def Tbss: Separate<["-"], "Tbss">, HelpText<"Same as --section-start with .bss as the sectionname">;
def Tdata: J<"Tdata=">, HelpText<"Same as --section-start with .data as the sectionname">;
def Tdata: Separate<["-"], "Tdata">, HelpText<"Same as --section-start with .data as the sectionname">;
def Ttext: J<"Ttext=">, HelpText<"Same as --section-start with .text as the sectionname">;
def Ttext: Separate<["-"], "Ttext">, HelpText<"Same as --section-start with .text as the sectionname">;
def allow_multiple_definition: F<"allow-multiple-definition">,
HelpText<"Allow multiple definitions">;
@ -252,8 +252,11 @@ def alias_soname_h: JoinedOrSeparate<["-"], "h">, Alias<soname>;
def alias_soname_soname: S<"soname">, Alias<soname>;
def alias_strip_all: Flag<["-"], "s">, Alias<strip_all>;
def alias_strip_debug_S: Flag<["-"], "S">, Alias<strip_debug>;
def alias_Tbss: J<"Tbss=">, Alias<Tbss>;
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_undefined_eq: J<"undefined=">, Alias<undefined>;
def alias_undefined_u: JoinedOrSeparate<["-"], "u">, Alias<undefined>;
def alias_version_V: Flag<["-"], "V">, Alias<version>;

View File

@ -24,6 +24,10 @@
# RUN: ld.lld %t.o -Ttext=100000 -Tdata=110000 -Tbss=200000 -o %t5
# RUN: llvm-objdump -section-headers %t5 | FileCheck %s
## Check form without assignment:
# RUN: ld.lld %t.o -Ttext 0x100000 -Tdata 0x110000 -Tbss 0x200000 -o %t4
# RUN: llvm-objdump -section-headers %t4 | FileCheck %s
## Errors:
# RUN: not ld.lld %t.o --section-start .text100000 -o %t2 2>&1 \
# RUN: | FileCheck -check-prefix=ERR1 %s
@ -35,15 +39,15 @@
# RUN: not ld.lld %t.o -Ttext=1w0000 -o %t6 2>&1 \
# RUN: | FileCheck -check-prefix=ERR3 %s
# ERR3: invalid argument: -Ttext=1w0000
# ERR3: invalid argument: -Ttext 1w0000
# RUN: not ld.lld %t.o -Tbss=1w0000 -o %t6 2>&1 \
# RUN: | FileCheck -check-prefix=ERR4 %s
# ERR4: invalid argument: -Tbss=1w0000
# ERR4: invalid argument: -Tbss 1w0000
# RUN: not ld.lld %t.o -Tdata=1w0000 -o %t6 2>&1 \
# RUN: | FileCheck -check-prefix=ERR5 %s
# ERR5: invalid argument: -Tdata=1w0000
# ERR5: invalid argument: -Tdata 1w0000
.text
.globl _start