From: Clemens Fruhwirth Date: Tue, 26 Jun 2007 13:46:36 +0000 (+0000) Subject: PprMach.hs more accurate hack for x86-64, CmmLabelOff is not a relative reference. X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=9c69ef13811c41a498ef96ce7908245318bf8679 PprMach.hs more accurate hack for x86-64, CmmLabelOff is not a relative reference. CmmLabelDiffOff are generated in .text and if printed as .quad, causes the assembler to emit a PC64 relocation. binutils prior to 2.17 don't understand PC64 relocation properly. pprDataItem is also used for printing SRT description tables. They are part of the .data section and there no PC relative relocations are emited. Hence, if we print a .long here, we get a absolute 32-bit relocation. 32-bit relocations are problematic in dynamic libraries, because dynamic library load addresses are loaded beyond the 32 bit boundary, causing the dynamic linker to warn at dynamic linking (loading the executable) that there are overflows in the relocation. The executable still seems to work because of the small memory model, but this is obviously wrong. Hence, remove CmmLabelOff from the classification, causing these references to be printed as .quad, causing correct 64-bit relocation as in the rest of the .data section. So, this hack now prints PC32 relocations in .text (mostly in the info tables), and absolute 64-bit relocations in .data. --- diff --git a/compiler/nativeGen/PprMach.hs b/compiler/nativeGen/PprMach.hs index 446495a..e7c0e97 100644 --- a/compiler/nativeGen/PprMach.hs +++ b/compiler/nativeGen/PprMach.hs @@ -770,7 +770,6 @@ pprDataItem lit | otherwise = [ptext SLIT("\t.quad\t") <> pprImm imm] where - isRelativeReloc (CmmLabelOff _ _) = True isRelativeReloc (CmmLabelDiffOff _ _ _) = True isRelativeReloc _ = False #endif