SplitObjs fails on sparc with GNU ld
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
.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | low |
Resolution | Unresolved |
Component | Driver |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |