[PATCH] D36579: [ELF] - Do not fail when set versions for linkerscript's symbol aliases

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 12 10:07:58 PDT 2017


ruiu added inline comments.


================
Comment at: ELF/Writer.cpp:800
     // ftp://www.linux-mips.org/pub/linux/mips/doc/ABI/mipsabi.pdf
-    ElfSym::MipsGp = Symtab->addAbsolute<ELFT>("_gp", STV_HIDDEN, STB_LOCAL);
+    SymbolBody *GP = Symtab->find("_gp");
+    if (!GP || !GP->isInCurrentDSO())
----------------
GP -> Gp

(You can see below that MipsGp is named MipsGp and not MipsGP.)


================
Comment at: ELF/Writer.cpp:801-804
+    if (!GP || !GP->isInCurrentDSO())
+      ElfSym::MipsGp = Symtab->addAbsolute<ELFT>("_gp", STV_HIDDEN, STB_LOCAL);
+    else
+      ElfSym::MipsGp = dyn_cast<DefinedRegular>(GP);
----------------
I don't get the meaning of this part. Gp doesn't seem to be guaranteed to be a DefinedRegular.


================
Comment at: ELF/Writer.cpp:808
     // start of function and 'gp' pointer into GOT.
-    if (Symtab->find("_gp_disp"))
+    SymbolBody *GPD = Symtab->find("_gp_disp");
+    if (GPD && !GPD->isInCurrentDSO())
----------------
GPD -> GpDisp


================
Comment at: ELF/Writer.cpp:819
     // https://sourceware.org/ml/binutils/2004-12/msg00094.html
-    if (Symtab->find("__gnu_local_gp"))
+    SymbolBody *LGP = Symtab->find("__gnu_local_gp");
+    if (LGP && !LGP->isInCurrentDSO())
----------------
LGP -> LocalGp


https://reviews.llvm.org/D36579





More information about the llvm-commits mailing list