[lld] r371225 - [ELF] Replace error() with errorOrWarn() for the ASSERT command
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 6 09:30:22 PDT 2019
Author: maskray
Date: Fri Sep 6 09:30:22 2019
New Revision: 371225
URL: http://llvm.org/viewvc/llvm-project?rev=371225&view=rev
Log:
[ELF] Replace error() with errorOrWarn() for the ASSERT command
Summary:
ld.bfd produces an output with --noinhibit-exec when an ASSERT fails.
Use errorOrWarn() so that we can produce an output as well.
An interesting case is that symbol assignments may execute multiple
times, so we probably want to suppress errors for non-final runs.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D67285
Modified:
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/test/ELF/linkerscript/assert.s
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=371225&r1=371224&r2=371225&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Fri Sep 6 09:30:22 2019
@@ -720,7 +720,7 @@ Expr ScriptParser::readAssert() {
return [=] {
if (!e().getValue())
- error(msg);
+ errorOrWarn(msg);
return script->getDot();
};
}
Modified: lld/trunk/test/ELF/linkerscript/assert.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/assert.s?rev=371225&r1=371224&r2=371225&view=diff
==============================================================================
--- lld/trunk/test/ELF/linkerscript/assert.s (original)
+++ lld/trunk/test/ELF/linkerscript/assert.s Fri Sep 6 09:30:22 2019
@@ -6,8 +6,8 @@
# RUN: llvm-readobj %t1 > /dev/null
# RUN: echo "SECTIONS { ASSERT(0, fail) }" > %t3.script
-# RUN: not ld.lld -shared -o /dev/null --script %t3.script %t1.o > %t.log 2>&1
-# RUN: FileCheck %s -check-prefix=FAIL < %t.log
+# RUN: not ld.lld -o /dev/null -T %t3.script %t1.o 2>&1 | FileCheck --check-prefix=FAIL %s
+# RUN: ld.lld -o /dev/null -T %t3.script %t1.o --noinhibit-exec 2>&1 | FileCheck --check-prefix=FAIL %s
# FAIL: fail
# RUN: echo "SECTIONS { . = ASSERT(0x1000, fail); }" > %t4.script
More information about the llvm-commits
mailing list