summaryrefslogtreecommitdiff
path: root/driver/split
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2007-01-08 12:59:16 +0000
committerIan Lynagh <igloo@earth.li>2007-01-08 12:59:16 +0000
commitfb8d5b043f01340a70c49cee4bb9533a42beba6a (patch)
treedbbdf3f3608968ee7e2a7c4bc64005e8d7daf3da /driver/split
parent50fd26c1d32343d098774f830ffbf407be2ccaf8 (diff)
downloadhaskell-fb8d5b043f01340a70c49cee4bb9533a42beba6a.tar.gz
Have the splitter duplicate the .note.GNU-stack
Diffstat (limited to 'driver/split')
-rw-r--r--driver/split/ghc-split.lprl32
1 files changed, 18 insertions, 14 deletions
diff --git a/driver/split/ghc-split.lprl b/driver/split/ghc-split.lprl
index 4d159ec04f..d54e1b206e 100644
--- a/driver/split/ghc-split.lprl
+++ b/driver/split/ghc-split.lprl
@@ -25,6 +25,7 @@ exit(0);
\begin{code}
sub split_asm_file {
local($asm_file) = @_;
+ my @pieces = ();
open(TMPI, "< $asm_file") || &tidy_up_and_die(1,"$Pgm: failed to open `$asm_file' (to read)\n");
@@ -54,34 +55,37 @@ sub split_asm_file {
# grab and de-mangle a section of the .s file...
$s_stuff = &ReadTMPIUpToAMarker ( $_, $octr );
- $this_piece = &process_asm_block ( $s_stuff );
+ $pieces[$octr] = &process_asm_block ( $s_stuff );
+ }
- # output to a file of its own
- # open a new output file...
- $ofname = "${Tmp_prefix}__${octr}.s";
- open(OUTF, "> $ofname") || die "$Pgm: can't open output file: $ofname\n";
+ # Make sure that we still have some output when the input file is empty
+ if ($octr == 0) {
+ $octr = 1;
+ $pieces[$octr] = '';
+ }
- print OUTF $prologue_stuff;
- print OUTF $this_piece;
+ $NoOfSplitFiles = $octr;
- close(OUTF)
- || &tidy_up_and_die(1,"$Pgm:Failed writing ${Tmp_prefix}__${octr}.s\n");
+ if ($pieces[$NoOfSplitFiles] =~ /(\n[ \t]*\.section[ \t]+\.note\.GNU-stack,[^\n]*\n)/) {
+ $note_gnu_stack = $1;
+ for $octr (1..($NoOfSplitFiles - 1)) {
+ $pieces[$octr] .= $note_gnu_stack;
+ }
}
- # Make sure that we still have some output when the input file is empty
- if ( $octr == 0 ) {
- $octr = 1;
+ for $octr (1..$NoOfSplitFiles) {
+ # output to a file of its own
+ # open a new output file...
$ofname = "${Tmp_prefix}__${octr}.s";
open(OUTF, "> $ofname") || die "$Pgm: can't open output file: $ofname\n";
print OUTF $prologue_stuff;
+ print OUTF $pieces[$octr];
close(OUTF)
|| &tidy_up_and_die(1,"$Pgm:Failed writing ${Tmp_prefix}__${octr}.s\n");
}
- $NoOfSplitFiles = $octr;
-
close(TMPI) || &tidy_up_and_die(1,"Failed reading $asm_file\n");
}