[PATCH] D24908: [ELF] - Do not error out if "entry symbol not found" warking + --fatal-warnings are used together.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 04:16:30 PDT 2016


grimar created this revision.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar, evgeny777, emaste.

This is PR30521,
we produce warning "entry symbol not found". If it is used together with --fatal-warnings,
lld errors out. That is different from whar ld do, ld ignores that flag with this warning.
btw gold disagree with ld here, but I assume we want to be compatible with ld, so
I introduced new method info() that solves that problem.

https://reviews.llvm.org/D24908

Files:
  ELF/Driver.cpp
  ELF/Error.cpp
  ELF/Error.h
  test/ELF/entry.s

Index: test/ELF/entry.s
===================================================================
--- test/ELF/entry.s
+++ test/ELF/entry.s
@@ -1,5 +1,6 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1
-# RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN %s
+# RUN: ld.lld -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=INFO %s
+# RUN: ld.lld --fatal-warnings -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=INFO %s
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=NOENTRY %s
 # RUN: ld.lld %t1 -o %t2 -e entry
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s
@@ -12,7 +13,7 @@
 # RUN: ld.lld %t1 -o %t2 -e 0777
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s
 
-# WARN: entry symbol foobar not found, assuming 0
+# INFO: entry symbol foobar not found, assuming 0
 
 # NOENTRY: Entry: 0x0
 # SYM: Entry: 0x11000
Index: ELF/Error.h
===================================================================
--- ELF/Error.h
+++ ELF/Error.h
@@ -19,6 +19,7 @@
 extern llvm::raw_ostream *ErrorOS;
 
 void log(const Twine &Msg);
+void info(const Twine &Msg);
 void warning(const Twine &Msg);
 
 void error(const Twine &Msg);
Index: ELF/Error.cpp
===================================================================
--- ELF/Error.cpp
+++ ELF/Error.cpp
@@ -26,6 +26,8 @@
     outs() << Msg << "\n";
 }
 
+void elf::info(const Twine &Msg) { *ErrorOS << Msg << "\n"; }
+
 void elf::warning(const Twine &Msg) {
   if (Config->FatalWarnings)
     error(Msg);
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -679,7 +679,7 @@
     if (Symtab.find(Config->Entry))
       Config->EntrySym = Symtab.addUndefined(Config->Entry);
     else
-      warning("entry symbol " + Config->Entry + " not found, assuming 0");
+      info("entry symbol " + Config->Entry + " not found, assuming 0");
   }
 
   if (HasError)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24908.72458.patch
Type: text/x-patch
Size: 1977 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/93b1db44/attachment.bin>


More information about the llvm-commits mailing list