[lld] r294432 - [ELF] - Linkerscript - fix handling of OUTPUT_ARCH command.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 8 01:59:06 PST 2017
Author: grimar
Date: Wed Feb 8 03:59:06 2017
New Revision: 294432
URL: http://llvm.org/viewvc/llvm-project?rev=294432&view=rev
Log:
[ELF] - Linkerscript - fix handling of OUTPUT_ARCH command.
OUTPUT_ARCH command can contain architecture values separated with ":", like:
OUTPUT_ARCH(i386:x86-64)
We did not support that, because got 3 lexer tokens here after recent changes.
This trivial patch fixes the issue, now whole expression inside
OUTPUT_ARCH is just ignored.
Differential revision: https://reviews.llvm.org/D29640
Modified:
lld/trunk/ELF/LinkerScript.cpp
lld/trunk/test/ELF/linkerscript/outputarch.s
Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=294432&r1=294431&r2=294432&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Feb 8 03:59:06 2017
@@ -1247,10 +1247,10 @@ void ScriptParser::readOutput() {
}
void ScriptParser::readOutputArch() {
- // Error checking only for now.
+ // OUTPUT_ARCH is ignored for now.
expect("(");
- skip();
- expect(")");
+ while (!Error && !consume(")"))
+ skip();
}
void ScriptParser::readOutputFormat() {
Modified: lld/trunk/test/ELF/linkerscript/outputarch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/outputarch.s?rev=294432&r1=294431&r2=294432&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/outputarch.s (original)
+++ lld/trunk/test/ELF/linkerscript/outputarch.s Wed Feb 8 03:59:06 2017
@@ -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
More information about the llvm-commits
mailing list