X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2FLinker.c;h=2a45aac757a89cf7a70e657b39ea77f6365540e6;hb=eccb2d89eb4b34f31e8ea337d5f8673605f71665;hp=fd5c158cce5a94b3d5cf08b03b3fd77bfd9780b7;hpb=13d064aec161f478a630c693433bfc091f5e140e;p=ghc-hetmet.git diff --git a/rts/Linker.c b/rts/Linker.c index fd5c158..2a45aac 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -40,6 +40,7 @@ #include #endif +#include #include #include #include @@ -4652,8 +4653,8 @@ static int relocateSection( } IF_DEBUG(linker, - debugBelch("relocateSection: length = %d, thing = %d, baseValue = %p\n", - reloc->r_length, thing, baseValue)); + debugBelch("relocateSection: length = %d, thing = %" PRId64 ", baseValue = %p\n", + reloc->r_length, thing, (char *)baseValue)); if (type == X86_64_RELOC_GOT || type == X86_64_RELOC_GOT_LOAD) @@ -4689,9 +4690,12 @@ static int relocateSection( } else { - value = sections[reloc->r_symbolnum-1].offset - - sections[reloc->r_symbolnum-1].addr - + (uint64_t) image; + // 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));