diff options
-rw-r--r-- | lld/ELF/ScriptParser.cpp | 3 | ||||
-rw-r--r-- | lld/test/ELF/linkerscript/parse-section-in-addr.s | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 65d3332a85f..d66f9093b3e 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -923,7 +923,10 @@ ByteCommand *ScriptParser::readByteCommand(StringRef Tok) { StringRef ScriptParser::readParenLiteral() { expect("("); + bool Orig = InExpr; + InExpr = false; StringRef Tok = next(); + InExpr = Orig; expect(")"); return Tok; } diff --git a/lld/test/ELF/linkerscript/parse-section-in-addr.s b/lld/test/ELF/linkerscript/parse-section-in-addr.s new file mode 100644 index 00000000000..7a79f646310 --- /dev/null +++ b/lld/test/ELF/linkerscript/parse-section-in-addr.s @@ -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 |