From: Fangrui Song Date: Fri, 6 Sep 2019 16:30:22 +0000 (+0000) Subject: [ELF] Replace error() with errorOrWarn() for the ASSERT command X-Git-Tag: llvmorg-11-init~9826 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2682bc3c9d1ec7da324bedfa46fce537797b5a49;p=platform%2Fupstream%2Fllvm.git [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 llvm-svn: 371225 --- diff --git a/lld/ELF/ScriptParser.cpp b/lld/ELF/ScriptParser.cpp index 40c993d..9ada28c 100644 --- a/lld/ELF/ScriptParser.cpp +++ b/lld/ELF/ScriptParser.cpp @@ -720,7 +720,7 @@ Expr ScriptParser::readAssert() { return [=] { if (!e().getValue()) - error(msg); + errorOrWarn(msg); return script->getDot(); }; } diff --git a/lld/test/ELF/linkerscript/assert.s b/lld/test/ELF/linkerscript/assert.s index f7113e5..b1ca86e 100644 --- a/lld/test/ELF/linkerscript/assert.s +++ b/lld/test/ELF/linkerscript/assert.s @@ -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