OSDN Git Service

If the global variable is removed by the linker, then don't constant merge it
authorBill Wendling <isanbard@gmail.com>
Wed, 11 Jan 2012 00:13:08 +0000 (00:13 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 11 Jan 2012 00:13:08 +0000 (00:13 +0000)
commit37b94c6b4e605c522164bcafc58ea1e1afb50cc0
tree70979afa0d13ea1f8c04a6dfea8a4b40e2cd2e67
parentdcc296d420d064e4cedfc80abc8df6bfb0b35b03
If the global variable is removed by the linker, then don't constant merge it
with other symbols.

An object in the __cfstring section is suppoed to be filled with CFString
objects, which have a pointer to ___CFConstantStringClassReference followed by a
pointer to a __cstring. If we allow the object in the __cstring section to be
merged with another global, then it could end up in any section. Because the
linker is going to remove these symbols in the final executable, we shouldn't
bother to merge them.
<rdar://problem/10564621>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147899 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/GlobalValue.h
lib/Transforms/IPO/ConstantMerge.cpp
test/Transforms/ConstantMerge/linker-private.ll [new file with mode: 0644]