1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

Remove the linker_private and linker_private_weak linkages.

These linkages were introduced some time ago, but it was never very
clear what exactly their semantics were or what they should be used
for. Some investigation found these uses:

* utf-16 strings in clang.
* non-unnamed_addr strings produced by the sanitizers.

It turns out they were just working around a more fundamental problem.
For some sections a MachO linker needs a symbol in order to split the
section into atoms, and llvm had no idea that was the case. I fixed
that in r201700 and it is now safe to use the private linkage. When
the object ends up in a section that requires symbols, llvm will use a
'l' prefix instead of a 'L' prefix and things just work.

With that, these linkages were already dead, but there was a potential
future user in the objc metadata information. I am still looking at
CGObjcMac.cpp, but at this point I am convinced that linker_private
and linker_private_weak are not what they need.

The objc uses are currently split in

* Regular symbols (no '\01' prefix). LLVM already directly provides
whatever semantics they need.
* Uses of a private name (start with "\01L" or "\01l") and private
linkage. We can drop the "\01L" and "\01l" prefixes as soon as llvm
agrees with clang on L being ok or not for a given section. I have two
patches in code review for this.
* Uses of private name and weak linkage.

The last case is the one that one could think would fit one of these
linkages. That is not the case. The semantics are

* the linker will merge these symbol by *name*.
* the linker will hide them in the final DSO.

Given that the merging is done by name, any of the private (or
internal) linkages would be a bad match. They allow llvm to rename the
symbols, and that is really not what we want. From the llvm point of
view, these objects should really be (linkonce|weak)(_odr)?.

For now, just keeping the "\01l" prefix is probably the best for these
symbols. If we one day want to have a more direct support in llvm,
IMHO what we should add is not a linkage, it is just a hidden_symbol
attribute. It would be applicable to multiple linkages. For example,
on weak it would produce the current behavior we have for objc
metadata. On internal, it would be equivalent to private (and we
should then remove private).

llvm-svn: 203866
This commit is contained in:
Rafael Espindola 2014-03-13 23:18:37 +00:00
parent e541764c5f
commit d15cd32b9f
31 changed files with 38 additions and 168 deletions

View File

@ -688,7 +688,8 @@ global variable. The operand fields are:
* ``weak_odr``: code 10
* ``linkonce_odr``: code 11
* ``available_externally``: code 12
* ``linker_private``: code 13
* deprecated : code 13
* deprecated : code 14
* alignment*: The logarithm base 2 of the variable's requested alignment, plus 1

View File

@ -197,16 +197,6 @@ linkage:
private to be renamed as necessary to avoid collisions. Because the
symbol is private to the module, all references can be updated. This
doesn't show up in any symbol table in the object file.
``linker_private``
Similar to ``private``, but the symbol is passed through the
assembler and evaluated by the linker. Unlike normal strong symbols,
they are removed by the linker from the final linked image
(executable or dynamic library).
``linker_private_weak``
Similar to "``linker_private``", but the symbol is weak. Note that
``linker_private_weak`` symbols are subject to coalescing by the
linker. The symbols are removed by the linker from the final linked
image (executable or dynamic library).
``internal``
Similar to private, but the value shows as a local symbol
(``STB_LOCAL`` in the case of ELF) in the object file. This
@ -681,8 +671,7 @@ Syntax::
@<Name> = [Visibility] [DLLStorageClass] alias [Linkage] <AliaseeTy> @<Aliasee>
The linkage must be one of ``private``, ``linker_private``,
``linker_private_weak``, ``internal``, ``linkonce``, ``weak``,
The linkage must be one of ``private``, ``internal``, ``linkonce``, ``weak``,
``linkonce_odr``, ``weak_odr``, ``external``. Note that some system linkers
might not correctly handle dropping a weak symbol that is aliased by a non-weak
alias.

View File

@ -40,8 +40,6 @@ public:
AppendingLinkage, ///< Special purpose, only applies to global arrays
InternalLinkage, ///< Rename collisions when linking (static functions).
PrivateLinkage, ///< Like Internal, but omit from symbol table.
LinkerPrivateLinkage, ///< Like Private, but linker removes.
LinkerPrivateWeakLinkage, ///< Like LinkerPrivate, but weak.
ExternalWeakLinkage,///< ExternalWeak linkage description.
CommonLinkage ///< Tentative definitions.
};
@ -158,15 +156,8 @@ public:
static bool isPrivateLinkage(LinkageTypes Linkage) {
return Linkage == PrivateLinkage;
}
static bool isLinkerPrivateLinkage(LinkageTypes Linkage) {
return Linkage == LinkerPrivateLinkage;
}
static bool isLinkerPrivateWeakLinkage(LinkageTypes Linkage) {
return Linkage == LinkerPrivateWeakLinkage;
}
static bool isLocalLinkage(LinkageTypes Linkage) {
return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage) ||
isLinkerPrivateLinkage(Linkage) || isLinkerPrivateWeakLinkage(Linkage);
return isInternalLinkage(Linkage) || isPrivateLinkage(Linkage);
}
static bool isExternalWeakLinkage(LinkageTypes Linkage) {
return Linkage == ExternalWeakLinkage;
@ -185,11 +176,8 @@ public:
/// by something non-equivalent at link time. For example, if a function has
/// weak linkage then the code defining it may be replaced by different code.
static bool mayBeOverridden(LinkageTypes Linkage) {
return Linkage == WeakAnyLinkage ||
Linkage == LinkOnceAnyLinkage ||
Linkage == CommonLinkage ||
Linkage == ExternalWeakLinkage ||
Linkage == LinkerPrivateWeakLinkage;
return Linkage == WeakAnyLinkage || Linkage == LinkOnceAnyLinkage ||
Linkage == CommonLinkage || Linkage == ExternalWeakLinkage;
}
/// isWeakForLinker - Whether the definition of this global may be replaced at
@ -197,14 +185,10 @@ public:
/// always a mistake: when working at the IR level use mayBeOverridden instead
/// as it knows about ODR semantics.
static bool isWeakForLinker(LinkageTypes Linkage) {
return Linkage == AvailableExternallyLinkage ||
Linkage == WeakAnyLinkage ||
Linkage == WeakODRLinkage ||
Linkage == LinkOnceAnyLinkage ||
Linkage == LinkOnceODRLinkage ||
Linkage == CommonLinkage ||
Linkage == ExternalWeakLinkage ||
Linkage == LinkerPrivateWeakLinkage;
return Linkage == AvailableExternallyLinkage || Linkage == WeakAnyLinkage ||
Linkage == WeakODRLinkage || Linkage == LinkOnceAnyLinkage ||
Linkage == LinkOnceODRLinkage || Linkage == CommonLinkage ||
Linkage == ExternalWeakLinkage;
}
bool hasExternalLinkage() const { return isExternalLinkage(Linkage); }
@ -220,10 +204,6 @@ public:
bool hasAppendingLinkage() const { return isAppendingLinkage(Linkage); }
bool hasInternalLinkage() const { return isInternalLinkage(Linkage); }
bool hasPrivateLinkage() const { return isPrivateLinkage(Linkage); }
bool hasLinkerPrivateLinkage() const { return isLinkerPrivateLinkage(Linkage); }
bool hasLinkerPrivateWeakLinkage() const {
return isLinkerPrivateWeakLinkage(Linkage);
}
bool hasLocalLinkage() const { return isLocalLinkage(Linkage); }
bool hasExternalWeakLinkage() const { return isExternalWeakLinkage(Linkage); }
bool hasCommonLinkage() const { return isCommonLinkage(Linkage); }

View File

@ -480,8 +480,6 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(global); KEYWORD(constant);
KEYWORD(private);
KEYWORD(linker_private);
KEYWORD(linker_private_weak);
KEYWORD(internal);
KEYWORD(available_externally);
KEYWORD(linkonce);

View File

@ -246,8 +246,6 @@ bool LLParser::ParseTopLevelEntities() {
// OptionalThreadLocal OptionalAddrSpace OptionalUnNammedAddr
// ('constant'|'global') ...
case lltok::kw_private: // OptionalLinkage
case lltok::kw_linker_private: // OptionalLinkage
case lltok::kw_linker_private_weak: // OptionalLinkage
case lltok::kw_internal: // OptionalLinkage
case lltok::kw_weak: // OptionalLinkage
case lltok::kw_weak_odr: // OptionalLinkage
@ -1278,8 +1276,6 @@ bool LLParser::ParseOptionalReturnAttrs(AttrBuilder &B) {
/// ParseOptionalLinkage
/// ::= /*empty*/
/// ::= 'private'
/// ::= 'linker_private'
/// ::= 'linker_private_weak'
/// ::= 'internal'
/// ::= 'weak'
/// ::= 'weak_odr'
@ -1295,10 +1291,6 @@ bool LLParser::ParseOptionalLinkage(unsigned &Res, bool &HasLinkage) {
switch (Lex.getKind()) {
default: Res=GlobalValue::ExternalLinkage; return false;
case lltok::kw_private: Res = GlobalValue::PrivateLinkage; break;
case lltok::kw_linker_private: Res = GlobalValue::LinkerPrivateLinkage; break;
case lltok::kw_linker_private_weak:
Res = GlobalValue::LinkerPrivateWeakLinkage;
break;
case lltok::kw_internal: Res = GlobalValue::InternalLinkage; break;
case lltok::kw_weak: Res = GlobalValue::WeakAnyLinkage; break;
case lltok::kw_weak_odr: Res = GlobalValue::WeakODRLinkage; break;
@ -2992,8 +2984,6 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
return Error(LinkageLoc, "invalid linkage for function definition");
break;
case GlobalValue::PrivateLinkage:
case GlobalValue::LinkerPrivateLinkage:
case GlobalValue::LinkerPrivateWeakLinkage:
case GlobalValue::InternalLinkage:
case GlobalValue::AvailableExternallyLinkage:
case GlobalValue::LinkOnceAnyLinkage:

View File

@ -37,7 +37,7 @@ namespace lltok {
kw_declare, kw_define,
kw_global, kw_constant,
kw_private, kw_linker_private, kw_linker_private_weak,
kw_private,
kw_internal,
kw_linkonce, kw_linkonce_odr,
kw_weak, kw_weak_odr, kw_appending,

View File

@ -88,8 +88,10 @@ static GlobalValue::LinkageTypes GetDecodedLinkage(unsigned Val) {
case 10: return GlobalValue::WeakODRLinkage;
case 11: return GlobalValue::LinkOnceODRLinkage;
case 12: return GlobalValue::AvailableExternallyLinkage;
case 13: return GlobalValue::LinkerPrivateLinkage;
case 14: return GlobalValue::LinkerPrivateWeakLinkage;
case 13:
return GlobalValue::PrivateLinkage; // Obsolete LinkerPrivateLinkage
case 14:
return GlobalValue::PrivateLinkage; // Obsolete LinkerPrivateWeakLinkage
}
}

View File

@ -487,8 +487,6 @@ static unsigned getEncodedLinkage(const GlobalValue *GV) {
case GlobalValue::WeakODRLinkage: return 10;
case GlobalValue::LinkOnceODRLinkage: return 11;
case GlobalValue::AvailableExternallyLinkage: return 12;
case GlobalValue::LinkerPrivateLinkage: return 13;
case GlobalValue::LinkerPrivateWeakLinkage: return 14;
}
llvm_unreachable("Invalid linkage");
}

View File

@ -272,7 +272,6 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
case GlobalValue::LinkOnceODRLinkage:
case GlobalValue::WeakAnyLinkage:
case GlobalValue::WeakODRLinkage:
case GlobalValue::LinkerPrivateWeakLinkage:
if (MAI->hasWeakDefDirective()) {
// .globl _foo
OutStreamer.EmitSymbolAttribute(GVSym, MCSA_Global);
@ -301,7 +300,6 @@ void AsmPrinter::EmitLinkage(const GlobalValue *GV, MCSymbol *GVSym) const {
return;
case GlobalValue::PrivateLinkage:
case GlobalValue::InternalLinkage:
case GlobalValue::LinkerPrivateLinkage:
return;
case GlobalValue::AvailableExternallyLinkage:
llvm_unreachable("Should never emit this");

View File

@ -1391,10 +1391,6 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT,
switch (LT) {
case GlobalValue::ExternalLinkage: break;
case GlobalValue::PrivateLinkage: Out << "private "; break;
case GlobalValue::LinkerPrivateLinkage: Out << "linker_private "; break;
case GlobalValue::LinkerPrivateWeakLinkage:
Out << "linker_private_weak ";
break;
case GlobalValue::InternalLinkage: Out << "internal "; break;
case GlobalValue::LinkOnceAnyLinkage: Out << "linkonce "; break;
case GlobalValue::LinkOnceODRLinkage: Out << "linkonce_odr "; break;

View File

@ -1159,10 +1159,6 @@ LLVMLinkage LLVMGetLinkage(LLVMValueRef Global) {
return LLVMInternalLinkage;
case GlobalValue::PrivateLinkage:
return LLVMPrivateLinkage;
case GlobalValue::LinkerPrivateLinkage:
return LLVMLinkerPrivateLinkage;
case GlobalValue::LinkerPrivateWeakLinkage:
return LLVMLinkerPrivateWeakLinkage;
case GlobalValue::ExternalWeakLinkage:
return LLVMExternalWeakLinkage;
case GlobalValue::CommonLinkage:
@ -1208,10 +1204,10 @@ void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage) {
GV->setLinkage(GlobalValue::PrivateLinkage);
break;
case LLVMLinkerPrivateLinkage:
GV->setLinkage(GlobalValue::LinkerPrivateLinkage);
GV->setLinkage(GlobalValue::PrivateLinkage);
break;
case LLVMLinkerPrivateWeakLinkage:
GV->setLinkage(GlobalValue::LinkerPrivateWeakLinkage);
GV->setLinkage(GlobalValue::PrivateLinkage);
break;
case LLVMDLLImportLinkage:
DEBUG(errs()

View File

@ -84,9 +84,6 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
PrefixTy = Mangler::LinkerPrivate;
else
PrefixTy = Mangler::Private;
} else if (GV->hasLinkerPrivateLinkage() ||
GV->hasLinkerPrivateWeakLinkage()) {
PrefixTy = Mangler::LinkerPrivate;
}
if (!GV->hasName()) {

View File

@ -408,8 +408,7 @@ void LTOModule::addDefinedSymbol(const GlobalValue *def, bool isFunction) {
}
// set definition part
if (def->hasWeakLinkage() || def->hasLinkOnceLinkage() ||
def->hasLinkerPrivateWeakLinkage())
if (def->hasWeakLinkage() || def->hasLinkOnceLinkage())
attr |= LTO_SYMBOL_DEFINITION_WEAK;
else if (def->hasCommonLinkage())
attr |= LTO_SYMBOL_DEFINITION_TENTATIVE;
@ -424,8 +423,7 @@ void LTOModule::addDefinedSymbol(const GlobalValue *def, bool isFunction) {
else if (canBeHidden(def))
attr |= LTO_SYMBOL_SCOPE_DEFAULT_CAN_BE_HIDDEN;
else if (def->hasExternalLinkage() || def->hasWeakLinkage() ||
def->hasLinkOnceLinkage() || def->hasCommonLinkage() ||
def->hasLinkerPrivateWeakLinkage())
def->hasLinkOnceLinkage() || def->hasCommonLinkage())
attr |= LTO_SYMBOL_SCOPE_DEFAULT;
else
attr |= LTO_SYMBOL_SCOPE_INTERNAL;

View File

@ -110,8 +110,7 @@ uint32_t IRObjectFile::getSymbolFlags(DataRefImpl Symb) const {
uint32_t Res = BasicSymbolRef::SF_None;
if (GV.isDeclaration() || GV.hasAvailableExternallyLinkage())
Res |= BasicSymbolRef::SF_Undefined;
if (GV.hasPrivateLinkage() || GV.hasLinkerPrivateLinkage() ||
GV.hasLinkerPrivateWeakLinkage())
if (GV.hasPrivateLinkage())
Res |= BasicSymbolRef::SF_FormatSpecific;
if (!GV.hasLocalLinkage())
Res |= BasicSymbolRef::SF_Global;

View File

@ -283,10 +283,6 @@ void CppWriter::printLinkageType(GlobalValue::LinkageTypes LT) {
Out << "GlobalValue::InternalLinkage"; break;
case GlobalValue::PrivateLinkage:
Out << "GlobalValue::PrivateLinkage"; break;
case GlobalValue::LinkerPrivateLinkage:
Out << "GlobalValue::LinkerPrivateLinkage"; break;
case GlobalValue::LinkerPrivateWeakLinkage:
Out << "GlobalValue::LinkerPrivateWeakLinkage"; break;
case GlobalValue::AvailableExternallyLinkage:
Out << "GlobalValue::AvailableExternallyLinkage "; break;
case GlobalValue::LinkOnceAnyLinkage:

View File

@ -17,10 +17,10 @@
; CHECK: @private.var = private constant i32 0
@linker_private.var = linker_private constant i32 0
; CHECK: @linker_private.var = linker_private constant i32 0
; CHECK: @linker_private.var = private constant i32 0
@linker_private_weak.var = linker_private_weak constant i32 0
; CHECK: @linker_private_weak.var = linker_private_weak constant i32 0
; CHECK: @linker_private_weak.var = private constant i32 0
@linker_private_weak_def_auto.var = linker_private_weak_def_auto constant i32 0
; CHECK: @linker_private_weak_def_auto.var = constant i32 0
@ -59,13 +59,13 @@ define private void @private()
}
define linker_private void @linker_private()
; CHECK: define linker_private void @linker_private
; CHECK: define private void @linker_private
{
ret void;
}
define linker_private_weak void @linker_private_weak()
; CHECK: define linker_private_weak void @linker_private_weak
; CHECK: define private void @linker_private_weak
{
ret void;
}

View File

@ -1,8 +0,0 @@
; RUN: llc < %s -march=arm -mtriple=arm-apple-darwin | FileCheck %s
; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm'
@"\01l_objc_msgSend_fixup_alloc" = linker_private_weak hidden global i32 0, section "__DATA, __objc_msgrefs, coalesced", align 16
; CHECK: .globl l_objc_msgSend_fixup_alloc
; CHECK: .weak_definition l_objc_msgSend_fixup_alloc

View File

@ -3,9 +3,9 @@ target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-
target triple = "thumbv7-apple-darwin10.0.0"
; CHECK: align 3
@.v = linker_private unnamed_addr constant <4 x i32> <i32 1, i32 2, i32 3, i32 4>, align 8
@.v = private unnamed_addr constant <4 x i32> <i32 1, i32 2, i32 3, i32 4>, align 8
; CHECK: align 2
@.strA = linker_private unnamed_addr constant [4 x i8] c"bar\00"
@.strA = private unnamed_addr constant [4 x i8] c"bar\00"
; CHECK-NOT: align
@.strB = linker_private unnamed_addr constant [4 x i8] c"foo\00", align 1
@.strC = linker_private unnamed_addr constant [4 x i8] c"baz\00", section "__TEXT,__cstring,cstring_literals", align 1
@.strB = private unnamed_addr constant [4 x i8] c"foo\00", align 1
@.strC = private unnamed_addr constant [4 x i8] c"baz\00", section "__TEXT,__cstring,cstring_literals", align 1

View File

@ -4,7 +4,7 @@
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
target triple = "nvptx64-nvidia-cuda"
define linker_private ptx_device { double, double } @__utils1_MOD_trace(%"struct.array2_complex(kind=8).43.5.57"* noalias %m) {
define private ptx_device { double, double } @__utils1_MOD_trace(%"struct.array2_complex(kind=8).43.5.57"* noalias %m) {
entry:
;unreachable
%t0 = insertvalue {double, double} undef, double 1.0, 0

View File

@ -1,8 +0,0 @@
; RUN: llc < %s -march=ppc32 -mtriple=powerpc-apple-darwin | FileCheck %s
; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm'
@"\01l_objc_msgSend_fixup_alloc" = linker_private_weak hidden global i32 0, section "__DATA, __objc_msgrefs, coalesced", align 16
; CHECK: .globl l_objc_msgSend_fixup_alloc
; CHECK: .weak_definition l_objc_msgSend_fixup_alloc

View File

@ -11,8 +11,8 @@
@_ZTIi = external constant %struct.__fundamental_type_info_pseudo
@_ZTIf = external constant %struct.__fundamental_type_info_pseudo
@.cst = linker_private unnamed_addr constant [12 x i8] c"catched int\00", align 64
@.cst1 = linker_private unnamed_addr constant [14 x i8] c"catched float\00", align 64
@.cst = private unnamed_addr constant [12 x i8] c"catched int\00", align 64
@.cst1 = private unnamed_addr constant [14 x i8] c"catched float\00", align 64
; V8ABS-LABEL: main:
; V8ABS: .cfi_startproc

View File

@ -7,7 +7,7 @@
%struct.__jmp_buf_tag = type { [3 x i32], i32, %0 }
@jenv = common unnamed_addr global %struct.jmpbuf_env* null
@.cst = linker_private unnamed_addr constant [30 x i8] c"in bar with jmp_buf's id: %d\0A\00", align 64
@.cst = private unnamed_addr constant [30 x i8] c"in bar with jmp_buf's id: %d\0A\00", align 64
; CHECK-LABEL: foo
; CHECK-DAG: st {{.+}}, [%i0]

View File

@ -1,8 +0,0 @@
; RUN: llc < %s -march=x86 -mtriple=i686-apple-darwin | FileCheck %s
; ModuleID = '/Volumes/MacOS9/tests/WebKit/JavaScriptCore/profiler/ProfilerServer.mm'
@"\01l_objc_msgSend_fixup_alloc" = linker_private_weak hidden global i32 0, section "__DATA, __objc_msgrefs, coalesced", align 16
; CHECK: .globl l_objc_msgSend_fixup_alloc
; CHECK: .weak_definition l_objc_msgSend_fixup_alloc

View File

@ -7,7 +7,7 @@
; Make sure that the string ends up the correct section.
; CHECK: .section __TEXT,__cstring
; CHECK-NEXT: l_.str3:
; CHECK-NEXT: L_.str3:
; CHECK: .section __DATA,__cfstring
; CHECK-NEXT: .align 4
@ -15,13 +15,13 @@
; CHECK-NEXT: .quad ___CFConstantStringClassReference
; CHECK-NEXT: .long 1992
; CHECK-NEXT: .space 4
; CHECK-NEXT: .quad l_.str3
; CHECK-NEXT: .quad L_.str3
; CHECK-NEXT: .long 0
; CHECK-NEXT: .space 4
@isLogVisible = global i8 0, align 1
@__CFConstantStringClassReference = external global [0 x i32]
@.str3 = linker_private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@.str3 = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@_unnamed_cfstring_4 = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([1 x i8]* @.str3, i32 0, i32 0), i32 0 }, section "__DATA,__cfstring"
@null.array = weak_odr constant [1 x i8] zeroinitializer, align 1

View File

@ -1,10 +0,0 @@
; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck --check-prefix=ELF %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck --check-prefix=MACHO %s
@foo = linker_private global i32 42
;ELF: {{^}}.Lfoo:
;MACHO: {{^}}l_foo:
define i32* @f() {
ret i32* @foo
}

View File

@ -1,6 +0,0 @@
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
@foo = linker_private hidden global i32 0
@bar = linker_private_weak hidden global i32 0

View File

@ -1,23 +0,0 @@
; RUN: opt < %s -constmerge -S | FileCheck %s
; <rdar://problem/10564621>
%0 = type opaque
%struct.NSConstantString = type { i32*, i32, i8*, i32 }
; CHECK: @.str3 = linker_private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@isLogVisible = global i8 0, align 1
@__CFConstantStringClassReference = external global [0 x i32]
@.str3 = linker_private unnamed_addr constant [1 x i8] zeroinitializer, align 1
@_unnamed_cfstring_4 = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([1 x i8]* @.str3, i32 0, i32 0), i32 0 }, section "__DATA,__cfstring"
@null.array = weak_odr constant [1 x i8] zeroinitializer, align 1
define linkonce_odr void @bar() nounwind ssp align 2 {
entry:
%stack = alloca i8*, align 4
%call = call %0* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to %0* (i8*, i8*, %0*)*)(i8* null, i8* null, %0* bitcast (%struct.NSConstantString* @_unnamed_cfstring_4 to %0*))
store i8* getelementptr inbounds ([1 x i8]* @null.array, i32 0, i32 0), i8** %stack, align 4
ret void
}
declare i8* @objc_msgSend(i8*, i8*, ...) nonlazybind

View File

@ -24,11 +24,11 @@ target triple = "x86_64-apple-macosx10.9.0"
@"\01L_OBJC_METH_VAR_NAME_" = internal global [4 x i8] c"new\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@"\01L_OBJC_SELECTOR_REFERENCES_" = internal global i8* getelementptr inbounds ([4 x i8]* @"\01L_OBJC_METH_VAR_NAME_", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"
@__CFConstantStringClassReference = external global [0 x i32]
@.str = linker_private unnamed_addr constant [11 x i8] c"Failed: %@\00", align 1
@.str = private unnamed_addr constant [11 x i8] c"Failed: %@\00", align 1
@_unnamed_cfstring_ = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([11 x i8]* @.str, i32 0, i32 0), i64 10 }, section "__DATA,__cfstring"
@"OBJC_CLASS_$_NSException" = external global %struct._class_t
@"\01L_OBJC_CLASSLIST_REFERENCES_$_1" = internal global %struct._class_t* @"OBJC_CLASS_$_NSException", section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8
@.str2 = linker_private unnamed_addr constant [4 x i8] c"Foo\00", align 1
@.str2 = private unnamed_addr constant [4 x i8] c"Foo\00", align 1
@_unnamed_cfstring_3 = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([4 x i8]* @.str2, i32 0, i32 0), i64 3 }, section "__DATA,__cfstring"
@"\01L_OBJC_METH_VAR_NAME_4" = internal global [14 x i8] c"raise:format:\00", section "__TEXT,__objc_methname,cstring_literals", align 1
@"\01L_OBJC_SELECTOR_REFERENCES_5" = internal global i8* getelementptr inbounds ([14 x i8]* @"\01L_OBJC_METH_VAR_NAME_4", i64 0, i64 0), section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"

View File

@ -39,8 +39,6 @@
</list>
<list name="linkage-types">
<item> private </item>
<item> linker_private </item>
<item> linker_private_weak </item>
<item> internal </item>
<item> available_externally </item>
<item> linkonce </item>

View File

@ -92,8 +92,6 @@ GVInternalLinkage
| dllexport
| common
| private
| "linker_private"
| "linker_private_weak"
;
GVExternalLinkage

View File

@ -43,8 +43,7 @@ syn keyword llvmKeyword blockaddress byval c catch cc ccc cleanup coldcc common
syn keyword llvmKeyword constant datalayout declare default define deplibs
syn keyword llvmKeyword dllexport dllimport except extern_weak external fastcc
syn keyword llvmKeyword filter gc global hidden initialexec inlinehint inreg
syn keyword llvmKeyword intel_ocl_bicc inteldialect internal linker_private
syn keyword llvmKeyword linker_private_weak
syn keyword llvmKeyword intel_ocl_bicc inteldialect internal
syn keyword llvmKeyword linkonce linkonce_odr
syn keyword llvmKeyword localdynamic localexec minsize module monotonic
syn keyword llvmKeyword msp430_intrcc naked nest noalias nocapture