llvm/lib/LTO
Teresa Johnson 611bafa4c4 Perform symbol binding for .symver versioned symbols
Summary:
In a .symver assembler directive like:
.symver name, name2@@nodename
"name2@@nodename" should get the same symbol binding as "name".

While the ELF object writer is updating the symbol binding for .symver
aliases before emitting the object file, not doing so when the module
inline assembly is handled by the RecordStreamer is causing the wrong
behavior in *LTO mode.

E.g. when "name" is global, "name2@@nodename" must also be marked as
global. Otherwise, the symbol is skipped when iterating over the LTO
InputFile symbols (InputFile::Symbol::shouldSkip). So, for example,
when performing any *LTO via the gold-plugin, the versioned symbol
definition is not recorded by the plugin and passed back to the
linker. If the object was in an archive, and there were no other symbols
needed from that object, the object would not be included in the final
link and references to the versioned symbol are undefined.

The llvm-lto2 tests added will give an error about an unused symbol
resolution without the fix.

Reviewers: rafael, pcc

Reviewed By: pcc

Subscribers: mehdi_amini, llvm-commits

Differential Revision: https://reviews.llvm.org/D30485

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297332 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-09 00:19:49 +00:00
..
Caching.cpp LTO: When creating a local cache, create the cache directory if it does not already exist. 2017-03-02 02:02:38 +00:00
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
LLVMBuild.txt [lib/LTO] Add a way to run a custom pipeline 2016-09-07 17:46:16 +00:00
LTO.cpp LTO: Hash the set of imported symbols for each module. 2017-03-03 20:25:30 +00:00
LTOBackend.cpp Perform symbol binding for .symver versioned symbols 2017-03-09 00:19:49 +00:00
LTOCodeGenerator.cpp [LTO] Share the optimization remarks setup between Thin/Full LTO. 2017-02-10 23:49:38 +00:00
LTOModule.cpp fix nullptr Mangler in LTOModule 2017-02-04 01:28:44 +00:00
ThinLTOCodeGenerator.cpp [ThinLTO] Make a copy of buffer identifier in ThinLTOCodeGenerator 2017-02-14 02:20:51 +00:00
UpdateCompilerUsed.cpp [Analysis] Add LibFunc_ prefix to enums in TargetLibraryInfo. (NFC) 2017-01-23 23:16:46 +00:00