From 02f8658bc75608ca491490e03109ac49e90ff02e Mon Sep 17 00:00:00 2001 From: chak Date: Sun, 22 Jul 2001 03:19:51 +0000 Subject: [PATCH] [project @ 2001-07-22 03:19:51 by chak] Solaris system headers contain function definitions (not just prototypes) for some functions; eg, stat(). WDP decided to toss (some of) them out during mangling. I think, this is wrong, as the list of these functions changes with varying Solaris releases and it makes foreign importing these functions more complicated; in particular, it broke Directory.hsc and PosixFiles on x86/Solaris. --- ghc/driver/mangler/ghc-asm.lprl | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index fb89415..ce4f018 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -569,18 +569,16 @@ sub mangle_asm { $chksymb[$i] = ''; } elsif ( $TargetPlatform =~ /^i386-.*-solaris2/ - && /^(_uname|uname|stat|fstat):/ ) { - # for some utterly bizarre reason, this platform - # likes to drop little local C routines with these names - # into each and every .o file that #includes the - # relevant system .h file. Yuck. We just don't - # tolerate them in .hc files (which we are processing - # here). If you need to call one of these things from - # Haskell, make a call to your own C wrapper, then - # put that C wrapper (which calls one of these) in a - # plain .c file. WDP 95/12 + && /^[A-Za-z0-9][A-Za-z0-9_]*:/ ) { + # Some Solaris system headers contain function definitions (as + # opposed to mere prototypes), which end up in the .hc file when + # a Haskell module foreign imports the corresponding system + # functions (most notably stat()). We put them into the text + # segment. Note that this currently does not extend to function + # names starting with an underscore. + # - chak 7/2001 $chk[++$i] = $_; - $chkcat[$i] = 'toss'; + $chkcat[$i] = 'misc'; $chksymb[$i] = $1; } elsif ( /^${T_US}[A-Za-z0-9_]/o @@ -596,7 +594,8 @@ sub mangle_asm { || /^${T_US}__fexp_.*${T_POST_LBL}$/o # foreign export || /^${T_US}__init.*${T_POST_LBL}$/o # __init || /^${T_US}.*_btm${T_POST_LBL}$/o # large bitmaps - || /^${T_US}.*_closure_tbl${T_POST_LBL}$/o; # closure tables + || /^${T_US}.*_closure_tbl${T_POST_LBL}$/o # closure tables + || /^_uname:/o; # x86/Solaris2 $chk[++$i] = $_; $chkcat[$i] = 'misc'; if ($TargetPlatform =~ /^powerpc-|^rs6000-/) -- 1.7.10.4