From: Clemens Fruhwirth Date: Wed, 27 Jun 2007 16:06:40 +0000 (+0000) Subject: Generate RelocatableReadOnlyData as .data X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=8cce5c2e09f2a1b7b443cdef0ede5593cc6e7f60 Generate RelocatableReadOnlyData as .data The GNU linker expects read-only sections to be relocation free. Presumably because the dynamic linker maps all read-only sections as read-only mmaps and hence can't do relocations. If we want text-relocation-free shared libraries we have to put all relocations into writable sections, hence .data. See http://www.mail-archive.com/cvs-all@haskell.org/msg15119.html --- diff --git a/compiler/nativeGen/PprMach.hs b/compiler/nativeGen/PprMach.hs index e7c0e97..29cd23e 100644 --- a/compiler/nativeGen/PprMach.hs +++ b/compiler/nativeGen/PprMach.hs @@ -646,9 +646,9 @@ pprSectionHeader RelocatableReadOnlyData IF_ARCH_alpha(SLIT("\t.data\n\t.align 3") ,IF_ARCH_sparc(SLIT(".data\n\t.align 8") {-<8 will break double constants -} ,IF_ARCH_i386(IF_OS_darwin(SLIT(".const_data\n.align 2"), - SLIT(".section .rodata\n\t.align 4")) + SLIT(".section .data\n\t.align 4")) ,IF_ARCH_x86_64(IF_OS_darwin(SLIT(".const_data\n.align 3"), - SLIT(".section .rodata\n\t.align 8")) + SLIT(".section .data\n\t.align 8")) ,IF_ARCH_powerpc(IF_OS_darwin(SLIT(".const_data\n.align 2"), SLIT(".data\n\t.align 2")) ,)))))