[llvm-commits] [llvm-gcc-4.2] r75776 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Jul 15 05:08:08 PDT 2009


Author: baldrick
Date: Wed Jul 15 07:08:01 2009
New Revision: 75776

URL: http://llvm.org/viewvc/llvm-project?rev=75776&view=rev
Log:
Fix PR4535: give constants (mainly strings, but also
complex numbers) private linkage rather than internal
linkage.  This makes the fake names (.str) invisible
in the final object file.  Doesn't cause any problems
on linux.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=75776&r1=75775&r2=75776&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Jul 15 07:08:01 2009
@@ -1099,7 +1099,7 @@
   
   // Create a new string global.
   GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), true,
-                                          GlobalVariable::InternalLinkage,
+                                          GlobalVariable::PrivateLinkage,
                                           Init, ".str");
   GV->setSection("llvm.metadata");
   Slot = GV;

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=75776&r1=75775&r2=75776&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul 15 07:08:01 2009
@@ -7841,8 +7841,7 @@
 
   // Create a new complex global.
   Slot = new GlobalVariable(*TheModule, Init->getType(), true,
-                            GlobalVariable::InternalLinkage,
-                            Init, ".cpx");
+                            GlobalVariable::PrivateLinkage, Init, ".cpx");
   return Slot;
 }
 
@@ -7864,19 +7863,17 @@
   }
     
   // Create a new string global.
-  const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo();
   GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(), 
                                           StringIsConstant,
-                                          GlobalVariable::InternalLinkage, Init,
-                                           TAI ? 
-                                            TAI->getStringConstantPrefix() : 
-                                            ".str");
+                                          GlobalVariable::PrivateLinkage, Init,
+                                          ".str");
 
   GV->setAlignment(TYPE_ALIGN(TREE_TYPE(exp)) / 8);
 
   if (SlotP) *SlotP = GV;
 #ifdef LLVM_CSTRING_SECTION
   // For Darwin, try to put it into the .cstring section.
+  const TargetAsmInfo *TAI = TheTarget->getTargetAsmInfo();
   if (TAI && TAI->SectionKindForGlobal(GV) == SectionKind::RODataMergeStr)
     // RODataMergeStr implies that StringIsConstant will be true here.
     // The Darwin linker will coalesce strings in this section.





More information about the llvm-commits mailing list