[llvm-commits] [llvm] r55973 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/ARM/ARMTargetAsmInfo.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp
Dale Johannesen
dalej at apple.com
Mon Sep 8 18:21:22 PDT 2008
Author: johannes
Date: Mon Sep 8 20:21:22 2008
New Revision: 55973
URL: http://llvm.org/viewvc/llvm-project?rev=55973&view=rev
Log:
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).
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
llvm/trunk/lib/Target/TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Mon Sep 8 20:21:22 2008
@@ -216,10 +216,15 @@
const char *GlobalPrefix; // Defaults to ""
/// PrivateGlobalPrefix - This prefix is used for globals like constant
- /// pool entries that are completely private to the .o file and should not
+ /// pool entries that are completely private to the .s file and should not
/// have names in the .o file. This is often "." or "L".
const char *PrivateGlobalPrefix; // Defaults to "."
+ /// LessPrivateGlobalPrefix - This prefix is used for some Objective C
+ /// metadata symbols that should be passed through the assembler but be
+ /// removed by the linker. This is "l" on Darwin.
+ const char *LessPrivateGlobalPrefix; // Defaults to ""
+
/// JumpTableSpecialLabelPrefix - If not null, a extra (dead) label is
/// emitted before jump tables with the specified prefix.
const char *JumpTableSpecialLabelPrefix; // Default to null.
@@ -653,6 +658,9 @@
const char *getPrivateGlobalPrefix() const {
return PrivateGlobalPrefix;
}
+ const char *getLessPrivateGlobalPrefix() const {
+ return LessPrivateGlobalPrefix;
+ }
const char *getJumpTableSpecialLabelPrefix() const {
return JumpTableSpecialLabelPrefix;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Sep 8 20:21:22 2008
@@ -452,7 +452,9 @@
/// 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 @@
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';
Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Mon Sep 8 20:21:22 2008
@@ -62,6 +62,7 @@
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ LessPrivateGlobalPrefix = "l";
StringConstantPrefix = "\1LC";
BSSSection = 0; // no BSS section
ZeroDirective = "\t.space\t";
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Sep 8 20:21:22 2008
@@ -38,6 +38,7 @@
CommentString = ";";
GlobalPrefix = "_";
PrivateGlobalPrefix = "L";
+ LessPrivateGlobalPrefix = "l";
StringConstantPrefix = "\1LC";
ConstantPoolSection = "\t.const\t";
JumpTableDataSection = ".const";
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Mon Sep 8 20:21:22 2008
@@ -50,6 +50,7 @@
CommentString("#"),
GlobalPrefix(""),
PrivateGlobalPrefix("."),
+ LessPrivateGlobalPrefix(""),
JumpTableSpecialLabelPrefix(0),
GlobalVarAddrPrefix(""),
GlobalVarAddrSuffix(""),
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=55973&r1=55972&r2=55973&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Mon Sep 8 20:21:22 2008
@@ -136,6 +136,7 @@
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)
More information about the llvm-commits
mailing list