};
}
+// Specify if we should encode the LSDA pointer in the FDE as 4- or 8-bytes.
+namespace DwarfLSDAEncoding {
+ enum Encoding {
+ Default,
+ FourByte,
+ EightByte
+ };
+}
//===----------------------------------------------------------------------===//
///
/// is false.
static void setAsmVerbosityDefault(bool);
+ /// getLSDAEncoding - Returns the LSDA pointer encoding. The choices are
+ /// 4-byte, 8-byte, and target default.
+ virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const {
+ return DwarfLSDAEncoding::Default;
+ }
+
/// CodeGenFileType - These enums are meant to be passed into
/// addPassesToEmitFile to indicate what type of file to emit.
enum CodeGenFileType {
if (MMI->getPersonalities()[0] != NULL) {
bool is4Byte = TD->getPointerSize() == sizeof(int32_t);
- Asm->EmitULEB128Bytes(is4Byte ? 4 : 8);
- Asm->EOL("Augmentation size");
+ if (Asm->TM.getLSDAEncoding() == DwarfLSDAEncoding::FourByte) {
+ Asm->EmitULEB128Bytes(4);
+ Asm->EOL("Augmentation size");
- if (EHFrameInfo.hasLandingPads)
- EmitReference("exception", EHFrameInfo.Number, true, false);
- else {
- if (is4Byte)
- Asm->EmitInt32((int)0);
+ if (EHFrameInfo.hasLandingPads)
+ EmitReference("exception", EHFrameInfo.Number, true, true);
else
- Asm->EmitInt64((int)0);
+ Asm->EmitInt32((int)0);
+ } else {
+ Asm->EmitULEB128Bytes(is4Byte ? 4 : 8);
+ Asm->EOL("Augmentation size");
+
+ if (EHFrameInfo.hasLandingPads) {
+ EmitReference("exception", EHFrameInfo.Number, true, false);
+ } else {
+ if (is4Byte)
+ Asm->EmitInt32((int)0);
+ else
+ Asm->EmitInt64((int)0);
+ }
}
+
Asm->EOL("Language Specific Data Area");
} else {
Asm->EmitULEB128Bytes(0);
else
setCodeModel(CodeModel::Small);
}
+
+DwarfLSDAEncoding::Encoding X86TargetMachine::getLSDAEncoding() const {
+ if (Subtarget.isTargetDarwin() && Subtarget.getDarwinVers() > 10)
+ return DwarfLSDAEncoding::FourByte;
+
+ return DwarfLSDAEncoding::Default;
+}
return Subtarget.isTargetELF() ? &ELFWriterInfo : 0;
}
+ virtual DwarfLSDAEncoding::Encoding getLSDAEncoding() const;
+
// Set up the pass pipeline.
virtual bool addInstSelector(PassManagerBase &PM, CodeGenOpt::Level OptLevel);
virtual bool addPreRegAlloc(PassManagerBase &PM, CodeGenOpt::Level OptLevel);