summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2008-09-09 01:21:22 +0000
committerDale Johannesen <dalej@apple.com>2008-09-09 01:21:22 +0000
commitf080225490f700e627b6b01aba5b67270711d99e (patch)
tree118a138487d47338edf0aef71023d3b1c5014f0d /llvm/lib
parent72eb6e76e4d23232f4970a1cb3164df13888e234 (diff)
downloadbcm5719-llvm-f080225490f700e627b6b01aba5b67270711d99e.tar.gz
bcm5719-llvm-f080225490f700e627b6b01aba5b67270711d99e.zip
Fix logic for not emitting no-dead-strip for some
objects in llvm.used (thanks Anton). Makes visible the magic 'l' prefix for symbols on Darwin which are to be passed through the assembler, then removed at linktime (previously all references to this had been hidden in the ObjC FE code, oh well). llvm-svn: 55973
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp16
-rw-r--r--llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp1
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp1
-rw-r--r--llvm/lib/Target/TargetAsmInfo.cpp1
-rw-r--r--llvm/lib/Target/X86/X86TargetAsmInfo.cpp1
5 files changed, 18 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 273253ae23c..f041f3be56f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -452,7 +452,9 @@ const GlobalValue * AsmPrinter::findGlobalValue(const Constant *CV) {
/// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each
/// global in the specified llvm.used list as being used with this directive.
-/// Non-globals (i.e. internal linkage) should not be emitted.
+/// Internally linked data beginning with the PrivateGlobalPrefix or the
+/// LessPrivateGlobalPrefix does not have the directive emitted (this
+/// occurs in ObjC metadata).
void AsmPrinter::EmitLLVMUsedList(Constant *List) {
const char *Directive = TAI->getUsedDirective();
@@ -462,7 +464,17 @@ void AsmPrinter::EmitLLVMUsedList(Constant *List) {
for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) {
const GlobalValue *GV = findGlobalValue(InitList->getOperand(i));
- if (GV && (!GV->hasInternalLinkage() || isa<Function>(GV))) {
+ if (GV) {
+ if (GV->hasInternalLinkage() && !isa<Function>(GV) &&
+ ((strlen(TAI->getPrivateGlobalPrefix()) != 0 &&
+ Mang->getValueName(GV)
+ .substr(0,strlen(TAI->getPrivateGlobalPrefix())) ==
+ TAI->getPrivateGlobalPrefix()) ||
+ (strlen(TAI->getLessPrivateGlobalPrefix()) != 0 &&
+ Mang->getValueName(GV)
+ .substr(0,strlen(TAI->getLessPrivateGlobalPrefix())) ==
+ TAI->getLessPrivateGlobalPrefix())))
+ continue;
O << Directive;
EmitConstantValueOnly(InitList->getOperand(i));
O << '\n';
diff --git a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
index 3e057359582..a1a00a2cdae 100644
--- a/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetAsmInfo.cpp
@@ -62,6 +62,7 @@ ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ LessPrivateGlobalPrefix = "l";
StringConstantPrefix = "\1LC";
BSSSection = 0; // no BSS section
ZeroDirective = "\t.space\t";
diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index 1b8c1a5fb3c..fc98e57c82a 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -38,6 +38,7 @@ PPCDarwinTargetAsmInfo::PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM):
CommentString = ";";
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ LessPrivateGlobalPrefix = "l";
StringConstantPrefix = "\1LC";
ConstantPoolSection = "\t.const\t";
JumpTableDataSection = ".const";
diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp
index 6baebd0ffe7..06b77dd26aa 100644
--- a/llvm/lib/Target/TargetAsmInfo.cpp
+++ b/llvm/lib/Target/TargetAsmInfo.cpp
@@ -50,6 +50,7 @@ TargetAsmInfo::TargetAsmInfo() :
CommentString("#"),
GlobalPrefix(""),
PrivateGlobalPrefix("."),
+ LessPrivateGlobalPrefix(""),
JumpTableSpecialLabelPrefix(0),
GlobalVarAddrPrefix(""),
GlobalVarAddrSuffix(""),
diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
index be390c23963..64858f89bd5 100644
--- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -136,6 +136,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
Data64bitsDirective = 0; // we can't emit a 64-bit unit
ZeroDirective = "\t.space\t"; // ".space N" emits N zeros.
PrivateGlobalPrefix = "L"; // Marker for constant pool idxs
+ LessPrivateGlobalPrefix = "l"; // Marker for some ObjC metadata
BSSSection = 0; // no BSS section.
ZeroFillDirective = "\t.zerofill\t"; // Uses .zerofill
if (DTM->getRelocationModel() != Reloc::Static)
OpenPOWER on IntegriCloud