[mips] Set Personality and LSDA encoding for FreeBSD
Reviewers: seanbruno, sdardis
Subscribers: tberghammer, danalbert, srhines, dsanders, sdardis, llvm-commits, seanbruno
Differential Revision: https://reviews.llvm.org/D23113
llvm-svn: 277732
diff --git a/llvm/lib/MC/MCObjectFileInfo.cpp b/llvm/lib/MC/MCObjectFileInfo.cpp
index d05bcea..bbf6123 100644
--- a/llvm/lib/MC/MCObjectFileInfo.cpp
+++ b/llvm/lib/MC/MCObjectFileInfo.cpp
@@ -395,6 +395,14 @@
dwarf::DW_EH_PE_sdata4;
// We don't support PC-relative LSDA references in GAS so we use the default
// DW_EH_PE_absptr for those.
+
+ // FreeBSD must be explicit about the data size and using pcrel since it's
+ // assembler/linker won't do the automatic conversion that the Linux tools
+ // do.
+ if (T.isOSFreeBSD()) {
+ PersonalityEncoding |= dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
+ LSDAEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4;
+ }
break;
case Triple::ppc64:
case Triple::ppc64le: