Use the plt entry as the address of some symbols.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 9 Feb 2016 15:11:01 +0000 (15:11 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 9 Feb 2016 15:11:01 +0000 (15:11 +0000)
commita0a65f973a9369ed162ca1837497c413758b183c
tree94232e796ac5e5b648736ae058a5bc10a0ba77b5
parentad3293744a40a1a84b171abd92b20e119f28c493
Use the plt entry as the address of some symbols.

This is the function equivalent of a copy relocation.

Since functions are expected to change sizes, we cannot use copy
relocations. In situations where one would be needed, what is done
instead is:
* Create a plt entry
* Output an undefined symbol whose addr is the plt entry.

The dynamic linker makes sure any shared library uses the plt entry as
the function address.

llvm-svn: 260224
lld/ELF/OutputSections.cpp
lld/ELF/Symbols.cpp
lld/ELF/Symbols.h
lld/ELF/Target.cpp
lld/ELF/Target.h
lld/ELF/Writer.cpp
lld/test/ELF/Inputs/undef-with-plt-addr.s [new file with mode: 0644]
lld/test/ELF/symbol-override.s
lld/test/ELF/undef-with-plt-addr.s [new file with mode: 0644]