mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes. PR 1880. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45811 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -309,6 +309,10 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
const char *GlobalEHDirective; // Defaults to NULL.
|
const char *GlobalEHDirective; // Defaults to NULL.
|
||||||
|
|
||||||
|
/// SupportsWeakEmptyEHFrame - True if target assembler and linker will
|
||||||
|
/// handle a weak_definition of constant 0 for an omitted EH frame.
|
||||||
|
bool SupportsWeakOmittedEHFrame; // Defaults to true.
|
||||||
|
|
||||||
/// DwarfSectionOffsetDirective - Special section offset directive.
|
/// DwarfSectionOffsetDirective - Special section offset directive.
|
||||||
const char* DwarfSectionOffsetDirective; // Defaults to NULL
|
const char* DwarfSectionOffsetDirective; // Defaults to NULL
|
||||||
|
|
||||||
@@ -585,6 +589,9 @@ namespace llvm {
|
|||||||
const char *getGlobalEHDirective() const {
|
const char *getGlobalEHDirective() const {
|
||||||
return GlobalEHDirective;
|
return GlobalEHDirective;
|
||||||
}
|
}
|
||||||
|
bool getSupportsWeakOmittedEHFrame() const {
|
||||||
|
return SupportsWeakOmittedEHFrame;
|
||||||
|
}
|
||||||
const char *getDwarfSectionOffsetDirective() const {
|
const char *getDwarfSectionOffsetDirective() const {
|
||||||
return DwarfSectionOffsetDirective;
|
return DwarfSectionOffsetDirective;
|
||||||
}
|
}
|
||||||
|
@@ -2877,18 +2877,25 @@ private:
|
|||||||
O << GlobalEHDirective << EHFrameInfo.FnName << "\n";
|
O << GlobalEHDirective << EHFrameInfo.FnName << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no calls then you can't unwind.
|
|
||||||
if (!EHFrameInfo.hasCalls) {
|
|
||||||
O << EHFrameInfo.FnName << " = 0\n";
|
|
||||||
} else {
|
|
||||||
O << EHFrameInfo.FnName << ":\n";
|
|
||||||
|
|
||||||
// If corresponding function is weak definition, this should be too.
|
// If corresponding function is weak definition, this should be too.
|
||||||
if ((EHFrameInfo.linkage == Function::WeakLinkage ||
|
if ((EHFrameInfo.linkage == Function::WeakLinkage ||
|
||||||
EHFrameInfo.linkage == Function::LinkOnceLinkage) &&
|
EHFrameInfo.linkage == Function::LinkOnceLinkage) &&
|
||||||
TAI->getWeakDefDirective())
|
TAI->getWeakDefDirective())
|
||||||
O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n";
|
O << TAI->getWeakDefDirective() << EHFrameInfo.FnName << "\n";
|
||||||
|
|
||||||
|
// If there are no calls then you can't unwind. This may mean we can
|
||||||
|
// omit the EH Frame, but some environments do not handle weak absolute
|
||||||
|
// symbols.
|
||||||
|
if (!EHFrameInfo.hasCalls &&
|
||||||
|
((EHFrameInfo.linkage != Function::WeakLinkage &&
|
||||||
|
EHFrameInfo.linkage != Function::LinkOnceLinkage) ||
|
||||||
|
!TAI->getWeakDefDirective() ||
|
||||||
|
TAI->getSupportsWeakOmittedEHFrame()))
|
||||||
|
{
|
||||||
|
O << EHFrameInfo.FnName << " = 0\n";
|
||||||
|
} else {
|
||||||
|
O << EHFrameInfo.FnName << ":\n";
|
||||||
|
|
||||||
// EH frame header.
|
// EH frame header.
|
||||||
EmitDifference("eh_frame_end", EHFrameInfo.Number,
|
EmitDifference("eh_frame_end", EHFrameInfo.Number,
|
||||||
"eh_frame_begin", EHFrameInfo.Number, true);
|
"eh_frame_begin", EHFrameInfo.Number, true);
|
||||||
|
@@ -51,8 +51,8 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
|
|||||||
StaticDtorsSection = ".mod_term_func";
|
StaticDtorsSection = ".mod_term_func";
|
||||||
}
|
}
|
||||||
UsedDirective = "\t.no_dead_strip\t";
|
UsedDirective = "\t.no_dead_strip\t";
|
||||||
WeakDefDirective = "\t.weak_definition\t";
|
WeakDefDirective = "\t.weak_definition ";
|
||||||
WeakRefDirective = "\t.weak_reference\t";
|
WeakRefDirective = "\t.weak_reference ";
|
||||||
HiddenDirective = "\t.private_extern\t";
|
HiddenDirective = "\t.private_extern\t";
|
||||||
SupportsExceptionHandling = true;
|
SupportsExceptionHandling = true;
|
||||||
NeedsIndirectEncoding = true;
|
NeedsIndirectEncoding = true;
|
||||||
@@ -62,12 +62,13 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
|
|||||||
DwarfEHFrameSection =
|
DwarfEHFrameSection =
|
||||||
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
|
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
|
||||||
DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
|
DwarfExceptionSection = ".section __DATA,__gcc_except_tab";
|
||||||
|
GlobalEHDirective = "\t.globl\t";
|
||||||
|
SupportsWeakOmittedEHFrame = 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";
|
||||||
DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
|
DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
|
||||||
GlobalEHDirective = "\t.globl\t";
|
|
||||||
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
|
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
|
||||||
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
|
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
|
||||||
DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
|
DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
|
||||||
|
@@ -86,6 +86,7 @@ TargetAsmInfo::TargetAsmInfo() :
|
|||||||
SupportsExceptionHandling(false),
|
SupportsExceptionHandling(false),
|
||||||
DwarfRequiresFrameSection(true),
|
DwarfRequiresFrameSection(true),
|
||||||
GlobalEHDirective(0),
|
GlobalEHDirective(0),
|
||||||
|
SupportsWeakOmittedEHFrame(true),
|
||||||
DwarfSectionOffsetDirective(0),
|
DwarfSectionOffsetDirective(0),
|
||||||
DwarfAbbrevSection(".debug_abbrev"),
|
DwarfAbbrevSection(".debug_abbrev"),
|
||||||
DwarfInfoSection(".debug_info"),
|
DwarfInfoSection(".debug_info"),
|
||||||
|
@@ -76,8 +76,8 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
SetDirective = "\t.set";
|
SetDirective = "\t.set";
|
||||||
PCSymbol = ".";
|
PCSymbol = ".";
|
||||||
UsedDirective = "\t.no_dead_strip\t";
|
UsedDirective = "\t.no_dead_strip\t";
|
||||||
WeakDefDirective = "\t.weak_definition\t";
|
WeakDefDirective = "\t.weak_definition ";
|
||||||
WeakRefDirective = "\t.weak_reference\t";
|
WeakRefDirective = "\t.weak_reference ";
|
||||||
HiddenDirective = "\t.private_extern\t";
|
HiddenDirective = "\t.private_extern\t";
|
||||||
|
|
||||||
// In non-PIC modes, emit a special label before jump tables so that the
|
// In non-PIC modes, emit a special label before jump tables so that the
|
||||||
@@ -93,7 +93,6 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
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";
|
||||||
DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
|
DwarfFrameSection = ".section __DWARF,__debug_frame,regular,debug";
|
||||||
GlobalEHDirective = "\t.globl\t";
|
|
||||||
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
|
DwarfPubNamesSection = ".section __DWARF,__debug_pubnames,regular,debug";
|
||||||
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
|
DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes,regular,debug";
|
||||||
DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
|
DwarfStrSection = ".section __DWARF,__debug_str,regular,debug";
|
||||||
@@ -105,6 +104,8 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
// Exceptions handling
|
// Exceptions handling
|
||||||
if (!Subtarget->is64Bit())
|
if (!Subtarget->is64Bit())
|
||||||
SupportsExceptionHandling = true;
|
SupportsExceptionHandling = true;
|
||||||
|
GlobalEHDirective = "\t.globl\t";
|
||||||
|
SupportsWeakOmittedEHFrame = false;
|
||||||
AbsoluteEHSectionOffsets = false;
|
AbsoluteEHSectionOffsets = false;
|
||||||
DwarfEHFrameSection =
|
DwarfEHFrameSection =
|
||||||
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
|
".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support";
|
||||||
|
Reference in New Issue
Block a user