[PATCH] D18166: Add _GLOBAL_OFFSET_TABLE_ symbol to shared libraries

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 18:09:23 PDT 2016


ruiu added a subscriber: ruiu.
ruiu added a comment.

Whether we should submit this or not depends on whether it will fix the issue or not, but in case if we do.


================
Comment at: ELF/Driver.cpp:345-351
@@ -344,8 +344,9 @@
+      Config->EMachine != EM_AMDGPU)
     // Add entry symbol.
     //
     // There is no entry symbol for AMDGPU binaries, so skip adding one to avoid
     // having and undefined symbol.
-    if (Config->Entry.empty() && Config->EMachine != EM_AMDGPU)
-      Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";
+    Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";

+  if (!Config->Relocatable)
     // In the assembly for 32 bit x86 the _GLOBAL_OFFSET_TABLE_ symbol
     // is magical and is used to produce a R_386_GOTPC relocation.
----------------
Reorder the conditions in `if` so that the most important stuff comes first.

  // Add default entry symbol. Note that AMDGPU executables has no entry.
  if (Config->Entry.empty() && !Config->Shared && !Config->Relocatable &&
      Config->EMachine != EM_AMDGPU)
    Config->Entry = (Config->EMachine == EM_MIPS) ? "__start" : "_start";


http://reviews.llvm.org/D18166





More information about the llvm-commits mailing list