X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fdriver%2Fmangler%2Fghc-asm.lprl;h=87dc96320ab958750ee9536c28af916a4adbb597;hb=90810d119e4442dceca8bd75a3f52acec3261e5c;hp=dd2465c49181f86a3de08f8801c693de98b6dcf1;hpb=e3d6a95f468365f25ccb6bc30cdc53c128d671e8;p=ghc-hetmet.git diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index dd2465c..87dc963 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -142,7 +142,7 @@ sub init_TARGET_STUFF { $T_create_word = "\t.word"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^i386-.*-(linuxaout|freebsd2|openbsd|nextstep3|cygwin32|mingw32)$/ ) { + } elsif ( $TargetPlatform =~ /^i386-.*-(linuxaout|freebsd2|nextstep3|cygwin32|mingw32)$/ ) { # NeXT added but not tested. CaS $T_STABBY = 1; # 1 iff .stab things (usually if a.out format) @@ -172,7 +172,7 @@ sub init_TARGET_STUFF { $T_create_word = "\t.word"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd|netbsd)$/ ) { + } elsif ( $TargetPlatform =~ /^i386-.*-(solaris2|linux|freebsd|netbsd|openbsd)$/ ) { $T_STABBY = 0; # 1 iff .stab things (usually if a.out format) $T_US = ''; # _ if symbols have an underscore on the front @@ -184,8 +184,8 @@ sub init_TARGET_STUFF { $T_X86_PRE_LLBL = '.L'; $T_X86_BADJMP = '^\tjmp\s+[^\.\*]'; - $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,\s*0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*)\n)'; - $T_COPY_DIRVS = '^\s*\.(globl|type|size)'; + $T_MOVE_DIRVS = '^(\s*(\.(p2)?align\s+\d+(,\s*0x90)?|\.globl\s+\S+|\.text|\.data|\.section\s+.*|\.type\s+.*|\.size\s+\S+\s*,\s*\d+|\.ident.*|\.local.*)\n)'; + $T_COPY_DIRVS = '^\s*\.(globl|type|size|local)'; if ( $TargetPlatform =~ /freebsd|netbsd/ ) { $T_hsc_cc_PAT = '\.ascii.*\)(hsc|cc) (.*)\\\\11"\n\t\.ascii\s+"(.*)\\\\0"'; @@ -297,7 +297,7 @@ sub init_TARGET_STUFF { $T_CONST_LBL = '^\LC\d+:'; # regexp for what such a lbl looks like $T_POST_LBL = ':'; - $T_MOVE_DIRVS = '^(\s*(\.align \d+|\.text|\.data|\.const_data|\.cstring|\.non_lazy_symbol_pointer|\.const|\.static_const|\.literal4|\.literal8|\.static_data|\.globl \S+)\n)'; + $T_MOVE_DIRVS = '^(\s*(\.align \d+|\.text|\.data|\.const_data|\.cstring|\.non_lazy_symbol_pointer|\.const|\.static_const|\.literal4|\.literal8|\.static_data|\.globl \S+|\.section .*)\n)'; $T_COPY_DIRVS = '\.(globl)'; $T_hsc_cc_PAT = '\.byte.*\)(hsc|cc) (.*)"\n\t\.byte \d+\n\t\.byte "(.*)"\n\t\.byte \d+'; @@ -317,7 +317,7 @@ sub init_TARGET_STUFF { $T_create_word = "\t.long"; #--------------------------------------------------------# - } elsif ( $TargetPlatform =~ /^sparc-.*-solaris2/ ) { + } elsif ( $TargetPlatform =~ /^sparc-.*-(solaris2|openbsd)/ ) { $T_STABBY = 0; # 1 iff .stab things (usually if a.out format) $T_US = ''; # _ if symbols have an underscore on the front @@ -371,6 +371,33 @@ sub init_TARGET_STUFF { $T_create_word = "\t.word"; #--------------------------------------------------------# + } elsif ( $TargetPlatform =~ /^sparc-.*-linux/ ) { + $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 + # Probably doesn't apply anyway + $T_CONST_LBL = '^\.LLC(\d+):$'; # regexp for what such a lbl looks like + $T_POST_LBL = ':'; + + $T_MOVE_DIRVS = '^((\s+\.align\s+\d+|\s+\.proc\s+\d+|\s+\.global\s+\S+|\.text|\.data|\.seg|\.stab.*|\.section.*|\s+\.type.*|\s+\.size.*)\n)'; + $T_COPY_DIRVS = '\.(global|globl|proc|stab)'; + + $T_hsc_cc_PAT = '\.asciz.*\)(hsc|cc) (.*)\\\\t(.*)"'; + $T_DOT_WORD = '\.(long|word|nword|xword|byte|half|short|skip|uahalf|uaword)'; + $T_DOT_GLOBAL = '^\t\.global'; + $T_HDR_literal = "\.text\n\t\.align 8\n"; + $T_HDR_misc = "\.text\n\t\.align 4\n"; + $T_HDR_data = "\.data\n\t\.align 8\n"; + $T_HDR_consist = "\.text\n"; + $T_HDR_closure = "\.data\n\t\.align 4\n"; + $T_HDR_srt = "\.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"; + $T_HDR_direct = "\.text\n\t\.align 4\n"; + $T_create_word = "\t.word"; + + #--------------------------------------------------------# } else { print STDERR "$Pgm: don't know how to mangle assembly language for: $TargetPlatform\n"; exit 1; @@ -457,12 +484,17 @@ sub mangle_asm { if ( $TargetPlatform =~ /^mips-/ && /^\t\.(globl\S+\.text|comm\t)/ ) { $EXTERN_DECLS .= $_ unless /(__DISCARD__|\b(PK_|ASSIGN_)(FLT|DBL)\b)/; - - # As a temporary solution for compiling "foreign export" declarations, - # we use global variables to pass arguments from C to STG land. - # These declarations live in the .hc file and not in the generated C - # stub file, so we let them pass through here. - } elsif ( /^\t\.comm\t__fexp_.*$/ ) { + # Treat .comm variables as data. These show up in two (known) places: + # + # - the module_registered variable used in the __stginit fragment. + # even though these are declared static and initialised, gcc 3.3 + # likes to make them .comm, presumably to save space in the + # object file. + # + # - global variables used to pass arguments from C to STG in + # a foreign export. (is this still true? --SDM) + # + } elsif ( /^\t\.comm.*$/ ) { $chk[++$i] = $_; $chkcat[$i] = 'data'; $chksymb[$i] = ''; @@ -562,15 +594,6 @@ sub mangle_asm { $vectorchk{$1} = $i; - # As a temporary solution for compiling "foreign export" declarations, - # we use global variables to pass arguments from C to STG land. - # These declarations live in the .hc file and not in the generated C - # stub file, so we let them pass through here. - } elsif ( /^[\t ]+\.comm[\t ]+__fexp_.*$/ ) { - $chk[++$i] = $_; - $chkcat[$i] = 'data'; - $chksymb[$i] = ''; - } elsif ( $TargetPlatform =~ /^i386-.*-solaris2/ && /^[A-Za-z0-9][A-Za-z0-9_]*:/ ) { # Some Solaris system headers contain function definitions (as @@ -606,22 +629,13 @@ sub mangle_asm { $chkcat[$i] = 'misc'; $chksymb[$i] = ''; - } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && /^\.picsymbol_stub/ ) - { - $chk[++$i] = $_; - $chkcat[$i] = 'dyld'; - $chksymb[$i] = ''; - } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && /^\.symbol_stub/ ) - { - $chk[++$i] = $_; - $chkcat[$i] = 'dyld'; - $chksymb[$i] = ''; - } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && /^\.lazy_symbol_pointer/ ) - { - $chk[++$i] = $_; - $chkcat[$i] = 'dyld'; - $chksymb[$i] = ''; - } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && /^\.non_lazy_symbol_pointer/ ) + } elsif ( $TargetPlatform =~ /^powerpc-apple-.*/ && ( + /^\.picsymbol_stub/ + || /^\.section __TEXT,__picsymbol_stub1,.*/ + || /^\.symbol_stub/ + || /^\.section __TEXT,__symbol_stub1,.*/ + || /^\.lazy_symbol_pointer/ + || /^\.non_lazy_symbol_pointer/ )) { $chk[++$i] = $_; $chkcat[$i] = 'dyld';