llvm.org GIT mirror llvm / 757e75b
Place the LSDA into the TEXT section for x86 Darwin. If the global it's pointing to is local to the translation unit, we need to place fill the value of that symbol into the non-lazy pointer. This should conclude all Darwin changes for placing the LSDA into the TEXT section. There is some cleanup to do. I.e., there's no longer a special need for target-specific code here. But that can come later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98564 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 10 years ago
3 changed file(s) with 29 addition(s) and 46 deletion(s). Raw diff Collapse all Expand all
6969 static SDValue getMOVL(SelectionDAG &DAG, DebugLoc dl, EVT VT, SDValue V1,
7070 SDValue V2);
7171
72 // FIXME: This is for a test.
73 static cl::opt
74 EnableX86EHTest("enable-x86-eh-test", cl::Hidden);
75
76 namespace llvm {
77 class X86_test_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
78 public:
79 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {
80 TargetLoweringObjectFileMachO::Initialize(Ctx, TM);
81
82 // Exception Handling.
83 LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
84 SectionKind::getReadOnlyWithRel());
85 }
86
87 virtual unsigned getTTypeEncoding() const {
88 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
89 }
90 };
91
92 class X8664_test_MachoTargetObjectFile : public X8664_MachoTargetObjectFile {
93 public:
94 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM) {
95 TargetLoweringObjectFileMachO::Initialize(Ctx, TM);
96
97 // Exception Handling.
98 LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
99 SectionKind::getReadOnlyWithRel());
100 }
101
102 virtual unsigned getTTypeEncoding() const {
103 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
104 }
105 };
106 }
107
10872 static TargetLoweringObjectFile *createTLOF(X86TargetMachine &TM) {
10973 switch (TM.getSubtarget().TargetType) {
11074 default: llvm_unreachable("unknown subtarget type");
11175 case X86Subtarget::isDarwin:
112 // FIXME: This is for an EH test.
113 if (EnableX86EHTest) {
114 if (TM.getSubtarget().is64Bit())
115 return new X8664_test_MachoTargetObjectFile();
116 else
117 return new X86_test_MachoTargetObjectFile();
118 }
76 if (TM.getSubtarget().is64Bit())
77 return new X8664_MachoTargetObjectFile();
78 else
79 return new X86_MachoTargetObjectFile();
11980
12081 if (TM.getSubtarget().is64Bit())
12182 return new X8664_MachoTargetObjectFile();
1111 #include "X86TargetMachine.h"
1212 #include "llvm/CodeGen/MachineModuleInfoImpls.h"
1313 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCSectionMachO.h"
1415 #include "llvm/Target/Mangler.h"
1516 #include "llvm/ADT/SmallString.h"
1617 #include "llvm/Support/Dwarf.h"
1718 using namespace llvm;
1819 using namespace dwarf;
20
21 void X86_MachoTargetObjectFile::Initialize(MCContext &Ctx,
22 const TargetMachine &TM) {
23 TargetLoweringObjectFileMachO::Initialize(Ctx, TM);
24
25 // Exception Handling.
26 LSDASection = getMachOSection("__TEXT", "__gcc_except_tab", 0,
27 SectionKind::getReadOnlyWithRel());
28 }
29
30 unsigned X86_MachoTargetObjectFile::getTTypeEncoding() const {
31 return DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4;
32 }
1933
2034 const MCExpr *X8664_MachoTargetObjectFile::
2135 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
1616 namespace llvm {
1717 class X86TargetMachine;
1818
19 /// X8664_MachoTargetObjectFile - This TLOF implementation is used for
20 /// Darwin/x86-64.
21 class X8664_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
19 /// X86_MachoTargetObjectFile - This TLOF implementation is used for Darwin
20 /// x86 variants.
21 class X86_MachoTargetObjectFile : public TargetLoweringObjectFileMachO {
2222 public:
23 virtual void Initialize(MCContext &Ctx, const TargetMachine &TM);
2324
25 virtual unsigned getTTypeEncoding() const;
26 };
27
28 /// X8664_MachoTargetObjectFile - This TLOF implementation is used for Darwin
29 /// x86-64.
30 class X8664_MachoTargetObjectFile : public X86_MachoTargetObjectFile {
31 public:
2432 virtual const MCExpr *
2533 getExprForDwarfGlobalReference(const GlobalValue *GV, Mangler *Mang,
2634 MachineModuleInfo *MMI, unsigned Encoding,