[LTO] Don't internalize declarations
authorBob Haarman <llvm@inglorion.net>
Fri, 27 Jul 2018 05:40:29 +0000 (05:40 +0000)
committerBob Haarman <llvm@inglorion.net>
Fri, 27 Jul 2018 05:40:29 +0000 (05:40 +0000)
commiteae4742d81ef598dc2000312ad2471c4632bcb83
tree77cf6a27563f2b975f9802bf64076e0f08eba0a9
parenta8301fce51cf6f55f53a3b8d1d61230a451a3153
[LTO] Don't internalize declarations

Summary:
Some links were failing with "Global is external, but doesn't have
external or weak linkage!" in ThinLTO builds with debug
information. This happened when we elide the body of a global that is
referenced by debug info. This results in a declaration, which we
would then internalize - but declarations cannot be internal. This
change avoids the problem by not internalizing these declarations.

Fixes PR38046.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, aprantl, hiraditya, JDevlieghere, steven_wu, dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D49777

llvm-svn: 338100
llvm/lib/LTO/LTO.cpp
llvm/test/LTO/X86/pr38046.ll [new file with mode: 0644]