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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 11:04:56 PST 2018


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

> Author: smeenai
> Date: Thu Jan 25 16:15:25 2018
> New Revision: 323483
>
> URL: http://llvm.org/viewvc/llvm-project?rev=323483&view=rev
> 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: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=323483&r1=323482&r2=323483&view=diff
> ==============================================================================
> --- 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


More information about the llvm-commits mailing list