[PATCH] D14655: [mips] Make the .eh_frame writable on FreeBSD to work around issues in the old linker.

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 13 06:55:14 PST 2015


dsanders created this revision.
dsanders added subscribers: emaste, seanbruno, llvm-commits.

The Mips port of FreeBSD is currently using an old linker (GNU ld 2.17.50 [FreeBSD]
2007-07-03) which seems to be unable to fully support read-only .eh_frame sections.
Work around this for now by making them writeable on this target.

The linker must also be patch to support R_MIPS_PC32 as discussed in PR25176.

http://reviews.llvm.org/D14655

Files:
  lib/MC/MCObjectFileInfo.cpp

Index: lib/MC/MCObjectFileInfo.cpp
===================================================================
--- lib/MC/MCObjectFileInfo.cpp
+++ lib/MC/MCObjectFileInfo.cpp
@@ -432,6 +432,13 @@
   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,
                                   ELF::SHF_WRITE | ELF::SHF_ALLOC);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14655.40147.patch
Type: text/x-patch
Size: 796 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151113/a294c6dc/attachment.bin>


More information about the llvm-commits mailing list