[PATCH] D34221: [ELF] - Resolve references properly when using .symver directive (2)

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 14:28:45 PDT 2017


grimar created this revision.
Herald added a subscriber: emaste.

This is variation of https://reviews.llvm.org/D33680.

Previously LLD was unable to link following:
(failed with undefined symbol bar)

Version script:

  SOME_VERSION { global: *; };
  
  .global _start
  .global bar
  .symver _start, bar@@SOME_VERSION
  _start:
    jmp bar

Manual has next description:

.symver name, name2@@nodename
In this case, the symbol name must exist and be defined within the file being assembled. It is similar to name2 at nodename. 
The difference is name2@@nodename will also be used to resolve references to name2 by the linker
https://sourceware.org/binutils/docs/as/Symver.html

Patch implements that. If we have name@@ver symbol and name is undefined, name@@ver is used to resolve references to name.
If name is defined then multiple definition error is emited, that is consistent with what bfd do.


https://reviews.llvm.org/D34221

Files:
  ELF/SymbolTable.cpp
  ELF/Symbols.cpp
  ELF/Symbols.h
  test/ELF/version-script-symver-err.s
  test/ELF/version-script-symver.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34221.102606.patch
Type: text/x-patch
Size: 4000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170614/07da5dd8/attachment.bin>


More information about the llvm-commits mailing list