patch applied (nhc98): Fixed ARCH confusion

Thu Mar 1 04:03:30 PST 2007 sven.panne@aedion.de * Fixed ARCH confusion When ghc_floats.c is compiled, we do *not* use ARCH flags like -m32, because this code is linked to code compiled by GHC, which uses the native ABI. The correct way to compile ghc_floats.c would be using GHC itself, because then ABI compability is guaranteed. Due to my limited knowledge of nhc98's build system, I leave this to Malcolm... M ./src/compiler98/Makefile -1 +1

Thu Mar 1 04:03:30 PST 2007 sven.panne@aedion.de * Fixed ARCH confusion
When ghc_floats.c is compiled, we do *not* use ARCH flags like -m32, because this code is linked to code compiled by GHC, which uses the native ABI.
*Nod*.
The correct way to compile ghc_floats.c would be using GHC itself, because then ABI compability is guaranteed. Due to my limited knowledge of nhc98's build system, I leave this to Malcolm...
That would make sense. Regards, Malcolm

On Thursday 01 March 2007 14:58, Malcolm Wallace wrote:
[...]
The correct way to compile ghc_floats.c would be using GHC itself, because then ABI compability is guaranteed. Due to my limited knowledge of nhc98's build system, I leave this to Malcolm...
That would make sense.
OK, with all the recent changes I get quite far, but only because I have a local modification of the nhc98 script: When processing a *.gc file, it uses "ld -r" to partially link together the C part and the Haskell part. To make this work in the presence of the -m32 hack, one has to add " -melf_i386" to the "ld -r" lines, telling ld to use the elf_i386 emulation. Other platforms will of course need other emulations. I am not sure how to fix this in a portable way, perhaps one can use "gcc -m32" somehow for this partial linking step? Hmmm, ideas would be highly welcome... Cheers, S.

Sven Panne
OK, with all the recent changes I get quite far, but only because I have a local modification of the nhc98 script: When processing a *.gc file, it uses "ld -r" to partially link together the C part and the Haskell part.
Since $LD is already defined to equal $CC, I'm thinking to replace ld -r ... with $LD -Wl,-r ... Regards, Malcolm

On Thursday 01 March 2007 17:15, Malcolm Wallace wrote:
Since $LD is already defined to equal $CC, I'm thinking to replace ld -r ... with $LD -Wl,-r ...
I've just experimented a bit, but only with partial success: When gcc is called with the -m32 option, it passes the correct emulation option to the linker, so this part works. What doesn't work: gcc is not aware that we only want to do a partial linking, despite of the -Wl,r option, and tries to link things like -lc, -lgcc, ... :-( Is this partial linking really necessary? Or can the driver script be adapted to handle 2 .o files explicitly when dealing with *.gc files? This might be a cleaner solution. Cheers, S.

Sven Panne
On Thursday 01 March 2007 17:15, Malcolm Wallace wrote:
Since $LD is already defined to equal $CC, I'm thinking to replace ld -r ... with $LD -Wl,-r ...
What doesn't work: gcc is not aware that we only want to do a partial linking, despite of the -Wl,r option, and tries to link things like -lc, -lgcc, ... :-(
Hmm. How about telling gcc -nostdlib and/or -nodefaultlibs?
Is this partial linking really necessary? Or can the driver script be adapted to handle 2 .o files explicitly when dealing with *.gc files?
I can't remember exactly why the partial linking was introduced, but have a feeling it was to make things cleaner, not dirtier. :-) Possibly because hmake only needs to look for one object file. Or possibly because the ghc version of greencard only generated a single object. Regards, Malcolm
participants (3)
-
Malcolm Wallace
-
Sven Panne
-
Sven Panne