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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 4 14:27:30 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/Writer.cpp:816
@@ -767,3 +815,3 @@
   StringRef Dest = Script->getOutputSection<ELFT>(S);
   if (!Dest.empty())
     return Dest;
----------------
pcc wrote:
> Yes, both symbols will be in the dynsym. I think we probably need to create dynsyms for all symbols at the same offset regardless of whether they are strong or weak, as otherwise the DSO will be able to observe breakage.
> 
> e.g. if the DSO looks like this:
> ```
> int a;
> __attribute__((weak, alias("a"))) int b;
> 
> bool f() {
>   return &a == &b;
> }
> ```
> 
> the function f should return true regardless of which symbols are used in the main executable (if they're being overridden, that's another matter, though).
Makes sense, although it's very subtle. But I don't know how to fix it. Probably the very notion of the copy relocation is subtle.


http://reviews.llvm.org/D18731





More information about the llvm-commits mailing list