mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
[ThinLTO] Auto-hide prevailing linkonce_odr only when all copies eligible
Summary: We hit undefined references building with ThinLTO when one source file contained explicit instantiations of a template method (weak_odr) but there were also implicit instantiations in another file (linkonce_odr), and the latter was the prevailing copy. In this case the symbol was marked hidden when the prevailing linkonce_odr copy was promoted to weak_odr. It led to unsats when the resulting shared library was linked with other code that contained a reference (expecting to be resolved due to the explicit instantiation). Add a CanAutoHide flag to the GV summary to allow the thin link to identify when all copies are eligible for auto-hiding (because they were all originally linkonce_odr global unnamed addr), and only do the auto-hide in that case. Most of the changes here are due to plumbing the new flag through the bitcode and llvm assembly, and resulting test changes. I augmented the existing auto-hide test to check for this situation. Reviewers: pcc Subscribers: mehdi_amini, inglorion, eraman, dexonsmith, arphaman, dang, llvm-commits, steven_wu, wmi Tags: #llvm Differential Revision: https://reviews.llvm.org/D59709 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360466 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -996,6 +996,7 @@ static uint64_t getEncodedGVSummaryFlags(GlobalValueSummary::GVFlags Flags) {
|
||||
RawFlags |= Flags.NotEligibleToImport; // bool
|
||||
RawFlags |= (Flags.Live << 1);
|
||||
RawFlags |= (Flags.DSOLocal << 2);
|
||||
RawFlags |= (Flags.CanAutoHide << 3);
|
||||
|
||||
// Linkage don't need to be remapped at that time for the summary. Any future
|
||||
// change to the getEncodedLinkage() function will need to be taken into
|
||||
|
||||
Reference in New Issue
Block a user