mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-18 10:31:57 +00:00
Add a beta-test for placing the LSDA into the TEXT section on X86.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b45fb90b20
commit
ec041eba38
@ -523,10 +523,18 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
||||
// L_foo$non_lazy_ptr:
|
||||
OutStreamer.EmitLabel(Stubs[i].first);
|
||||
// .indirect_symbol _foo
|
||||
OutStreamer.EmitSymbolAttribute(Stubs[i].second.getPointer(),
|
||||
MachineModuleInfoImpl::StubValueTy &MCSym = Stubs[i].second;
|
||||
OutStreamer.EmitSymbolAttribute(MCSym.getPointer(),
|
||||
MCSA_IndirectSymbol);
|
||||
// .long 0
|
||||
OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
|
||||
if (MCSym.getInt())
|
||||
// External to current translation unit.
|
||||
OutStreamer.EmitIntValue(0, 4/*size*/, 0/*addrspace*/);
|
||||
else
|
||||
// Internal to current translation unit.
|
||||
OutStreamer.EmitValue(MCSymbolRefExpr::Create(MCSym.getPointer(),
|
||||
OutContext),
|
||||
4/*size*/, 0/*addrspace*/);
|
||||
}
|
||||
Stubs.clear();
|
||||
OutStreamer.AddBlankLine();
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "llvm/CodeGen/PseudoSourceValue.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
#include "llvm/MC/MCSectionMachO.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
#include "llvm/ADT/BitVector.h"
|
||||
#include "llvm/ADT/SmallSet.h"
|
||||
@ -45,10 +46,12 @@
|
||||
#include "llvm/ADT/VectorExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/Dwarf.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
using namespace llvm;
|
||||
using namespace dwarf;
|
||||
|
||||
STATISTIC(NumTailCalls, "Number of tail calls");
|
||||
|
||||
@ -67,10 +70,54 @@ Disable16Bit("disable-16bit", cl::Hidden,
|
||||
static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1,
|
||||
SDValue V2);
|
||||
|
||||
// FIXME: This is for a test.
|
||||
static cl::opt<bool>
|
||||
EnableX86EHTest("enable-x86-eh-test", cl::Hidden);
|
||||
|
||||
namespace llvm {
|
||||
class X86_test_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
|
||||
public:
|
||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {
|
||||
TargetLoweringObjectFileMachO::Initialize(Ctx, TM);
|
||||
|
||||
// Exception Handling.
|
||||
LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
|
||||
SectionKind::getReadOnlyWithRel());
|
||||
}
|
||||
|
||||
virtual unsigned getTTypeEncoding() const {
|
||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
||||
}
|
||||
};
|
||||
|
||||
class X8664_test_MachoTargetObjectFile : public X8664_MachoTargetObjectFile {
|
||||
public:
|
||||
virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {
|
||||
TargetLoweringObjectFileMachO::Initialize(Ctx, TM);
|
||||
|
||||
// Exception Handling.
|
||||
LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
|
||||
SectionKind::getReadOnlyWithRel());
|
||||
}
|
||||
|
||||
virtual unsigned getTTypeEncoding() const {
|
||||
return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
|
||||
switch (TM.getSubtarget<X86Subtarget>().TargetType) {
|
||||
default: llvm_unreachable("unknown subtarget type");
|
||||
case X86Subtarget::isDarwin:
|
||||
// FIXME: This is for an EH test.
|
||||
if (EnableX86EHTest) {
|
||||
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
||||
return new X8664_test_MachoTargetObjectFile();
|
||||
else
|
||||
return new X86_test_MachoTargetObjectFile();
|
||||
}
|
||||
|
||||
if (TM.getSubtarget<X86Subtarget>().is64Bit())
|
||||
return new X8664_MachoTargetObjectFile();
|
||||
return new TargetLoweringObjectFileMachO();
|
||||
|
Loading…
Reference in New Issue
Block a user