[CodeGen] Ignore private symbols in llvm.used for COFF
Similar to the existing handling for internal symbols, private symbols
are also not visible to the linker and should be ignored.
llvm-svn: 323483
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 87d9137..92429ac 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1456,10 +1456,10 @@
for (const Value *Op : A->operands()) {
const auto *GV =
cast<GlobalValue>(Op->stripPointerCastsNoFollowAliases());
- // Global symbols with internal linkage are not visible to the linker,
- // and thus would cause an error when the linker tried to preserve the
- // symbol due to the `/include:` directive.
- if (GV->hasInternalLinkage())
+ // Global symbols with internal or private linkage are not visible to
+ // the linker, and thus would cause an error when the linker tried to
+ // preserve the symbol due to the `/include:` directive.
+ if (GV->hasInternalLinkage() || GV->hasPrivateLinkage())
continue;
raw_string_ostream OS(Flags);