[ThinLTO] Ensure prevailing linkonce emitted as weak in ThinLTO backends
authorTeresa Johnson <tejohnson@google.com>
Fri, 4 Mar 2016 17:48:35 +0000 (17:48 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 4 Mar 2016 17:48:35 +0000 (17:48 +0000)
commita17f2cd1a3d6deb1286188c725dad426d619b109
treed924917500cbd15854df90de0d9e9efe2aff5440
parent51155fc0d1b4580ba800b05192f7827b45670648
[ThinLTO] Ensure prevailing linkonce emitted as weak in ThinLTO backends

Summary:
Since IR files are all compiled into separate independent object files
in ThinLTO mode, the prevailing linkonce symbols must be emitted in its
object file even if it is no longer referenced there, e.g. if no
references remain in the module after inlining, since it may be
referenced by another ThinLTO compiled object file. This is done by
changing LDPR_PREVAILING_DEF_IRONLY* symbols to LDPR_PREVAILING_DEF,
which converts the prevailing linkonce to weak. We also don't need the
other prevailing IRONLY handling for internalization, which is not
currently performed for ThinLTO.

Test case included.

Reviewers: davidxl, rafael

Subscribers: rafael, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16173

llvm-svn: 262727
llvm/test/tools/gold/X86/Inputs/thinlto_linkonceresolution.ll [new file with mode: 0644]
llvm/test/tools/gold/X86/thinlto_linkonceresolution.ll [new file with mode: 0644]
llvm/tools/gold/gold-plugin.cpp