r199705 - Now that r199688 avoids the real issue, use private linkage for objc strings.

Rafael Espindola rafael.espindola at gmail.com
Mon Jan 20 17:50:12 PST 2014


Author: rafael
Date: Mon Jan 20 19:50:12 2014
New Revision: 199705

URL: http://llvm.org/viewvc/llvm-project?rev=199705&view=rev
Log:
Now that r199688 avoids the real issue, use private linkage for objc strings.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
    cfe/trunk/test/CodeGen/cfstring.c
    cfe/trunk/test/CodeGen/darwin-string-literals.c

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=199705&r1=199704&r2=199705&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan 20 19:50:12 2014
@@ -2383,11 +2383,8 @@ CodeGenModule::GetAddrOfConstantCFString
     // 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 <rdar://problem/10657500>)
   llvm::GlobalVariable *GV =

Modified: cfe/trunk/test/CodeGen/cfstring.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/cfstring.c?rev=199705&r1=199704&r2=199705&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/cfstring.c (original)
+++ cfe/trunk/test/CodeGen/cfstring.c Mon Jan 20 19:50:12 2014
@@ -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
 

Modified: cfe/trunk/test/CodeGen/darwin-string-literals.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/darwin-string-literals.c?rev=199705&r1=199704&r2=199705&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/darwin-string-literals.c (original)
+++ cfe/trunk/test/CodeGen/darwin-string-literals.c Mon Jan 20 19:50:12 2014
@@ -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
 





More information about the cfe-commits mailing list