[llvm-commits] [llvm] r61242 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/CodeGen/AsmPrinter/DwarfWriter.cpp lib/Target/PowerPC/PPCSubtarget.h lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/PowerPC/PPCTargetAsmInfo.h lib/Target/X86/X86TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.h test/CodeGen/PowerPC/20081212.ll test/CodeGen/X86/20081212.ll
Rafael Espindola
rafael.espindola at gmail.com
Fri Dec 19 02:56:27 PST 2008
Author: rafael
Date: Fri Dec 19 04:55:56 2008
New Revision: 61242
URL: http://llvm.org/viewvc/llvm-project?rev=61242&view=rev
Log:
Fix bug 3202.
The EH_frame and .eh symbols are now private, except for darwin9 and earlier.
The patch also fixes the definition of PrivateGlobalPrefix on pcc linux.
Added:
llvm/trunk/test/CodeGen/PowerPC/20081212.ll
llvm/trunk/test/CodeGen/X86/20081212.ll
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Dec 19 04:55:56 2008
@@ -646,6 +646,12 @@
const char *getPrivateGlobalPrefix() const {
return PrivateGlobalPrefix;
}
+ /// EHGlobalPrefix - Prefix for EH_frame and the .eh symbols.
+ /// This is normally PrivateGlobalPrefix, but some targets want
+ /// these symbols to be visible.
+ virtual const char *getEHGlobalPrefix() const {
+ return PrivateGlobalPrefix;
+ }
const char *getLessPrivateGlobalPrefix() const {
return LessPrivateGlobalPrefix;
}
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Dec 19 04:55:56 2008
@@ -239,7 +239,8 @@
std::string Name = MF->getFunction()->getName();
if (Name.empty())
Name = Mang->getValueName(MF->getFunction());
- return Mang->makeNameProper(Name + ".eh", TAI->getGlobalPrefix());
+ return Mang->makeNameProper(TAI->getEHGlobalPrefix() +
+ Name + ".eh", TAI->getGlobalPrefix());
}
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfWriter.cpp Fri Dec 19 04:55:56 2008
@@ -2962,7 +2962,7 @@
// Begin eh frame section.
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
- O << "EH_frame" << Index << ":\n";
+ O << TAI->getEHGlobalPrefix() << "EH_frame" << Index << ":\n";
EmitLabel("section_eh_frame", Index);
// Define base labels.
Modified: llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCSubtarget.h Fri Dec 19 04:55:56 2008
@@ -141,6 +141,9 @@
/// isDarwin - True if this is darwin9 (leopard, 10.5) or above.
bool isDarwin9() const { return DarwinVers >= 9; }
+ /// getDarwinVers - Return the darwin version number, 8 = tiger, 9 = leopard.
+ unsigned getDarwinVers() const { return DarwinVers; }
+
bool isMachoABI() const { return isDarwin() || IsPPC64; }
bool isELF32_ABI() const { return !isDarwin() && !IsPPC64; }
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Fri Dec 19 04:55:56 2008
@@ -89,12 +89,21 @@
return DW_EH_PE_absptr;
}
+const char *
+PPCDarwinTargetAsmInfo::getEHGlobalPrefix() const
+{
+ const PPCSubtarget* Subtarget = &TM.getSubtarget<PPCSubtarget>();
+ if (Subtarget->getDarwinVers() > 9)
+ return PrivateGlobalPrefix;
+ else
+ return "";
+}
PPCLinuxTargetAsmInfo::PPCLinuxTargetAsmInfo(const PPCTargetMachine &TM) :
PPCTargetAsmInfo<ELFTargetAsmInfo>(TM) {
CommentString = "#";
GlobalPrefix = "";
- PrivateGlobalPrefix = "";
+ PrivateGlobalPrefix = ".L";
ConstantPoolSection = "\t.section .rodata.cst4\t";
JumpTableDataSection = ".section .rodata.cst4";
CStringSection = ".rodata.str";
Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.h Fri Dec 19 04:55:56 2008
@@ -48,6 +48,7 @@
explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual const char *getEHGlobalPrefix() const;
};
struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Fri Dec 19 04:55:56 2008
@@ -138,6 +138,16 @@
return DW_EH_PE_absptr;
}
+const char *
+X86DarwinTargetAsmInfo::getEHGlobalPrefix() const
+{
+ const X86Subtarget* Subtarget = &TM.getSubtarget<X86Subtarget>();
+ if (Subtarget->getDarwinVers() > 9)
+ return PrivateGlobalPrefix;
+ else
+ return "";
+}
+
X86ELFTargetAsmInfo::X86ELFTargetAsmInfo(const X86TargetMachine &TM):
X86TargetAsmInfo<ELFTargetAsmInfo>(TM) {
Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h?rev=61242&r1=61241&r2=61242&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.h Fri Dec 19 04:55:56 2008
@@ -48,6 +48,7 @@
explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual const char *getEHGlobalPrefix() const;
};
struct X86ELFTargetAsmInfo : public X86TargetAsmInfo<ELFTargetAsmInfo> {
@@ -72,4 +73,3 @@
} // namespace llvm
#endif
-
Added: llvm/trunk/test/CodeGen/PowerPC/20081212.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/20081212.ll?rev=61242&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PowerPC/20081212.ll (added)
+++ llvm/trunk/test/CodeGen/PowerPC/20081212.ll Fri Dec 19 04:55:56 2008
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-unknown-linux-gnu | grep ^.L_Z1fv.eh
+; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin9 | grep ^__Z1fv.eh
+
+define void @_Z1fv() {
+entry:
+ br label %return
+
+return:
+ ret void
+}
Added: llvm/trunk/test/CodeGen/X86/20081212.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/20081212.ll?rev=61242&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/20081212.ll (added)
+++ llvm/trunk/test/CodeGen/X86/20081212.ll Fri Dec 19 04:55:56 2008
@@ -0,0 +1,12 @@
+; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=x86_64-unknown-linux-gnu | grep ^.L_Z1fv.eh
+; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-unknown-linux-gnu | grep ^.L_Z1fv.eh
+; RUN: llvm-as < %s | llc -march=x86-64 -mtriple=-mtriple=x86_64-apple-darwin9 | grep ^__Z1fv.eh
+; RUN: llvm-as < %s | llc -march=x86 -mtriple=-mtriple=i386-apple-darwin9 | grep ^__Z1fv.eh
+
+define void @_Z1fv() {
+entry:
+ br label %return
+
+return:
+ ret void
+}
More information about the llvm-commits
mailing list