[PATCH] D30485: Mark .symver versioned symbol as global

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 21:43:28 PST 2017


tejohnson added inline comments.


================
Comment at: lib/MC/MCParser/ELFAsmParser.cpp:748
+  // for the linker.
+  getStreamer().EmitSymbolAttribute(Alias, MCSA_Global);
   return false;
----------------
pcc wrote:
> I don't think this is right. See `ELFObjectWriter::executePostLayoutBinding`: `.symver` symbols inherit their binding from the symbol they alias.
> 
> I think we may need something equivalent to the `executePostLayoutBinding` logic in `ModuleSymbolTable::CollectAsmSymbols`.
Thanks for pointing me to that, I was having trouble finding good documentation on the .symver directive, but I see that if I make the aliased symbol local that gas makes the versioned symbol also local.

However, I'm not sure I agree that the handling in executePostLayoutBinding, which deals with .symver specifically, should be added to CollectAsmSymbols, which is doing more general handling of the symbols returned from the streamer. It seems like we should do this in the .symver handling here within the ELFAsmParser, and instead set the appropriate symbol attribute based on the symbol binding of the aliased Sym (instead of unconditionally setting to global as I have done here). 



https://reviews.llvm.org/D30485





More information about the llvm-commits mailing list