Skip to content

Instantly share code, notes, and snippets.

@int3
Created March 15, 2022 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int3/b66de20462da71e8757e09bacfc361ca to your computer and use it in GitHub Desktop.
Save int3/b66de20462da71e8757e09bacfc361ca to your computer and use it in GitHub Desktop.
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 426f7efd5b7f..d3137c573c3e 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -348,8 +348,9 @@ static void thinLTOResolvePrevailingGUID(
// aspects into separate routines.
if (isPrevailing(VI.getGUID(), S.get())) {
if (GlobalValue::isLinkOnceLinkage(OriginalLinkage)) {
- S->setLinkage(GlobalValue::getWeakLinkage(
- GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)));
+ if (VI.getSummaryList().size() > 1)
+ S->setLinkage(GlobalValue::getWeakLinkage(
+ GlobalValue::isLinkOnceODRLinkage(OriginalLinkage)));
// The kept copy is eligible for auto-hiding (hidden visibility) if all
// copies were (i.e. they were all linkonce_odr global unnamed addr).
// If any copy is not (e.g. it was originally weak_odr), then the symbol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment