[llvm] r323483 - [CodeGen] Ignore private symbols in llvm.used for COFF

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 12:30:11 PST 2018


Thanks, r323688.

From: Rafael Avila de Espindola <rafael.espindola at gmail.com>
Date: Monday, January 29, 2018 at 11:05 AM
To: Shoaib Meenai <smeenai at fb.com>, "llvm-commits at lists.llvm.org" <llvm-commits at lists.llvm.org>
Subject: Re: [llvm] r323483 - [CodeGen] Ignore private symbols in llvm.used for COFF

Shoaib Meenai via llvm-commits <llvm-commits at lists.llvm.org<mailto:llvm-commits at lists.llvm.org>> writes:

Author: smeenai
Date: Thu Jan 25 16:15:25 2018
New Revision: 323483

URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D323483-26view-3Drev&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=43BC3bbidVSrHNCsoMZ0AtXiAUTWiP_HYzw0e2CKYk8&s=hVQ1qXhzycyss-wUn9tLDqKrnaIgUpMYce_Awh3Ip1I&e=
Log:
[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.

Modified:
     llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
     llvm/trunk/test/CodeGen/X86/coff-no-dead-strip.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_AsmPrinter.cpp-3Frev-3D323483-26r1-3D323482-26r2-3D323483-26view-3Ddiff&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=43BC3bbidVSrHNCsoMZ0AtXiAUTWiP_HYzw0e2CKYk8&s=9pyP1hzmLGjKQl6NOI_u88i4JkAlKMmDSfZgyaAjX24&e=
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Thu Jan 25 16:15:25 2018
@@ -1456,10 +1456,10 @@ bool AsmPrinter::doFinalization(Module &
          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;

Than is hasLocalLinkage().

Cheers,
Rafael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/7395010b/attachment.html>


More information about the llvm-commits mailing list