[PATCH] D24913: [ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a library with no entry symbol

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 26 08:06:48 PDT 2016


grimar updated the summary for this revision.
grimar updated this revision to Diff 72488.
grimar added a comment.

- Updated.


https://reviews.llvm.org/D24913

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

Index: test/ELF/entry.s
===================================================================
--- test/ELF/entry.s
+++ test/ELF/entry.s
@@ -1,9 +1,16 @@
 # 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: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=NOENTRY %s
+# RUN: ld.lld %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN2 %s
+
+# RUN: ld.lld -shared -e foobar %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN %s
+# RUN: ld.lld -shared --fatal-warnings -e entry %t1 -o %t2
+# RUN: ld.lld -shared --fatal-warnings %t1 -o %t2
+
 # RUN: ld.lld %t1 -o %t2 -e entry
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s
-# RUN: ld.lld %t1 -shared -o %t2 -e entry
+# RUN: ld.lld %t1 --fatal-warnings -shared -o %t2 -e entry
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DSO %s
 # RUN: ld.lld %t1 -o %t2 --entry=4096
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=DEC %s
@@ -13,6 +20,7 @@
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=OCT %s
 
 # WARN: entry symbol foobar not found, assuming 0
+# WARN2: entry symbol _start not found, assuming 0
 
 # NOENTRY: Entry: 0x0
 # SYM: Entry: 0x11000
Index: ELF/Driver.cpp
===================================================================
--- ELF/Driver.cpp
+++ ELF/Driver.cpp
@@ -675,7 +675,7 @@
     // if it is resolvable.
     Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
   }
-  if (!HasEntryAddr) {
+  if (!HasEntryAddr && !Config->Entry.empty()) {
     if (Symtab.find(Config->Entry))
       Config->EntrySym = Symtab.addUndefined(Config->Entry);
     else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24913.72488.patch
Type: text/x-patch
Size: 1713 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/2be8e2bc/attachment-0001.bin>


More information about the llvm-commits mailing list