[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 12:13:28 PDT 2016
    
    
  
This revision was automatically updated to reflect the committed changes.
Closed by commit rL282427: [ELF] - Fix for: Bug 30521 - lld exits non-zero return value linking a… (authored by grimar).
Changed prior to commit:
  https://reviews.llvm.org/D24913?vs=72488&id=72536#toc
Repository:
  rL LLVM
https://reviews.llvm.org/D24913
Files:
  lld/trunk/ELF/Driver.cpp
  lld/trunk/test/ELF/entry.s
Index: lld/trunk/ELF/Driver.cpp
===================================================================
--- lld/trunk/ELF/Driver.cpp
+++ lld/trunk/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
Index: lld/trunk/test/ELF/entry.s
===================================================================
--- lld/trunk/test/ELF/entry.s
+++ lld/trunk/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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24913.72536.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/0b0b1e04/attachment.bin>
    
    
More information about the llvm-commits
mailing list