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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 2 09:52:08 PDT 2016


On Wed, Nov 2, 2016 at 9:06 AM, George Rimar via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: grimar
> Date: Wed Nov  2 11:06:00 2016
> New Revision: 285824
>
> URL: http://llvm.org/viewvc/llvm-project?rev=285824&view=rev
> Log:
> [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.
>
> Modified:
>     lld/trunk/ELF/Options.td
>     lld/trunk/test/ELF/sectionstart.s
>
> Modified: lld/trunk/ELF/Options.td
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Options.
> td?rev=285824&r1=285823&r2=285824&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/Options.td (original)
> +++ lld/trunk/ELF/Options.td Wed Nov  2 11:06:00 2016
> @@ -27,11 +27,11 @@ def L: JoinedOrSeparate<["-"], "L">, Met
>
>  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">;
>

Please use S instead of Separate because we want to accept both -Tbss and
--Tbss.


>
>  def allow_multiple_definition: F<"allow-multiple-definition">,
>    HelpText<"Allow multiple definitions">;
> @@ -252,8 +252,11 @@ def alias_soname_h: JoinedOrSeparate<["-
>  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>;
>
> Modified: lld/trunk/test/ELF/sectionstart.s
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/
> sectionstart.s?rev=285824&r1=285823&r2=285824&view=diff
> ============================================================
> ==================
> --- lld/trunk/test/ELF/sectionstart.s (original)
> +++ lld/trunk/test/ELF/sectionstart.s Wed Nov  2 11:06:00 2016
> @@ -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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161102/76674225/attachment.html>


More information about the llvm-commits mailing list