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/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 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