[project @ 2004-09-16 08:13:02 by stolz]
authorstolz <unknown>
Thu, 16 Sep 2004 08:13:02 +0000 (08:13 +0000)
committerstolz <unknown>
Thu, 16 Sep 2004 08:13:02 +0000 (08:13 +0000)
Collect unknown chunks in new chkcat 'unknown' which gets treated like
'misc', but isn't mangled on sparc-*-solaris2 because of function
definitions in C-headers like <pwd.h>. This shouldn't affect any
other platform since this was already a border-case.

Closes SF Bug 1012521 "getUserEntryForID dies".
Please merge.

ghc/driver/mangler/ghc-asm.lprl

index 66d68ec..20c6268 100644 (file)
@@ -615,8 +615,9 @@ sub mangle_asm {
            local($thing);
            chop($thing = $_);
            $thing =~ s/:$//;
-           print STDERR "Warning: retaining unknown function \`$thing' in output from C compiler\n"
-               unless # $KNOWN_FUNNY_THING{$thing}
+           $chk[++$i]   = $_;
+           $chksymb[$i] = '';
+           if (
                       /^${T_US}stg_.*${T_POST_LBL}$/o          # RTS internals
                    || /^${T_US}__stg_.*${T_POST_LBL}$/o        # more RTS internals
                    || /^${T_US}__fexp_.*${T_POST_LBL}$/o       # foreign export
@@ -626,10 +627,13 @@ sub mangle_asm {
                    || /^${T_US}.*_srtd${T_POST_LBL}$/o          # large bitmaps
                    || /^${T_US}.*_fast${T_POST_LBL}$/o         # primops
                    || /^${T_US}.*_closure_tbl${T_POST_LBL}$/o  # closure tables
-                    || /^_uname:/o;                            # x86/Solaris2
-           $chk[++$i]   = $_;
-           $chkcat[$i]  = 'misc';
-           $chksymb[$i] = '';
+                    || /^_uname:/o                             # x86/Solaris2
+               ) {
+                       $chkcat[$i]  = 'misc';
+                 } else {
+                       print STDERR "Warning: retaining unknown function \`$thing' in output from C compiler\n";
+                       $chkcat[$i]  = 'unknown';
+               }
 
        } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && ( 
                   /^\.picsymbol_stub/
@@ -866,9 +870,12 @@ sub mangle_asm {
 
        # On SPARCs, we don't do --- BEGIN/END ---, we just
        # toss the register-windowing save/restore/ret* instructions
-       # directly:
+       # directly unless they've been generated by function definitions in header
+       # files on Solaris:
        if ( $TargetPlatform =~ /^sparc-/ ) {
-           $c =~ s/^\t(save.*|restore.*|ret|retl)\n//g;
+           if ( ! ( $TargetPlatform =~ /solaris2$/ && $chkcat[$i] eq 'unknown' )) {
+               $c =~ s/^\t(save.*|restore.*|ret|retl)\n//g;
+           }
            # throw away PROLOGUE comments
            $c =~ s/^\t!#PROLOGUE# 0\n\t!#PROLOGUE# 1\n//;
        }
@@ -1031,7 +1038,7 @@ sub mangle_asm {
 
        next if $chkcat[$i] eq 'DONE ALREADY';
 
-       if ( $chkcat[$i] eq 'misc' ) {
+       if ( $chkcat[$i] eq 'misc' || $chkcat[$i] eq 'unknown' ) {
            if ($chk[$i] ne '') {
                print OUTASM $T_HDR_misc;
                &print_doctored($chk[$i], 0);