mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Untangle a snarl that I discovered when updating the mangler,
starting in getCurrentFunctionEHName. Among other problems, we would try to privative a "foo.eh" label, but end up emitting the label as _Lfoo.eh instead of L_foo.eh on darwin. This is really bad, and the linker has always tolerated these labels existing. For now, just emit them as _foo.eh. This patch also fixes problems with ".eh" labels on unnamed functions and eliminates two strangely defined TargetAsmInfo hooks. llvm-svn: 76231
This commit is contained in:
parent
de011196a4
commit
ffe0c407be
@ -170,11 +170,9 @@ namespace llvm {
|
|||||||
/// Should be overridden if an indirect reference should be used.
|
/// Should be overridden if an indirect reference should be used.
|
||||||
virtual void EmitExternalGlobal(const GlobalVariable *GV);
|
virtual void EmitExternalGlobal(const GlobalVariable *GV);
|
||||||
|
|
||||||
/// getCurrentFunctionEHName - Called to return (and cache) the
|
/// getCurrentFunctionEHName - Called to return the CurrentFnEHName.
|
||||||
/// CurrentFnEHName.
|
|
||||||
///
|
///
|
||||||
const std::string &getCurrentFunctionEHName(const MachineFunction *MF,
|
std::string getCurrentFunctionEHName(const MachineFunction *MF) const;
|
||||||
std::string &FuncEHName) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// getAnalysisUsage - Record analysis usage.
|
/// getAnalysisUsage - Record analysis usage.
|
||||||
|
@ -480,9 +480,9 @@ namespace llvm {
|
|||||||
/// encode inline subroutine information.
|
/// encode inline subroutine information.
|
||||||
bool DwarfUsesInlineInfoSection; // Defaults to false.
|
bool DwarfUsesInlineInfoSection; // Defaults to false.
|
||||||
|
|
||||||
/// NonLocalEHFrameLabel - If set, the EH_frame label needs to be non-local.
|
/// Is_EHSymbolPrivate - If set, the "_foo.eh" is made private so that it
|
||||||
///
|
/// doesn't show up in the symbol table of the object file.
|
||||||
bool NonLocalEHFrameLabel; // Defaults to false.
|
bool Is_EHSymbolPrivate; // Defaults to true.
|
||||||
|
|
||||||
/// GlobalEHDirective - This is the directive used to make exception frame
|
/// GlobalEHDirective - This is the directive used to make exception frame
|
||||||
/// tables globally visible.
|
/// tables globally visible.
|
||||||
@ -714,12 +714,6 @@ namespace llvm {
|
|||||||
const char *getPrivateGlobalPrefix() const {
|
const char *getPrivateGlobalPrefix() const {
|
||||||
return PrivateGlobalPrefix;
|
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 {
|
const char *getLessPrivateGlobalPrefix() const {
|
||||||
return LessPrivateGlobalPrefix;
|
return LessPrivateGlobalPrefix;
|
||||||
}
|
}
|
||||||
@ -876,8 +870,8 @@ namespace llvm {
|
|||||||
bool doesDwarfUsesInlineInfoSection() const {
|
bool doesDwarfUsesInlineInfoSection() const {
|
||||||
return DwarfUsesInlineInfoSection;
|
return DwarfUsesInlineInfoSection;
|
||||||
}
|
}
|
||||||
bool doesRequireNonLocalEHFrameLabel() const {
|
bool is_EHSymbolPrivate() const {
|
||||||
return NonLocalEHFrameLabel;
|
return Is_EHSymbolPrivate;
|
||||||
}
|
}
|
||||||
const char *getGlobalEHDirective() const {
|
const char *getGlobalEHDirective() const {
|
||||||
return GlobalEHDirective;
|
return GlobalEHDirective;
|
||||||
|
@ -264,17 +264,11 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &
|
std::string
|
||||||
AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF,
|
AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) const {
|
||||||
std::string &Name) const {
|
|
||||||
assert(MF && "No machine function?");
|
assert(MF && "No machine function?");
|
||||||
Name = MF->getFunction()->getName();
|
return Mang->getMangledName(MF->getFunction(), ".eh",
|
||||||
if (Name.empty())
|
TAI->is_EHSymbolPrivate());
|
||||||
Name = Mang->getMangledName(MF->getFunction());
|
|
||||||
|
|
||||||
// FIXME: THIS SEEMS REALLY WRONG, it will get two prefixes.
|
|
||||||
Name = Mang->makeNameProper(TAI->getEHGlobalPrefix() + Name + ".eh");
|
|
||||||
return Name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
||||||
|
@ -57,8 +57,8 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality,
|
|||||||
// Begin eh frame section.
|
// Begin eh frame section.
|
||||||
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
|
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
|
||||||
|
|
||||||
if (!TAI->doesRequireNonLocalEHFrameLabel())
|
if (TAI->is_EHSymbolPrivate())
|
||||||
O << TAI->getEHGlobalPrefix();
|
O << TAI->getPrivateGlobalPrefix();
|
||||||
|
|
||||||
O << "EH_frame" << Index << ":\n";
|
O << "EH_frame" << Index << ":\n";
|
||||||
EmitLabel("section_eh_frame", Index);
|
EmitLabel("section_eh_frame", Index);
|
||||||
@ -194,7 +194,8 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
|
|||||||
|
|
||||||
EmitLabel("eh_frame_begin", EHFrameInfo.Number);
|
EmitLabel("eh_frame_begin", EHFrameInfo.Number);
|
||||||
|
|
||||||
if (TAI->doesRequireNonLocalEHFrameLabel()) {
|
if (!TAI->is_EHSymbolPrivate()) {
|
||||||
|
// FIXME: HOW ARE THESE TWO ARMS DIFFERENT?? EH_frame vs eh_frame_common?
|
||||||
PrintRelDirective(true, true);
|
PrintRelDirective(true, true);
|
||||||
PrintLabelName("eh_frame_begin", EHFrameInfo.Number);
|
PrintLabelName("eh_frame_begin", EHFrameInfo.Number);
|
||||||
|
|
||||||
@ -690,9 +691,8 @@ void DwarfException::EndFunction() {
|
|||||||
EmitExceptionTable();
|
EmitExceptionTable();
|
||||||
|
|
||||||
// Save EH frame information
|
// Save EH frame information
|
||||||
std::string Name;
|
|
||||||
EHFrames.push_back(
|
EHFrames.push_back(
|
||||||
FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF, Name),
|
FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
|
||||||
SubprogramCount,
|
SubprogramCount,
|
||||||
MMI->getPersonalityIndex(),
|
MMI->getPersonalityIndex(),
|
||||||
MF->getFrameInfo()->hasCalls(),
|
MF->getFrameInfo()->hasCalls(),
|
||||||
|
@ -86,6 +86,11 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM)
|
|||||||
StaticDtorsSection = ".mod_term_func";
|
StaticDtorsSection = ".mod_term_func";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// _foo.eh symbols are currently always exported so that the linker knows
|
||||||
|
// about them. This may not strictly be necessary on 10.6 and later, but it
|
||||||
|
// doesn't hurt anything.
|
||||||
|
Is_EHSymbolPrivate = false;
|
||||||
|
|
||||||
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
|
DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
|
||||||
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
|
DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";
|
||||||
DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
|
DwarfLineSection = ".section __DWARF,__debug_line,regular,debug";
|
||||||
|
@ -106,7 +106,7 @@ TargetAsmInfo::TargetAsmInfo(const TargetMachine &tm)
|
|||||||
SupportsExceptionHandling = false;
|
SupportsExceptionHandling = false;
|
||||||
DwarfRequiresFrameSection = true;
|
DwarfRequiresFrameSection = true;
|
||||||
DwarfUsesInlineInfoSection = false;
|
DwarfUsesInlineInfoSection = false;
|
||||||
NonLocalEHFrameLabel = false;
|
Is_EHSymbolPrivate = true;
|
||||||
GlobalEHDirective = 0;
|
GlobalEHDirective = 0;
|
||||||
SupportsWeakOmittedEHFrame = true;
|
SupportsWeakOmittedEHFrame = true;
|
||||||
DwarfSectionOffsetDirective = 0;
|
DwarfSectionOffsetDirective = 0;
|
||||||
|
@ -64,7 +64,6 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
|
|||||||
// Leopard and above support aligned common symbols.
|
// Leopard and above support aligned common symbols.
|
||||||
COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
|
COMMDirectiveTakesAlignment = (Subtarget->getDarwinVers() >= 9);
|
||||||
HasDotTypeDotSizeDirective = false;
|
HasDotTypeDotSizeDirective = false;
|
||||||
NonLocalEHFrameLabel = true;
|
|
||||||
|
|
||||||
if (is64Bit) {
|
if (is64Bit) {
|
||||||
PersonalityPrefix = "";
|
PersonalityPrefix = "";
|
||||||
|
Loading…
Reference in New Issue
Block a user