diff --git a/contrib/llvm/lib/MC/MCObjectFileInfo.cpp b/contrib/llvm/lib/MC/MCObjectFileInfo.cpp index 9e35355d06e..72453d1b047 100644 --- a/contrib/llvm/lib/MC/MCObjectFileInfo.cpp +++ b/contrib/llvm/lib/MC/MCObjectFileInfo.cpp @@ -332,6 +332,12 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const Triple &T, bool Large) { unsigned EHSectionFlags = ELF::SHF_ALLOC; if (T.isOSSolaris() && T.getArch() != Triple::x86_64) EHSectionFlags |= ELF::SHF_WRITE; + // The Mips port of FreeBSD currently has difficulty with read only .eh_frame + // due to an old linker. Work around this for now by making it writable. + if (T.isOSFreeBSD() && + (T.getArch() == Triple::mips || T.getArch() == Triple::mipsel || + T.getArch() == Triple::mips64 || T.getArch() == Triple::mips64el)) + EHSectionFlags |= ELF::SHF_WRITE; // ELF BSSSection = Ctx->getELFSection(".bss", ELF::SHT_NOBITS, diff --git a/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp b/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp index ac6703e72f3..4057b7c7aba 100644 --- a/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp +++ b/contrib/llvm/tools/lld/ELF/SyntheticSections.cpp @@ -362,7 +362,7 @@ void BuildIdSection::writeBuildId(ArrayRef Buf) { } EhFrameSection::EhFrameSection() - : SyntheticSection(SHF_ALLOC, SHT_PROGBITS, 1, ".eh_frame") {} + : SyntheticSection(SHF_ALLOC | SHF_WRITE, SHT_PROGBITS, 1, ".eh_frame") {} // Search for an existing CIE record or create a new one. // CIE records from input object files are uniquified by their contents diff --git a/usr.bin/clang/Makefile.inc b/usr.bin/clang/Makefile.inc index ba32f0c1032..b07201b3ea6 100644 --- a/usr.bin/clang/Makefile.inc +++ b/usr.bin/clang/Makefile.inc @@ -12,4 +12,9 @@ DEBUG_FILES_CFLAGS= -gline-tables-only DEBUG_FILES_CFLAGS= -g1 .endif +.if ${MACHINE_ARCH} == "mips" +CFLAGS+= -mxgot +CXXFLAGS+= -mxgot +.endif + .include "../Makefile.inc"