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;
}
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) {
// 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.
/// 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; }
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";
explicit PPCDarwinTargetAsmInfo(const PPCTargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual const char *getEHGlobalPrefix() const;
};
struct PPCLinuxTargetAsmInfo : public PPCTargetAsmInfo<ELFTargetAsmInfo> {
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) {
explicit X86DarwinTargetAsmInfo(const X86TargetMachine &TM);
virtual unsigned PreferredEHDataFormat(DwarfEncoding::Target Reason,
bool Global) const;
+ virtual const char *getEHGlobalPrefix() const;
};
struct X86ELFTargetAsmInfo : public X86TargetAsmInfo<ELFTargetAsmInfo> {
} // namespace llvm
#endif
-
--- /dev/null
+; 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
+}
--- /dev/null
+; 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
+}