X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdriver%2Fmangler%2Fghc-asm.lprl;h=fb89415f257cfab82a8fa560907c6b5456577336;hb=179c48f7e17a705308ca220b4280fe61d8365ed0;hp=8e03615158a79246e3ea01dcf68b98bd6a2a8584;hpb=f5448f5c5efe0630cb865ee0d21691a23ea932d3;p=ghc-hetmet.git diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index 8e03615..fb89415 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -66,7 +66,11 @@ $ifile = $ARGV[0]; $ofile = $ARGV[1]; if ( $TargetPlatform =~ /^i386-/ ) { - $StolenX86Regs = $ARGV[2]; + if ($ARGV[2] eq '') { + $StolenX86Regs = 4; + } else { + $StolenX86Regs = $ARGV[2]; + } } &mangle_asm($ifile,$ofile); @@ -138,7 +142,7 @@ sub init_TARGET_STUFF { $T_HDR_direct = "\t.SPACE \$TEXT\$\n\t.SUBSPA \$CODE\$\n\t\.align 4\n"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^i386-.*-(linuxaout|freebsd2|netbsd|openbsd|nextstep3|cygwin32|mingw32)$/ ) { + } elsif ( $TargetPlatform =~ /^i386-.*-(linuxaout|freebsd2|openbsd|nextstep3|cygwin32|mingw32)$/ ) { # NeXT added but not tested. CaS $T_STABBY = 1; # 1 iff .stab things (usually if a.out format) @@ -169,12 +173,12 @@ sub init_TARGET_STUFF { $T_HDR_direct = "\.text\n\t\.align 2,0x90\n"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd|netbsd_elf)$/ ) { + } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd|netbsd)$/ ) { $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_elf)$/) ? '#' : '/' ; + ($TargetPlatform =~ /-(linux|freebsd|netbsd)$/) ? '#' : '/' ; $T_CONST_LBL = '^\.LC(\d+):$'; # regexp for what such a lbl looks like $T_POST_LBL = ':'; $T_X86_PRE_LLBL_PAT = '\.L'; @@ -184,7 +188,7 @@ sub init_TARGET_STUFF { $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,\s*0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.Lfe.*\n\s*\.size\s+.*|\.size\s+.*|\.ident.*)\n)'; $T_COPY_DIRVS = '\.(globl)'; - if ( $TargetPlatform =~ /freebsd|netbsd_elf/ ) { + if ( $TargetPlatform =~ /freebsd|netbsd/ ) { $T_hsc_cc_PAT = '\.ascii.*\)(hsc|cc) (.*)\\\\11"\n\t\.ascii\s+"(.*)\\\\0"'; } else { $T_hsc_cc_PAT = '\.string.*\)(hsc|cc) (.*)\\\\t(.*)"'; @@ -417,6 +421,7 @@ sub mangle_asm { $i = 0; $chkcat[0] = 'misc'; $chk[0] = ''; while () { + tr/\r//d if $TargetPlatform =~ /-mingw32$/; next if $T_STABBY && /^\.stab.*${T_US}__stg_split_marker/o; next if $T_STABBY && /^\.stab.*ghc.*c_ID/; next if /^\t\.def.*endef$/; @@ -757,18 +762,9 @@ sub mangle_asm { } else { print STDERR "$Pgm: unknown epilogue mangling? $TargetPlatform\n"; } - # HWL HACK: dont die, just print a warning - #print stderr "HWL: this should die! Epilogue junk?: $e\n" if $e =~ /^\t[^\.]/ - # && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test - # ** FIXME: - # ** chak: - # Commented this out, because it complains about junk that - # is later removed in the FUNNY#END#THING loop - but as I am - # not sure how this could ever have worked, there may be a - # better solution... - #die "Epilogue junk?: $e\n" if $e =~ /^\t[^\.\n]/ - # && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test + print "WARNING: Epilogue junk?: $e\n" if $e =~ /^\t\s*[^\.\s\n]/ + && $TargetPlatform !~ /^powerpc-/; #ToDo: remove test # glue together what's left $c = $r . $e; @@ -1093,7 +1089,7 @@ sub mangle_asm { # references to fast-entry point. # (questionable re hppa and mips...) print STDERR "still has jump to fast entry point:\n$c" - if $c =~ /${T_US}${symb}_fast/; + if $c =~ /\b${T_US}${symb}_fast/; } print OUTASM $T_HDR_entry; @@ -1265,8 +1261,7 @@ sub print_doctored { # jmp * # -# Because of Perl bug, needed separate cases for eax, ebx, ecx, edx in the past - s/^\tmovl \$${T_US}(.*),(\%e[abcd]x)\n\tjmp \*$2/\tjmp $T_US$1/g; + s/^\tmovl\s+\$${T_US}(.*),(\%e[abcd]x)\n\tjmp\s+\*\2/\tjmp $T_US$1/g; if ($StolenX86Regs <= 2 ) { # YURGH! spurious uses of esi? s/^\tmovl\s+(.*),\s*\%esi\n\tjmp\s+\*%esi\n/\tmovl $1,\%eax\n\tjmp \*\%eax\n/g;