[commit: ghc] master: Fix #4867 (updated; corrects address calculation) (796a3b3)

Simon Marlow marlowsd at gmail.com
Wed Mar 2 16:46:41 CET 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/796a3b3637f61ae04d2f9bfdb7937cd796272f72

>---------------------------------------------------------------

commit 796a3b3637f61ae04d2f9bfdb7937cd796272f72
Author: gwright at antiope.com <unknown>
Date:   Mon Feb 14 15:09:24 2011 +0000

    Fix #4867 (updated; corrects address calculation)
    
    This is a corrected fix for ticket #4867, "ghci displays negative floats
    incorrectly".  The previous patch sometimes gave incorrect offset to values
    in the __const section of the __TEXT segment.  The new patch arranges a zero
    fixup for non-external, not-global offset table signed relocations.  This
    is apparently what is required, though documentation on this point is scarce.
    
    With this change Doubles are negated properly, because the sign bit mask
    is loaded from the correct offset.  This was tested both on HEAD and the 7.0
    branch.

>---------------------------------------------------------------

 rts/Linker.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/rts/Linker.c b/rts/Linker.c
index ee7a9c9..2a45aac 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -4690,7 +4690,12 @@ static int relocateSection(
         }
         else
         {
-	    value = relocateAddress(oc, nSections, sections, reloc->r_address);
+	    // If the relocation is not through the global offset table
+	    // or external, then set the value to the baseValue.  This
+	    // will leave displacements into the __const section
+	    // unchanged (as they ought to be).
+
+	    value = baseValue;
         }
 
         IF_DEBUG(linker, debugBelch("relocateSection: value = %p\n", (void *)value));





More information about the Cvs-ghc mailing list