[PATCH] D67285: [ELF] Replace error() with errorOrWarn() for the ASSERT command

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 09:13:47 PDT 2019


MaskRay created this revision.
MaskRay added reviewers: grimar, peter.smith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.

ld.bfd produces an output with --noinhibit-exec.
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.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D67285

Files:
  ELF/ScriptParser.cpp
  test/ELF/linkerscript/assert.s


Index: test/ELF/linkerscript/assert.s
===================================================================
--- test/ELF/linkerscript/assert.s
+++ 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
Index: ELF/ScriptParser.cpp
===================================================================
--- ELF/ScriptParser.cpp
+++ ELF/ScriptParser.cpp
@@ -720,7 +720,7 @@
 
   return [=] {
     if (!e().getValue())
-      error(msg);
+      errorOrWarn(msg);
     return script->getDot();
   };
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67285.219125.patch
Type: text/x-patch
Size: 990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/57c1604a/attachment-0001.bin>


More information about the llvm-commits mailing list