[PATCH] D18731: ELF: Create dynamic symbols for symbol aliases of copy relocations.

Rafael Ávila de Espíndola via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 14:50:54 PDT 2016


rafael added a comment.

I am pretty sure this is OK. Just give me a minute to dig why gold treats weak specially.


================
Comment at: ELF/Writer.cpp:752
@@ -753,7 +751,3 @@
   uintX_t MaxAlign = Out<ELFT>::Bss->getAlign();
-  for (SharedSymbol<ELFT> *SS : Syms) {
-    uintX_t Align = getAlignment(SS);
-    Off = alignTo(Off, Align);
-    SS->OffsetInBss = Off;
-    Off += SS->Sym.st_size;
-    MaxAlign = std::max(MaxAlign, Align);
+  MaxAlign = std::max(MaxAlign, Align);
+  uintX_t Shndx = SS->Sym.st_shndx;
----------------
Just merge this on the previous line now that the loop is gone.

================
Comment at: ELF/Writer.cpp:764
@@ +763,3 @@
+      SSInFile.setUsedInRegularObj();
+      SSInFile.MustBeInDynSym = true;
+      if (SSInFile.Sym.getBinding() == ELF::STB_GLOBAL)
----------------
I think this is expected. Consider the case:

Program uses LibA and LibB.
LibA also uses LibB.
Program has copy relocation to X of LibB.
LibA assumes that X and Y have the same address.

Under these conditions the Program has to have both X and Y.

Adding something like that to the comment would be nice :-)


http://reviews.llvm.org/D18731





More information about the llvm-commits mailing list