From 1856c4c75bc0c9248197be4181f0ae3c7e7e16ae Mon Sep 17 00:00:00 2001 From: wolfgang Date: Sun, 23 Jan 2005 20:34:17 +0000 Subject: [PATCH] [project @ 2005-01-23 20:34:17 by wolfgang] Distinguish between rodata and relrodata (relocatable read-only data) in the mangler. By default, use $T_HDR_rodata if $T_HDR_relrodata is not defined for a particular platform. --- ghc/driver/mangler/ghc-asm.lprl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/ghc/driver/mangler/ghc-asm.lprl b/ghc/driver/mangler/ghc-asm.lprl index 77010c8..06446e4 100644 --- a/ghc/driver/mangler/ghc-asm.lprl +++ b/ghc/driver/mangler/ghc-asm.lprl @@ -293,11 +293,12 @@ sub init_TARGET_STUFF { $T_DOT_WORD = '\.(long|short|byte|fill|space)'; $T_DOT_GLOBAL = '\.globl'; $T_HDR_toc = "\.toc\n"; - $T_HDR_literal = "\t\.const_data\n\t\.align 2\n"; + $T_HDR_literal = "\t\.const\n\t\.align 2\n"; $T_HDR_misc = "\t\.text\n\t\.align 2\n"; $T_HDR_data = "\t\.data\n\t\.align 2\n"; - $T_HDR_rodata = "\t\.const_data\n\t\.align 2\n"; - $T_HDR_closure = "\t\.const_data\n\t\.align 2\n"; + $T_HDR_rodata = "\t\.const\n\t\.align 2\n"; + $T_HDR_relrodata= "\t\.const_data\n\t\.align 2\n"; + $T_HDR_closure = "\t\.data\n\t\.align 2\n"; $T_HDR_info = "\t\.text\n\t\.align 2\n"; $T_HDR_entry = "\t\.text\n\t\.align 2\n"; $T_HDR_vector = "\t\.text\n\t\.align 2\n"; @@ -425,6 +426,12 @@ sub init_TARGET_STUFF { exit 1; } + if($T_HDR_relrodata eq "") { + # default values: + # relrodata defaults to rodata. + $T_HDR_relrodata = $T_HDR_rodata; + } + if ( 0 ) { print STDERR "T_STABBY: $T_STABBY\n"; print STDERR "T_US: $T_US\n"; @@ -670,7 +677,7 @@ sub mangle_asm { || /^${T_US}.*_closure_tbl${T_POST_LBL}$/o # closure tables ) { - $chkcat[$i] = 'rodata'; + $chkcat[$i] = 'relrodata'; } else { print STDERR "Warning: retaining unknown function \`$thing' in output from C compiler\n"; @@ -1185,7 +1192,7 @@ sub mangle_asm { # SRT if ( defined($srtchk{$symb}) ) { - print OUTASM $T_HDR_rodata; + print OUTASM $T_HDR_relrodata; print OUTASM $chk[$srtchk{$symb}]; $chkcat[$srtchk{$symb}] = 'DONE ALREADY'; } @@ -1245,7 +1252,10 @@ sub mangle_asm { print OUTASM $T_HDR_rodata; print OUTASM $chk[$i]; $chkcat[$i] = 'DONE ALREADY'; - + } elsif ( $chkcat[$i] eq 'relrodata' ) { + print OUTASM $T_HDR_relrodata; + print OUTASM $chk[$i]; + $chkcat[$i] = 'DONE ALREADY'; } elsif ( $chkcat[$i] eq 'toc' ) { # silly optimisation to print tocs, since they come in groups... print OUTASM $T_HDR_toc; -- 1.7.10.4