mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 20:23:59 +00:00
Put each personality function in a section. This fixes the gnu ld warning:
error in foo.o; no .eh_frame_hdr table will be created. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129635 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -58,6 +58,11 @@ public:
|
|||||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
|
||||||
|
|
||||||
virtual const MCSection *getEHFrameSection() const;
|
virtual const MCSection *getEHFrameSection() const;
|
||||||
|
virtual MCSymbol *getPersonalityPICSymbol(StringRef Name) const;
|
||||||
|
|
||||||
|
virtual void emitPersonalityValue(MCStreamer &Streamer,
|
||||||
|
const TargetMachine &TM,
|
||||||
|
const MCSymbol *Sym) const;
|
||||||
|
|
||||||
const MCSection *getDataRelSection() const { return DataRelSection; }
|
const MCSection *getDataRelSection() const { return DataRelSection; }
|
||||||
|
|
||||||
|
@ -140,6 +140,10 @@ public:
|
|||||||
const MCSection *getStaticDtorSection() const { return StaticDtorSection; }
|
const MCSection *getStaticDtorSection() const { return StaticDtorSection; }
|
||||||
const MCSection *getLSDASection() const { return LSDASection; }
|
const MCSection *getLSDASection() const { return LSDASection; }
|
||||||
virtual const MCSection *getEHFrameSection() const = 0;
|
virtual const MCSection *getEHFrameSection() const = 0;
|
||||||
|
virtual MCSymbol *getPersonalityPICSymbol(StringRef Name) const;
|
||||||
|
virtual void emitPersonalityValue(MCStreamer &Streamer,
|
||||||
|
const TargetMachine &TM,
|
||||||
|
const MCSymbol *Sym) const;
|
||||||
const MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
|
const MCSection *getDwarfAbbrevSection() const { return DwarfAbbrevSection; }
|
||||||
const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
|
const MCSection *getDwarfInfoSection() const { return DwarfInfoSection; }
|
||||||
const MCSection *getDwarfLineSection() const { return DwarfLineSection; }
|
const MCSection *getDwarfLineSection() const { return DwarfLineSection; }
|
||||||
|
@ -58,19 +58,14 @@ void DwarfCFIException::EndModule() {
|
|||||||
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
|
||||||
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
unsigned PerEncoding = TLOF.getPersonalityEncoding();
|
||||||
|
|
||||||
// Begin eh frame section.
|
|
||||||
Asm->OutStreamer.SwitchSection(TLOF.getEHFrameSection());
|
|
||||||
|
|
||||||
if ((PerEncoding & 0x70) != dwarf::DW_EH_PE_pcrel)
|
if ((PerEncoding & 0x70) != dwarf::DW_EH_PE_pcrel)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Emit references to all used personality functions
|
// Emit references to all used personality functions
|
||||||
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
const std::vector<const Function*> &Personalities = MMI->getPersonalities();
|
||||||
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
for (size_t i = 0, e = Personalities.size(); i != e; ++i) {
|
||||||
Asm->OutStreamer.EmitLabel(Asm->GetTempSymbol("personality", i));
|
|
||||||
const MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
const MCSymbol *Sym = Asm->Mang->getSymbol(Personalities[i]);
|
||||||
unsigned Size = Asm->TM.getTargetData()->getPointerSize();
|
TLOF.emitPersonalityValue(Asm->OutStreamer, Asm->TM, Sym);
|
||||||
Asm->OutStreamer.EmitSymbolValue(Sym, Size);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,8 +118,8 @@ void DwarfCFIException::BeginFunction(const MachineFunction *MF) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case dwarf::DW_EH_PE_pcrel: {
|
case dwarf::DW_EH_PE_pcrel: {
|
||||||
Sym = Asm->GetTempSymbol("personality",
|
MCContext &Context = Asm->OutStreamer.getContext();
|
||||||
MMI->getPersonalityIndex());
|
Sym = TLOF.getPersonalityPICSymbol(Per->getName());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "llvm/MC/MCSectionMachO.h"
|
#include "llvm/MC/MCSectionMachO.h"
|
||||||
#include "llvm/MC/MCSectionELF.h"
|
#include "llvm/MC/MCSectionELF.h"
|
||||||
#include "llvm/MC/MCSectionCOFF.h"
|
#include "llvm/MC/MCSectionCOFF.h"
|
||||||
|
#include "llvm/MC/MCStreamer.h"
|
||||||
#include "llvm/MC/MCSymbol.h"
|
#include "llvm/MC/MCSymbol.h"
|
||||||
#include "llvm/Target/Mangler.h"
|
#include "llvm/Target/Mangler.h"
|
||||||
#include "llvm/Target/TargetData.h"
|
#include "llvm/Target/TargetData.h"
|
||||||
@ -176,6 +177,38 @@ const MCSection *TargetLoweringObjectFileELF::getEHFrameSection() const {
|
|||||||
SectionKind::getDataRel());
|
SectionKind::getDataRel());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCSymbol *
|
||||||
|
TargetLoweringObjectFileELF::getPersonalityPICSymbol(StringRef Name) const {
|
||||||
|
Twine FullName = StringRef("DW.ref.") + Name;
|
||||||
|
return getContext().GetOrCreateSymbol(FullName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetLoweringObjectFileELF::emitPersonalityValue(MCStreamer &Streamer,
|
||||||
|
const TargetMachine &TM,
|
||||||
|
const MCSymbol *Sym) const {
|
||||||
|
MCSymbol *Label = getPersonalityPICSymbol(Sym->getName());
|
||||||
|
Streamer.EmitSymbolAttribute(Label, MCSA_Hidden);
|
||||||
|
Streamer.EmitSymbolAttribute(Label, MCSA_Weak);
|
||||||
|
Twine SectionName = StringRef(".data.") + Label->getName();
|
||||||
|
SmallString<64> NameData;
|
||||||
|
SectionName.toVector(NameData);
|
||||||
|
unsigned Flags = ELF::SHF_ALLOC | ELF::SHF_WRITE | ELF::SHF_GROUP;
|
||||||
|
const MCSection *Sec = getContext().getELFSection(NameData,
|
||||||
|
ELF::SHT_PROGBITS,
|
||||||
|
Flags,
|
||||||
|
SectionKind::getDataRel(),
|
||||||
|
0, Label->getName());
|
||||||
|
Streamer.SwitchSection(Sec);
|
||||||
|
Streamer.EmitValueToAlignment(8);
|
||||||
|
Streamer.EmitSymbolAttribute(Label, MCSA_ELF_TypeObject);
|
||||||
|
const MCExpr *E = MCConstantExpr::Create(8, getContext());
|
||||||
|
Streamer.EmitELFSize(Label, E);
|
||||||
|
Streamer.EmitLabel(Label);
|
||||||
|
|
||||||
|
unsigned Size = TM.getTargetData()->getPointerSize();
|
||||||
|
Streamer.EmitSymbolValue(Sym, Size);
|
||||||
|
}
|
||||||
|
|
||||||
static SectionKind
|
static SectionKind
|
||||||
getELFKindForNamedSection(StringRef Name, SectionKind K) {
|
getELFKindForNamedSection(StringRef Name, SectionKind K) {
|
||||||
// FIXME: Why is this here? Codegen is should not be in the business
|
// FIXME: Why is this here? Codegen is should not be in the business
|
||||||
|
@ -120,6 +120,18 @@ static bool IsNullTerminatedString(const Constant *C) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCSymbol *
|
||||||
|
TargetLoweringObjectFile::getPersonalityPICSymbol(StringRef Name) const {
|
||||||
|
assert(0 && "Not Available in this format.");
|
||||||
|
}
|
||||||
|
|
||||||
|
void TargetLoweringObjectFile::emitPersonalityValue(MCStreamer &Streamer,
|
||||||
|
const TargetMachine &TM,
|
||||||
|
const MCSymbol *Sym) const {
|
||||||
|
assert(0 && "Not Available in this format.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// getKindForGlobal - This is a top-level target-independent classifier for
|
/// getKindForGlobal - This is a top-level target-independent classifier for
|
||||||
/// a global variable. Given an global variable and information from TM, it
|
/// a global variable. Given an global variable and information from TM, it
|
||||||
/// classifies the global in a variety of ways that make various target
|
/// classifies the global in a variety of ways that make various target
|
||||||
|
Reference in New Issue
Block a user