[PATCH] D23925: [ELF] Default to entry address 0x0 in case start symbol is not defined and entry point is not specified in command line

Eugene Leviant via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 06:04:34 PDT 2016


evgeny777 added inline comments.

================
Comment at: ELF/Driver.cpp:552-557
@@ -551,6 +551,8 @@
 
   // Add entry symbol. Note that AMDGPU binaries have no entry points.
   if (Config->Entry.empty() && !Config->Shared && !Config->Relocatable &&
-      Config->EMachine != EM_AMDGPU)
+      Config->EMachine != EM_AMDGPU) {
     Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
+    Config->ForcedEntry = true;
+  }
 
----------------
ruiu wrote:
> Can you move this after the code adding files to the symbol table? Once you add all files to the symbol table, you know whether _start is resolvable or not, so you can add an undefined symbol _start only when available. In that way, I think you can remove ForcedEntry variable.
Unfortunately, I can't. The main problem is that in general _start symbol should exist in symtab, before adding files, otherwise LTO can optimize out everything. 


Repository:
  rL LLVM

https://reviews.llvm.org/D23925





More information about the llvm-commits mailing list