[project @ 2004-09-16 08:13:02 by stolz]
[ghc-hetmet.git] / ghc / driver / mangler / ghc-asm.lprl
index fbcd934..20c6268 100644 (file)
@@ -165,7 +165,7 @@ sub init_TARGET_STUFF {
     $T_STABBY      = 0; # 1 iff .stab things (usually if a.out format)
     $T_US          = ''; # _ if symbols have an underscore on the front
     $T_PRE_APP     = # regexp that says what comes before APP/NO_APP
-                     ($TargetPlatform =~ /-(linux|freebsd|netbsd)$/) ? '#' : '/' ;
+                     ($TargetPlatform =~ /-(linux|freebsd|netbsd|openbsd)$/) ? '#' : '/' ;
     $T_CONST_LBL    = '^\.LC(\d+):$'; # regexp for what such a lbl looks like
     $T_POST_LBL            = ':';
     $T_X86_PRE_LLBL_PAT = '\.L';
@@ -345,6 +345,7 @@ sub init_TARGET_STUFF {
     $T_HDR_data            = "\.data\n\t\.align 8\n";
     $T_HDR_rodata   = "\.text\n\t\.align 4\n";
     $T_HDR_closure  = "\.data\n\t\.align 4\n";
+    $T_HDR_info     = "\.text\n\t\.align 4\n";
     $T_HDR_entry    = "\.text\n\t\.align 4\n";
     $T_HDR_vector   = "\.text\n\t\.align 4\n";
 
@@ -494,8 +495,8 @@ sub mangle_asm {
            $chkcat[$i]  = 'data';
            $chksymb[$i] = '';
 
-       # Labels beginning "_c": these are literal strings.
-       } elsif ( /^${T_US}_c.*$/ ) {
+       # Labels ending "_str": these are literal strings.
+       } elsif ( /^${T_US}([A-Za-z0-9_]+)_str${T_POST_LBL}$/ ) {
            $chk[++$i]   = $_;
            $chkcat[$i]  = 'rodata';
            $chksymb[$i] = '';
@@ -614,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
@@ -625,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/
@@ -865,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//;
        }
@@ -1030,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);