[lld] r322801 - Handle parsing AT(ADDR(.foo-bar)).
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 17 17:14:57 PST 2018
Author: rafael
Date: Wed Jan 17 17:14:57 2018
New Revision: 322801
URL: http://llvm.org/viewvc/llvm-project?rev=322801&view=rev
Log:
Handle parsing AT(ADDR(.foo-bar)).
The problem we had with it is that anything inside an AT is an
expression, so we failed to parse the section name because of the - in
it.
Added:
lld/trunk/test/ELF/linkerscript/parse-section-in-addr.s
Modified:
lld/trunk/ELF/ScriptParser.cpp
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=322801&r1=322800&r2=322801&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Wed Jan 17 17:14:57 2018
@@ -923,7 +923,10 @@ ByteCommand *ScriptParser::readByteComma
StringRef ScriptParser::readParenLiteral() {
expect("(");
+ bool Orig = InExpr;
+ InExpr = false;
StringRef Tok = next();
+ InExpr = Orig;
expect(")");
return Tok;
}
Added: lld/trunk/test/ELF/linkerscript/parse-section-in-addr.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/parse-section-in-addr.s?rev=322801&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/parse-section-in-addr.s (added)
+++ lld/trunk/test/ELF/linkerscript/parse-section-in-addr.s Wed Jan 17 17:14:57 2018
@@ -0,0 +1,10 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+
+# RUN: echo "SECTIONS { \
+# RUN: .foo-bar : AT(ADDR(.foo-bar)) { *(.text) } \
+# RUN: }" > %t.script
+# RUN: ld.lld -o %t.so --script %t.script %t.o -shared
+# RUN: llvm-readelf -S %t.so | FileCheck %s
+
+# CHECK: .foo-bar
More information about the llvm-commits
mailing list