clone 460385 -1 retitle -1 bug in ghc-split script causes FTBFS of haskell-opengl reassign -1 ghc6 tags -1 patch block 460385 by -1 thanks
Hi Ian, I have looked at the FTBFS of haskell-opengl and it seems ghc-split is doing something strange. I have build haskell-opengl with -keep-tmp-files and in the non-splitted assembly file I see: 5288 .section .rodata 5289 .align 4 5290 .LnLC7: 5291 .byte 0 5292 .byte 0 5293 .byte 0 5294 .byte 0 5295 .text 5296 .align 4,0x90 5297 .long 3 5298 .long 34 5299 sLsH_info: 5300 addl $16,%edi but after the splitting this has become: 635 .section .rodata 636 .align 4 637 .Ln.text 638 .align 4,0x90 639 .long 3 640 .long 34 641 sLsH_info: We see here that after splitting some of the code disappears. The splitting is done with the ghc-split perl script shipped with GHC. The ghc-split script assumes the LC7: in line 5290 is the start of a literal constant label instead of a label. Al these pieces are removed by the script and inserted a the the top of the splitted assembly files it they use the literal constant label somewhere. The script should match the all the characters from the start of the line until ':', which is in code "/^(\.?(LC\d+):\n", to make sure it is a constant but the script does NOT match the beginning of a line. This causes the script to remove parts of the assembly code as we see above. In driver/mangler/ghc-asm.lprl we find the different regular expression for T_CONST_LBL on the different architectures. * alpha: '^\$L?C(\d+):$' * hppa: '^L\$C(\d+)$' * i386-a.out: '^L\$C(\d+)$' * i386-elf: '^\.LC(\d+):$' * x86_64: '^\.LC(\d+):$' * m68k: '^LC(\d+):$' * mips: '^\$LC(\d+):$' * powerpc-apple-darwin: '^\LC\d+:' * i386-apple-darwin: '^\LC\d+:' * powerpc64: '^\.LC\d+:' * sparc: '^LC(\d+):$' All these start with the matching of the start of the line, so I think it is safe te presume the ghc-split script should do the same. Below is a patch which fixes the script and makes haskell-opengl build on i386. Greetings Arjan --- /usr/lib/ghc-6.6.1/ghc-split 2007-05-19 01:25:20.000000000 +0200 +++ ghc-split 2008-02-17 15:27:09.000000000 +0100 @@ -291,7 +291,7 @@ $str = "\.text\n\t.even\n" . $str; # remove/record any literal constants defined here - while ( $str =~ /((LC\d+):\n\t\.ascii.*\n)/ ) { + while ( $str =~ /^((LC\d+):\n\t\.ascii.*\n)/ ) { local($label) = $2; local($body) = $1; @@ -300,7 +300,7 @@ $LocalConstant{$label} = $body; - $str =~ s/LC\d+:\n\t\.ascii.*\n//; + $str =~ s/^LC\d+:\n\t\.ascii.*\n//; } # inject definitions for any local constants now used herein @@ -371,7 +371,7 @@ # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' # -- ccshan 2002-09-05] - while ( ($str =~ /(\.?(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ )) { + while ( ($str =~ /^(\.?(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ )) { local($label) = $2; local($body) = $1; local($prefix, $suffix, $*) = ($`, $', 0); @@ -409,7 +409,7 @@ # http://bugs6.perl.org/rt2/Ticket/Display.html?id=1760 and illustrated # by the seg fault of perl -e '("x\n" x 5000) =~ /(.*\n)+/' # -- ccshan 2002-09-05] - while ( ($str =~ /(\.?(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ )) { + while ( ($str =~ /^(\.?(LC\d+):\n(\t\.(ascii|string).*\n|\s*\.byte.*\n){1,100})/ )) { local($label) = $2; local($body) = $1; local($prefix, $suffix, $*) = ($`, $', 0);
signature.asc
Description: Dit berichtdeel is digitaal ondertekend