summaryrefslogtreecommitdiffstats
path: root/tools/gold
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-08-18 01:08:50 +0000
committerTeresa Johnson <tejohnson@google.com>2016-08-18 01:08:50 +0000
commitb798b8ca89e4eec6e9aaeef727d4390e67062c45 (patch)
tree5a4d3df3caf976fc75745b69271fefd3b4b059cb /tools/gold
parentb1cfb8c59e467c5333c0f5c67dd8ef1152bf3e4e (diff)
[ThinLTO] Keep common symbols in ThinLTO modules
Summary: Skip the merging of common symbols for ThinLTO modules, they will be merged by the final native object link. Trying to merge the symbols and add to a combined module will incorrectly enable the common symbol to be internalized in the ThinLTO module. Additionally, we will not want to create a combined module for ThinLTO distributed builds. This fixes failures in 7 cpu2006 benchmarks from the new LTO API in ThinLTO mode. Reviewers: mehdi_amini Subscribers: pcc, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D23637 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@279023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r--tools/gold/gold-plugin.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index 144a8eb90da6..9ca28266d6ed 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -572,6 +572,8 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View) {
toString(ObjOrErr.takeError()).c_str());
InputFile &Obj = **ObjOrErr;
+ bool HasThinLTOSummary =
+ hasGlobalValueSummary(Obj.getMemoryBufferRef(), diagnosticHandler);
unsigned SymNum = 0;
std::vector<SymbolResolution> Resols(F.syms.size());
@@ -617,7 +619,8 @@ static void addModule(LTO &Lto, claimed_file &F, const void *View) {
(IsExecutable || !Res.DefaultVisibility))
R.FinalDefinitionInLinkageUnit = true;
- if (ObjSym.getFlags() & object::BasicSymbolRef::SF_Common) {
+ if ((ObjSym.getFlags() & object::BasicSymbolRef::SF_Common) &&
+ !HasThinLTOSummary) {
// We ignore gold's resolution for common symbols. A common symbol with
// the correct size and alignment is added to the module by the pre-opt
// module hook if any common symbol prevailed.