Opened 10 years ago

Closed 9 years ago

#3791 closed bug (fixed)

SplitObjs fails on sparc with GNU ld

Reported by: duncan Owned by:
Priority: low Milestone: 7.2.1
Component: Driver Version: 6.12.1
Keywords: Cc:
Operating System: Linux Architecture: sparc
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

On Sparc, GNU ld reports the restriction that

ld: --relax and -r may not be used together

GHC call gcc with the flags

gcc -Wl,-r -Wl,-x -o Foo.o Foo_o_split/ld.script

thus instructing gcc to call ld with the -r flag.

It is gcc that supplies the -relax flag. According to gcc -dumpspecs this is gcc's default if the -mno-relax or -r flags are not supplied. Since ghc supplies gcc with -Wl,-r and not -r, then gcc does not omit the -relax flag and thus the problem occurs.

The problem could be avoided by ghc using -r instead of -Wl,-r, or by passing -mno-relax. The latter is probably preferable since -mno-relax is an official gcc flag (which has no effect on arches where -relax does nothing) whereas -r is a linker flag that gcc will pass through. Note that -mno-relax is only needed when we're using -r, indeed allowing gcc to use -relax for normal final links is an optimisation.

As a workaround users can build with SplitObjs=NO in mk/build.mk. It may also work to set SRC_HC_OPTS=-optl-mno-relax.

Change History (6)

comment:1 Changed 10 years ago by igloo

Milestone: 6.12.2

comment:2 Changed 10 years ago by igloo

Milestone: 6.12.26.12.3
Priority: lownormal

comment:3 Changed 10 years ago by igloo

Milestone: 6.12.36.14.1
Priority: normallow

comment:4 Changed 9 years ago by igloo

Milestone: 7.0.17.0.2

comment:5 Changed 9 years ago by igloo

Milestone: 7.0.27.2.1

comment:6 Changed 9 years ago by igloo

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.