Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1343 closed bug (fixed)

HEAD build failure with assember errors about "8 byte pc-relative relocation"

Reported by: duncan Owned by:
Priority: high Milestone: 6.8.1
Component: Compiler Version: 6.7
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

When building HEAD (7/5/07) on x86-64 Gentoo Linux with binutils-2.16.1 we get an error when stage1 is compiling the rts:

../compiler/ghc-inplace -H16m -O -optc-O2 -static -I. -#include HCIncludes.h -fvia-C -dcmm-lint     -c StgMiscClosures.cmm -o StgMiscClosures.o
/tmp/ghc27655_0/ghc27655_0.s: Assembler messages:

/tmp/ghc27655_0/ghc27655_0.s:434:0:
     Error: can not do 8 byte pc-relative relocation

And 8 more errors of the same form later in the file. Looking at the generated .s file we see the offending lines are of the form:

.globl stg_DEAD_WEAK_info
        .type   stg_DEAD_WEAK_info, @object
        .size   stg_DEAD_WEAK_info, 24
        .quad   cv_str - stg_DEAD_WEAK_info    // offending line

cv_str is defined a few lines earlier in the .rodata section, while .globl stg_DEAD_WEAK_info is defined in the .text section.

In the .hc file it looked like:

static char cv_str[] = "DEAD_WEAK";

static char cx_str[] = "DEAD_WEAK object entered!";

StgWord stg_DEAD_WEAK_info[] = {
((W_)&cv_str+0), 0x400000000UL, 0x1UL
};

which became:

cv_str:
        .string "DEAD_WEAK"
.section        .rodata
        .align 8
        .type   cx_str, @object
        .size   cx_str, 26
cx_str:
        .string "DEAD_WEAK object entered!"
.text
        .align 8
.globl stg_DEAD_WEAK_info
        .type   stg_DEAD_WEAK_info, @object
        .size   stg_DEAD_WEAK_info, 24
        .quad   cv_str - stg_DEAD_WEAK_info
        .quad   17179869184
        .quad   1

It's interesting to note that this assembler output was of course generated by gcc (version 4.1.1).

(Ian asked me to mark this bug as high priorty for 6.8)

Change History (3)

comment:1 Changed 7 years ago by simonmar

Fixed, I hope. Our x86_64 system here must have a newer version of binutils that supports those 8-byte PC-relative relocations (RX86_64_PC64), so the bug was hidden, but it was a real bug.

Also I learned something, namely that later versions of binutils support RX86_64_PC64, so at some point our hacks to workaround the lack of it can go away.

Thu May 10 10:20:19 BST 2007  Simon Marlow <simonmar@microsoft.com>
  * FIX #1343: regex bug in the x86_64 mangler settings

comment:2 Changed 7 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

confirmed fixed by dcoutts.

comment:3 Changed 6 years ago by igloo

  • Milestone changed from 6.8 branch to 6.8.1
Note: See TracTickets for help on using tickets.