Darwin likes for the EH frame to be non-local.

llvm-svn: 61420
This commit is contained in:
Bill Wendling 2008-12-24 08:05:17 +00:00
parent 6add893a14
commit 044248aad1
4 changed files with 25 additions and 4 deletions

View File

@ -453,6 +453,10 @@ namespace llvm {
/// ///
bool FDEEncodingRequiresSData4; // Defaults to true bool FDEEncodingRequiresSData4; // Defaults to true
/// NonLocalEHFrameLabel - If set, the EH_frame label needs to be non-local.
///
bool NonLocalEHFrameLabel; // Defaults to false.
/// 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.
/// ///
@ -822,6 +826,9 @@ namespace llvm {
bool doesFDEEncodingRequireSData4() const { bool doesFDEEncodingRequireSData4() const {
return FDEEncodingRequiresSData4; return FDEEncodingRequiresSData4;
} }
bool doesRequireNonLocalEHFrameLabel() const {
return NonLocalEHFrameLabel;
}
const char *getGlobalEHDirective() const { const char *getGlobalEHDirective() const {
return GlobalEHDirective; return GlobalEHDirective;
} }

View File

@ -2963,7 +2963,10 @@ private:
// Begin eh frame section. // Begin eh frame section.
Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection()); Asm->SwitchToTextSection(TAI->getDwarfEHFrameSection());
O << TAI->getEHGlobalPrefix() << "EH_frame" << Index << ":\n";
if (!TAI->doesRequireNonLocalEHFrameLabel())
O << TAI->getEHGlobalPrefix();
O << "EH_frame" << Index << ":\n";
EmitLabel("section_eh_frame", Index); EmitLabel("section_eh_frame", Index);
// Define base labels. // Define base labels.
@ -3102,9 +3105,18 @@ private:
EmitLabel("eh_frame_begin", EHFrameInfo.Number); EmitLabel("eh_frame_begin", EHFrameInfo.Number);
EmitSectionOffset("eh_frame_begin", "eh_frame_common", if (TAI->doesRequireNonLocalEHFrameLabel()) {
EHFrameInfo.Number, EHFrameInfo.PersonalityIndex, PrintRelDirective(true, true);
true, true, false); PrintLabelName("eh_frame_begin", EHFrameInfo.Number);
if (!TAI->isAbsoluteEHSectionOffsets())
O << "-EH_frame" << EHFrameInfo.PersonalityIndex;
} else {
EmitSectionOffset("eh_frame_begin", "eh_frame_common",
EHFrameInfo.Number, EHFrameInfo.PersonalityIndex,
true, true, false);
}
Asm->EOL("FDE CIE offset"); Asm->EOL("FDE CIE offset");
EmitReference("eh_func_begin", EHFrameInfo.Number, true, true); EmitReference("eh_func_begin", EHFrameInfo.Number, true, true);

View File

@ -100,6 +100,7 @@ void TargetAsmInfo::fillDefaultValues() {
SupportsExceptionHandling = false; SupportsExceptionHandling = false;
DwarfRequiresFrameSection = true; DwarfRequiresFrameSection = true;
FDEEncodingRequiresSData4 = true; FDEEncodingRequiresSData4 = true;
NonLocalEHFrameLabel = false;
GlobalEHDirective = 0; GlobalEHDirective = 0;
SupportsWeakOmittedEHFrame = true; SupportsWeakOmittedEHFrame = true;
DwarfSectionOffsetDirective = 0; DwarfSectionOffsetDirective = 0;

View File

@ -71,6 +71,7 @@ X86DarwinTargetAsmInfo::X86DarwinTargetAsmInfo(const X86TargetMachine &TM):
HasDotTypeDotSizeDirective = false; HasDotTypeDotSizeDirective = false;
HasSingleParameterDotFile = false; HasSingleParameterDotFile = false;
FDEEncodingRequiresSData4 = false; FDEEncodingRequiresSData4 = false;
NonLocalEHFrameLabel = true;
if (TM.getRelocationModel() == Reloc::Static) { if (TM.getRelocationModel() == Reloc::Static) {
StaticCtorsSection = ".constructor"; StaticCtorsSection = ".constructor";
StaticDtorsSection = ".destructor"; StaticDtorsSection = ".destructor";