From: Rafael Espindola Date: Tue, 21 Jan 2014 01:50:12 +0000 (+0000) Subject: Now that r199688 avoids the real issue, use private linkage for objc strings. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f68203224c237e3ca84553fc5dad52305cc3e048;p=clang Now that r199688 avoids the real issue, use private linkage for objc strings. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199705 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 12edab7cd6..7f77df00f2 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -2383,11 +2383,8 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { // FIXME: why do utf strings get "_" labels instead of "L" labels? Linkage = llvm::GlobalValue::InternalLinkage; else - // FIXME: With OS X ld 123.2 (xcode 4) and LTO we would get a linker error - // when using private linkage. It is not clear if this is a bug in ld - // or a reasonable new restriction. - Linkage = llvm::GlobalValue::LinkerPrivateLinkage; - + Linkage = llvm::GlobalValue::PrivateLinkage; + // Note: -fwritable-strings doesn't make the backing store strings of // CFStrings writable. (See ) llvm::GlobalVariable *GV = diff --git a/test/CodeGen/cfstring.c b/test/CodeGen/cfstring.c index f73ffc6082..fc86e42a6f 100644 --- a/test/CodeGen/cfstring.c +++ b/test/CodeGen/cfstring.c @@ -5,9 +5,9 @@ // // RUN: %clang_cc1 -fwritable-strings -emit-llvm %s -o - | FileCheck %s // -// CHECK: @.str = linker_private unnamed_addr constant [14 x i8] c"Hello, World!\00", section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @.str1 = linker_private unnamed_addr constant [7 x i8] c"yo joe\00", section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @.str3 = linker_private unnamed_addr constant [16 x i8] c"Goodbye, World!\00", section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @.str = private unnamed_addr constant [14 x i8] c"Hello, World!\00", section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @.str1 = private unnamed_addr constant [7 x i8] c"yo joe\00", section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @.str3 = private unnamed_addr constant [16 x i8] c"Goodbye, World!\00", section "__TEXT,__cstring,cstring_literals", align 1 #define CFSTR __builtin___CFStringMakeConstantString diff --git a/test/CodeGen/darwin-string-literals.c b/test/CodeGen/darwin-string-literals.c index 621a46eb36..e020685e8a 100644 --- a/test/CodeGen/darwin-string-literals.c +++ b/test/CodeGen/darwin-string-literals.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LSB %s // CHECK-LSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00" -// CHECK-LSB: @.str1 = linker_private unnamed_addr constant [8 x i8] c"string1\00" +// CHECK-LSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00" // CHECK-LSB: @.str2 = internal unnamed_addr constant [18 x i16] [i16 104, i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], section "__TEXT,__ustring", align 2 // CHECK-LSB: @.str4 = internal unnamed_addr constant [6 x i16] [i16 116, i16 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", align 2 @@ -9,7 +9,7 @@ // RUN: %clang_cc1 -triple powerpc-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-MSB %s // CHECK-MSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00" -// CHECK-MSB: @.str1 = linker_private unnamed_addr constant [8 x i8] c"string1\00" +// CHECK-MSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00" // CHECK-MSB: @.str2 = internal unnamed_addr constant [18 x i16] [i16 104, i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], section "__TEXT,__ustring", align 2 // CHECK-MSB: @.str4 = internal unnamed_addr constant [6 x i16] [i16 116, i16 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", align 2