Index: lib/Bitcode/Reader/BitcodeReader.cpp =================================================================== --- lib/Bitcode/Reader/BitcodeReader.cpp +++ lib/Bitcode/Reader/BitcodeReader.cpp @@ -2924,6 +2924,11 @@ NewGV->setDSOLocal(getDecodedDSOLocal(Record[13])); } + if (NewGV->hasLocalLinkage() || + (!NewGV->hasDefaultVisibility() && !NewGV->hasExternalWeakLinkage())) { + NewGV->setDSOLocal(true); + } + return Error::success(); } @@ -3008,6 +3013,12 @@ Func->setDSOLocal(getDecodedDSOLocal(Record[15])); } + if (Func->hasLocalLinkage() || + (!Func->hasDefaultVisibility() && !Func->hasExternalWeakLinkage())) { + // infer dso_local from linkage and visibility if it is not encoded. + Func->setDSOLocal(true); + } + ValueList.push_back(Func); // If this is a function with a body, remember the prototype we are @@ -3083,6 +3094,10 @@ } if (OpNum != Record.size()) NewGA->setDSOLocal(getDecodedDSOLocal(Record[OpNum++])); + + if (NewGA->hasLocalLinkage() || + (!NewGA->hasDefaultVisibility() && !NewGA->hasExternalWeakLinkage())) + NewGA->setDSOLocal(true); ValueList.push_back(NewGA); IndirectSymbolInits.push_back(std::make_pair(NewGA, Val)); return Error::success();