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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 29 11:00:34 PDT 2016

ruiu 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;
+  }
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.



More information about the llvm-commits mailing list