[lld] r315569 - [ELF] - Linkerscript: Add `~` as separate math token.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 01:40:12 PDT 2017
Author: grimar
Date: Thu Oct 12 01:40:12 2017
New Revision: 315569
URL: http://llvm.org/viewvc/llvm-project?rev=315569&view=rev
Log:
[ELF] - Linkerscript: Add `~` as separate math token.
Previously we did not support following:
foo = ~0xFF;
and had to add space before numeric value:
foo = ~ 0xFF
That was constistent with ld.bfd < 2.30, which shows:
script.txt:3: undefined symbol `~2' referenced in expression,
but inconsistent with gold.
It was fixed for ld.bfd 2.30 as well:
https://sourceware.org/bugzilla/show_bug.cgi?id=22267
Differential revision: https://reviews.llvm.org/D36508
Modified:
lld/trunk/ELF/ScriptLexer.cpp
lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s
Modified: lld/trunk/ELF/ScriptLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptLexer.cpp?rev=315569&r1=315568&r2=315569&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptLexer.cpp (original)
+++ lld/trunk/ELF/ScriptLexer.cpp Thu Oct 12 01:40:12 2017
@@ -164,7 +164,7 @@ bool ScriptLexer::atEOF() { return Error
// Split a given string as an expression.
// This function returns "3", "*" and "5" for "3*5" for example.
static std::vector<StringRef> tokenizeExpr(StringRef S) {
- StringRef Ops = "+-*/:!"; // List of operators
+ StringRef Ops = "+-*/:!~"; // List of operators
// Quoted strings are literal strings, so we don't want to split it.
if (S.startswith("\""))
Modified: lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s?rev=315569&r1=315568&r2=315569&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s (original)
+++ lld/trunk/test/ELF/linkerscript/symbol-assignexpr.s Thu Oct 12 01:40:12 2017
@@ -6,7 +6,7 @@
# RUN: symbol2 = symbol + 0x1234; \
# RUN: symbol3 = symbol2; \
# RUN: symbol4 = symbol + -4; \
-# RUN: symbol5 = symbol - ~ 0xfffb; \
+# RUN: symbol5 = symbol - ~0xfffb; \
# RUN: symbol6 = symbol - ~(0xfff0 + 0xb); \
# RUN: symbol7 = symbol - ~ 0xfffb + 4; \
# RUN: symbol8 = ~ 0xffff + 4; \
More information about the llvm-commits
mailing list