[PATCH] D29640: [ELF] - Linkerscript - fix handling of OUTPUT_ARCH command.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 14:47:43 PST 2017


LGTM

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar updated this revision to Diff 87468.
> grimar added a comment.
>
> - Simplified testcase.
>
>
> https://reviews.llvm.org/D29640
>
> Files:
>   ELF/LinkerScript.cpp
>   test/ELF/linkerscript/outputarch.s
>
>
> Index: test/ELF/linkerscript/outputarch.s
> ===================================================================
> --- test/ELF/linkerscript/outputarch.s
> +++ test/ELF/linkerscript/outputarch.s
> @@ -1,9 +1,4 @@
>  # REQUIRES: x86
> -# RUN: echo "OUTPUT_ARCH(x)" > %t.script
> +# RUN: echo "OUTPUT_ARCH(All data written here is ignored)" > %t.script
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
>  # RUN: ld.lld -shared -o %t2 %t1 %t.script
> -# RUN: llvm-readobj %t2 > /dev/null
> -
> -# RUN: echo "OUTPUT_ARCH(x, y)" > %t.script
> -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
> -# RUN: not ld.lld -shared -o %t2 %t1 %t.script
> Index: ELF/LinkerScript.cpp
> ===================================================================
> --- ELF/LinkerScript.cpp
> +++ ELF/LinkerScript.cpp
> @@ -1246,10 +1246,10 @@
>  }
>  
>  void ScriptParser::readOutputArch() {
> -  // Error checking only for now.
> +  // Ignore expression for now.
>    expect("(");
> -  skip();
> -  expect(")");
> +  while (!Error && !consume(")"))
> +    skip();
>  }
>  
>  void ScriptParser::readOutputFormat() {
>
>
> Index: test/ELF/linkerscript/outputarch.s
> ===================================================================
> --- test/ELF/linkerscript/outputarch.s
> +++ test/ELF/linkerscript/outputarch.s
> @@ -1,9 +1,4 @@
>  # REQUIRES: x86
> -# RUN: echo "OUTPUT_ARCH(x)" > %t.script
> +# RUN: echo "OUTPUT_ARCH(All data written here is ignored)" > %t.script
>  # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
>  # RUN: ld.lld -shared -o %t2 %t1 %t.script
> -# RUN: llvm-readobj %t2 > /dev/null
> -
> -# RUN: echo "OUTPUT_ARCH(x, y)" > %t.script
> -# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-freebsd %s -o %t1
> -# RUN: not ld.lld -shared -o %t2 %t1 %t.script
> Index: ELF/LinkerScript.cpp
> ===================================================================
> --- ELF/LinkerScript.cpp
> +++ ELF/LinkerScript.cpp
> @@ -1246,10 +1246,10 @@
>  }
>  
>  void ScriptParser::readOutputArch() {
> -  // Error checking only for now.
> +  // Ignore expression for now.
>    expect("(");
> -  skip();
> -  expect(")");
> +  while (!Error && !consume(")"))
> +    skip();
>  }
>  
>  void ScriptParser::readOutputFormat() {


More information about the llvm-commits mailing list