[PATCH] D30171: [ELF] - Make ASSERT() return Dot instead of evaluated value.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 23:45:24 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL295703: [ELF] - Make ASSERT() return Dot instead of evaluated value. (authored by grimar).

Changed prior to commit:
  https://reviews.llvm.org/D30171?vs=89127&id=89167#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30171

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/ELF/linkerscript/assert.s
  lld/trunk/test/ELF/linkerscript/locationcountererr2.s


Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -1468,10 +1468,9 @@
   StringRef Msg = unquote(next());
   expect(")");
   return [=](uint64_t Dot) {
-    uint64_t V = E(Dot);
-    if (!V)
+    if (!E(Dot))
       error(Msg);
-    return V;
+    return Dot;
   };
 }
 
Index: lld/trunk/test/ELF/linkerscript/locationcountererr2.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/locationcountererr2.s
+++ lld/trunk/test/ELF/linkerscript/locationcountererr2.s
@@ -3,3 +3,6 @@
 # RUN: echo "SECTIONS { . = 0x20; . = 0x10; }" > %t.script
 # RUN: not ld.lld %t.o --script %t.script -o %t -shared 2>&1 | FileCheck %s
 # CHECK: unable to move location counter backward
+
+# RUN: echo "SECTIONS { . = 0x20; . = ASSERT(0x1, "foo"); }" > %t2.script
+# RUN: ld.lld %t.o --script %t2.script -o %t -shared
Index: lld/trunk/test/ELF/linkerscript/assert.s
===================================================================
--- lld/trunk/test/ELF/linkerscript/assert.s
+++ lld/trunk/test/ELF/linkerscript/assert.s
@@ -5,10 +5,6 @@
 # RUN: ld.lld -shared -o %t1 --script %t1.script %t1.o
 # RUN: llvm-readobj %t1 > /dev/null
 
-# RUN: echo "SECTIONS { ASSERT(ASSERT(42, fail) == 42, fail) }" > %t2.script
-# RUN: ld.lld -shared -o %t2 --script %t2.script %t1.o
-# RUN: llvm-readobj %t2 > /dev/null
-
 # RUN: echo "SECTIONS { ASSERT(0, fail) }" > %t3.script
 # RUN: not ld.lld -shared -o %t3 --script %t3.script %t1.o > %t.log 2>&1
 # RUN: FileCheck %s -check-prefix=FAIL < %t.log


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30171.89167.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170221/32d5403f/attachment.bin>


More information about the llvm-commits mailing list