Opened 10 years ago

Closed 10 years ago

Last modified 10 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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:

     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:

        .string "DEAD_WEAK"
.section        .rodata
        .align 8
        .type   cx_str, @object
        .size   cx_str, 26
        .string "DEAD_WEAK object entered!"
        .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 10 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 <>
  * FIX #1343: regex bug in the x86_64 mangler settings

comment:2 Changed 10 years ago by simonmar

Resolution: fixed
Status: newclosed

confirmed fixed by dcoutts.

comment:3 Changed 10 years ago by igloo

Milestone: 6.8 branch6.8.1
Note: See TracTickets for help on using tickets.