[project @ 2002-08-28 19:28:02 by ken]
authorken <unknown>
Wed, 28 Aug 2002 19:28:02 +0000 (19:28 +0000)
committerken <unknown>
Wed, 28 Aug 2002 19:28:02 +0000 (19:28 +0000)
Further mangler changes to get ghc working with gcc 3.04 on the Alpha.
Jeff Lewis: "The compiler was sometimes emitting the $..ng label for a symbol
before the regular label.  This really confused the mangler, and it completely
scrambled the file."

ghc/driver/mangler/ghc-asm.lprl

index a0c3921..e9d6450 100644 (file)
@@ -96,8 +96,8 @@ sub init_TARGET_STUFF {
     $T_CONST_LBL    = '^\$L?C(\d+):$'; # regexp for what such a lbl looks like
     $T_POST_LBL            = ':';
 
-    $T_MOVE_DIRVS   = '^(\s*(\.align\s+\d+|\.(globl|ent)\s+\S+|\#.*|\.(file|loc)\s+\S+\s+\S+|\.text|\.r?data)\n)';
-    $T_COPY_DIRVS   = '^\s*(\#|\.(file|globl|ent|loc))';
+    $T_MOVE_DIRVS   = '^(\s*(\$.*\.\.ng:|\.align\s+\d+|\.(globl|ent)\s+\S+|\#.*|\.(file|loc)\s+\S+\s+\S+|\.text|\.r?data)\n)';
+    $T_COPY_DIRVS   = '^\s*(\$.*\.\.ng:|\#|\.(file|globl|ent|loc))';
 
     $T_hsc_cc_PAT   = '\.ascii.*\)(hsc|cc) (.*)\\\\11"\n\t\.ascii\s+"(.*)\\\\0"';
     $T_DOT_WORD            = '\.(long|quad|byte|word)';
@@ -908,16 +908,18 @@ sub mangle_asm {
        if ( $TargetPlatform =~ /^alpha-/ && $c =~ /^\t\.ent\s+(\S+)/ ) {
            $ent = $1;
            # toss all prologue stuff, except for loading gp, and the ..ng address
-           if (($p, $r) = split(/^\t\.prologue/, $c)) {
-               if (($keep, $junk) = split(/\.\.ng:/, $p)) {
-                   $keep =~ s/^\t\.frame.*\n/\t.frame \$30,0,\$26,0\n/;
-                   $keep =~ s/^\t\.(mask|fmask).*\n//g;
-                   $c = $keep . "..ng:\n";
-               } else {
-                   print STDERR "malformed code block ($ent)?\n"
-               }
-           }
-           $c .= "\t.prologue" . $r;
+           unless ($c =~ /\.ent.*\n\$.*\.\.ng:/) {
+               if (($p, $r) = split(/^\t\.prologue/, $c)) {
+                   if (($keep, $junk) = split(/\.\.ng:/, $p)) {
+                       $keep =~ s/^\t\.frame.*\n/\t.frame \$30,0,\$26,0\n/;
+                       $keep =~ s/^\t\.(mask|fmask).*\n//g;
+                       $c = $keep . "..ng:\n";
+                   } else {
+                       print STDERR "malformed code block ($ent)?\n"
+                   }
+               }
+               $c .= "\t.prologue" . $r;
+           }
        }
   
        $c =~ s/FUNNY#END#THING//;