# New Ticket Created by Andy Dougherty # Please include the string: [perl #18006] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=18006 >
The following patch splits the stack-direction-detection test into 3 separate files. Without this patch, Configure.pl gets the stack direction wrong for the TenDRA tcc compiler. On the galactic-tcc tinderbox, for example, this results in a test failure for every test that ends up calling dod.c:trace_system_stack(). With this patch, Configure.pl should get the stack direction correct, and tcc ought to work. On Solaris, all tests that passed before this patch also pass after it. This patch adds three new files to the distribution: config/auto/stackdir/test[012]_c.in, and removes one old file: config/auto/stackdir/test_c.in. I've updated MANIFEST accordingly, but don't know how to do that in CVS directly. This patch also revises config/auto/stackdir.pl. I tend to think the steps in there ought to be folded back into Configure::Step somehow, but I also think this will do for now. This patch ought to be harmless. I'd appreciate it if someone else could give it a try, and, if it works, go ahead and commit it. diff -N -r -u parrot-orig/MANIFEST parrot-andy/MANIFEST --- parrot-orig/MANIFEST Wed Oct 16 16:32:14 2002 +++ parrot-andy/MANIFEST Fri Oct 18 14:58:37 2002 @@ -58,7 +58,9 @@ config/auto/sizes.pl config/auto/sizes/test_c.in config/auto/stackdir.pl -config/auto/stackdir/test_c.in +config/auto/stackdir/test0_c.in +config/auto/stackdir/test1_c.in +config/auto/stackdir/test2_c.in config/gen/config_h.pl config/gen/config_h/config_h.in config/gen/config_pm.pl diff -N -r -u parrot-orig/config/auto/stackdir/test0_c.in parrot-andy/config/auto/stackdir/test0_c.in --- parrot-orig/config/auto/stackdir/test0_c.in Wed Dec 31 19:00:00 1969 +++ parrot-andy/config/auto/stackdir/test0_c.in Fri Oct 18 14:57:54 2002 @@ -0,0 +1,20 @@ +/* + * test.c - figure out some Configure settings + * + * This file is automatically generated by Configure + * from test_c.in. + */ + +/* This stack-direction test is broken up into three separate files. + Otherwise, the tcc compiler ends up getting the stack direction wrong. +*/ +#include <stdio.h> + +void probe_stack_bottom(int *stack_top); +void probe_stack_top(void); + +int main(int argc, char **argv) { + probe_stack_top(); + return 0; +} + diff -N -r -u parrot-orig/config/auto/stackdir/test1_c.in parrot-andy/config/auto/stackdir/test1_c.in --- parrot-orig/config/auto/stackdir/test1_c.in Wed Dec 31 19:00:00 1969 +++ parrot-andy/config/auto/stackdir/test1_c.in Fri Oct 18 14:57:54 2002 @@ -0,0 +1,16 @@ +/* + * test.c - figure out some Configure settings + * + * This file is automatically generated by Configure + * from test_c.in. + */ + +#include <stdio.h> + +void probe_stack_bottom(int *stack_top); +void probe_stack_top(void); + +void probe_stack_top(void){ + int stack_top = 1; + probe_stack_bottom(&stack_top); +} diff -N -r -u parrot-orig/config/auto/stackdir/test2_c.in parrot-andy/config/auto/stackdir/test2_c.in --- parrot-orig/config/auto/stackdir/test2_c.in Wed Dec 31 19:00:00 1969 +++ parrot-andy/config/auto/stackdir/test2_c.in Fri Oct 18 14:57:54 2002 @@ -0,0 +1,17 @@ +/* + * test.c - figure out some Configure settings + * + * This file is automatically generated by Configure + * from test_c.in. + */ + +#include <stdio.h> + +void probe_stack_bottom(int *stack_top); +void probe_stack_top(void); + +void probe_stack_bottom(int *stack_top){ + int stack_bottom = 1; + + printf("(\tstackdir => %d);", (stack_top - &stack_bottom) > 0 ? -1 : 1); +} diff -N -r -u parrot-orig/config/auto/stackdir/test_c.in parrot-andy/config/auto/stackdir/test_c.in --- parrot-orig/config/auto/stackdir/test_c.in Sat Aug 17 23:36:25 2002 +++ parrot-andy/config/auto/stackdir/test_c.in Wed Dec 31 19:00:00 1969 @@ -1,25 +0,0 @@ -/* - * test.c - figure out some Configure settings - * - * This file is automatically generated by Configure - * from test_c.in. - */ - -#include <stdio.h> - -void probe_stack_bottom(int *stack_top){ - int stack_bottom = 1; - - printf("(\tstackdir => %d);", (stack_top - &stack_bottom) > 0 ? -1 : 1); -} - -void probe_stack_top(void){ - int stack_top = 1; - probe_stack_bottom(&stack_top); -} - -int main(int argc, char **argv) { - probe_stack_top(); - return 0; -} - diff -N -r -u parrot-orig/config/auto/stackdir.pl parrot-andy/config/auto/stackdir.pl --- parrot-orig/config/auto/stackdir.pl Sat Aug 17 23:35:54 2002 +++ parrot-andy/config/auto/stackdir.pl Fri Oct 18 15:01:48 2002 @@ -2,18 +2,41 @@ use strict; use vars qw($description @args); -use Parrot::Configure::Step ':auto'; +use Parrot::Configure::Step qw(:auto :gen); $description = "Determining stack growth direction..."; @args=qw(miniparrot); sub runstep { + my $redir_err = (($ENV{COMSPEC} || "")=~ /command\.com/i) ? "" : "2>&1"; + + # Special steps are needed because we want to compile and link + # three object files together. This sort of thing ought to get + # folded back into Configure.pl. + genfile('config/auto/stackdir/test0_c.in', 'test0.c'); + genfile('config/auto/stackdir/test1_c.in', 'test1.c'); + genfile('config/auto/stackdir/test2_c.in', 'test2.c'); + + my($cc, $ccflags, $ldout, $o, $link, $linkflags, + $cc_exe_out, $exe, $libs) = + Configure::Data->get( qw(cc ccflags ld_out o link linkflags + cc_exe_out exe libs) ); + + system("$cc $ccflags -I./include -c test0.c >test0.cco $redir_err") and + die "C compiler failed (see test0.cco)"; + system("$cc $ccflags -I./include -c test1.c >test1.cco $redir_err") and + die "C compiler failed (see test1.cco)"; + system("$cc $ccflags -I./include -c test2.c >test2.cco $redir_err") and + die "C compiler failed (see test2.cco)"; + system("$link $linkflags ${cc_exe_out}test$exe test0$o test1$o test2$o $libs +>test.ldo $redir_err") and + die "Linker failed (see test.ldo)"; - cc_gen('config/auto/stackdir/test_c.in'); - cc_build(); my %results=eval cc_run(); cc_clean(); + unlink glob "test0.*"; + unlink glob "test1.*"; + unlink glob "test2.*"; for(keys %results) { Configure::Data->set($_ => $results{$_}); -- Andy Dougherty [EMAIL PROTECTED]