[lld] r290206 - [ELF] Do not warn about missed entry symbol in case of relocatable output

Simon Atanasyan via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 14:24:45 PST 2016


Author: atanasyan
Date: Tue Dec 20 16:24:45 2016
New Revision: 290206

URL: http://llvm.org/viewvc/llvm-project?rev=290206&view=rev
Log:
[ELF] Do not warn about missed entry symbol in case of relocatable output

Relocatable file does not need to have an entry symbol so the warning is
useless in that case.

Modified:
    lld/trunk/ELF/Driver.cpp
    lld/trunk/test/ELF/entry.s

Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=290206&r1=290205&r2=290206&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Tue Dec 20 16:24:45 2016
@@ -770,7 +770,8 @@ template <class ELFT> void LinkerDriver:
   // Use default entry point name if no name was given via the command
   // line nor linker scripts. For some reason, MIPS entry point name is
   // different from others.
-  Config->WarnMissingEntry = (!Config->Entry.empty() || !Config->Shared);
+  Config->WarnMissingEntry =
+      (!Config->Entry.empty() || (!Config->Shared && !Config->Relocatable));
   if (Config->Entry.empty() && !Config->Relocatable)
     Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
 

Modified: lld/trunk/test/ELF/entry.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/entry.s?rev=290206&r1=290205&r2=290206&view=diff
==============================================================================
--- lld/trunk/test/ELF/entry.s (original)
+++ lld/trunk/test/ELF/entry.s Tue Dec 20 16:24:45 2016
@@ -23,6 +23,9 @@
 # WARN4: cannot find entry symbol _start; not setting start address
 # NOENTRY: Entry: 0x0
 
+# RUN: ld.lld -v -r %t1 -o %t2 2>&1 | FileCheck -check-prefix=WARN5 %s
+# WARN5-NOT: warning: cannot find entry symbol
+
 # RUN: ld.lld %t1 -o %t2 -e entry
 # RUN: llvm-readobj -file-headers %t2 | FileCheck -check-prefix=SYM %s
 # SYM: Entry: 0x201008




More information about the llvm-commits mailing list