X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=driver%2Fsplit%2Fghc-split.lprl;h=3bdb04b4a0d2539148b006b6eff6cc535b9c9ee7;hp=4d159ec04fecb9e14a549016d443a85042b0bb38;hb=c004ec62b41aa2137b5b5e298ca562609b0de92e;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1 diff --git a/driver/split/ghc-split.lprl b/driver/split/ghc-split.lprl index 4d159ec..3bdb04b 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"); } @@ -134,7 +138,7 @@ sub collectDyldStuff_darwin { while ( 1 ) { $_ = ; - if ( $_ eq '' || /^L(_.+)\$.+:/ ) { + if ( $_ eq '' || (/^L(_.+)\$.+:/ && !(/^L(.*)\$stub_binder:/))) { if ( $label ne '' ) { $DyldChunksDefined{$label} .= $section . $alignment . $chunk_label . $ chunk; if( $section =~ s/\.data/\.non_lazy_symbol_pointer/ ) { @@ -151,7 +155,7 @@ sub collectDyldStuff_darwin { $section = $cur_section; $alignment = $cur_alignment; print STDERR "label: $label\n" if $Dump_asm_splitting_info; - } elsif ( /^\s*\.(symbol_stub|picsymbol_stub|lazy_symbol_pointer|non_lazy_symbol_pointer|data|section __IMPORT,.*)/ ) { + } elsif ( /^\s*\.(symbol_stub|picsymbol_stub|lazy_symbol_pointer|non_lazy_symbol_pointer|data|section __IMPORT,.*|section __DATA, __la_sym_ptr(2|3),lazy_symbol_pointers)/ ) { $cur_section = $_; printf STDERR "section: $cur_section\n" if $Dump_asm_splitting_info; $cur_alignment = ''