Ticket #1105: config_fixup.patch
File config_fixup.patch, 13.1 KB (added by plobsing, 12 years ago) |
---|
-
MANIFEST
1 1 # ex: set ro: 2 2 # $Id$ 3 3 # 4 # generated by tools/dev/mk_manifest_and_skip.pl Sat Oct 17 13:02:102009 UT4 # generated by tools/dev/mk_manifest_and_skip.pl Thu Oct 22 02:09:46 2009 UT 5 5 # 6 6 # See below for documentation on the format of this file. 7 7 # … … 233 233 config/auto/env/test_unsetenv_c.in [] 234 234 config/auto/format.pm [] 235 235 config/auto/frames.pm [] 236 config/auto/frames/test_exec_cygwin_c.in []237 config/auto/frames/test_exec_linux_c.in []238 config/auto/frames/test_exec_openbsd_c.in []239 236 config/auto/gc.pm [] 240 237 config/auto/gc/test_c.in [] 241 238 config/auto/gcc.pm [] -
lib/Parrot/Distribution.pm
433 433 include/parrot/config.h 434 434 include/parrot/has_header.h 435 435 src/gc/malloc.c 436 src/frame_builder_libjit.h 437 src/frame_builder_libjit.c 436 438 } unless @exemptions; 437 439 438 440 my $path = -f $file ? $file : $file->path; -
t/steps/auto/libjit-01.t
6 6 use strict; 7 7 use warnings; 8 8 9 use Test::More tests => 40;9 use Test::More tests => 34; 10 10 use lib qw( lib t/configure/testlib ); 11 11 use Parrot::Configure; 12 12 use Parrot::Configure::Options 'process_options'; … … 105 105 106 106 my $extra_libs; 107 107 108 $conf->data->set( 'cc_build_call_frames' => undef );109 $conf->data->set( 'has_exec_protect' => undef );110 108 $conf->data->set( 'libjit_has_alloca' => undef ); 111 109 $conf->data->set( 'libs' => '' ); 112 110 … … 115 113 $conf->data->set( 'cpuarch' => 'i386' ); 116 114 117 115 auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); 118 is( $conf->data->get( 'cc_build_call_frames' ), '-DCAN_BUILD_CALL_FRAMES',119 "Got expected value for cc_build_call_frames" );120 ok( $conf->data->get( 'has_exec_protect' ), "has_exec_protect' set" );121 116 ok( $conf->data->get( 'libjit_has_alloca'), 122 117 "on i386 with libJIT, 'libjit_has_alloca' has true value" ); 123 118 is( $conf->data->get( 'libs' ), " $extra_libs", 124 119 "Got expected value for libs" ); 125 120 126 $conf->data->set( 'cc_build_call_frames' => undef );127 $conf->data->set( 'has_exec_protect' => undef );128 121 $conf->data->set( 'libjit_has_alloca' => undef ); 129 122 $conf->data->set( 'libs' => '' ); 130 123 … … 133 126 $conf->data->set( 'cpuarch' => 'ppc' ); 134 127 135 128 auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); 136 is( $conf->data->get( 'cc_build_call_frames' ), '-DCAN_BUILD_CALL_FRAMES',137 "Got expected value for cc_build_call_frames" );138 ok( $conf->data->get( 'has_exec_protect' ), "has_exec_protect' set" );139 129 ok( ! $conf->data->get( 'libjit_has_alloca'), 140 130 "on non-i386 with libJIT, 'libjit_has_alloca' has false value" ); 141 131 is( $conf->data->get( 'libs' ), " $extra_libs", 142 132 "Got expected value for libs" ); 143 133 144 $conf->data->set( 'cc_build_call_frames' => undef );145 $conf->data->set( 'has_exec_protect' => undef );146 134 $conf->data->set( 'libjit_has_alloca' => undef ); 147 135 $conf->data->set( 'libs' => '' ); 148 136 … … 150 138 $extra_libs = 'mylibs'; 151 139 152 140 auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); 153 ok( ! defined($conf->data->get( 'cc_build_call_frames' )),154 "cc_build_call_frames undefined as expected" );155 ok( ! defined($conf->data->get( 'has_exec_protect' )),156 "has_exec_protect' undefined" );157 141 ok( ! $conf->data->get( 'libjit_has_alloca'), 158 142 "without libJIT, 'libjit_has_alloca' has false value" ); 159 143 is( $conf->data->get( 'libs' ), "", -
t/steps/auto/frames-01.t
84 84 85 85 ##### _handle_call_frames_buildable() ##### 86 86 87 #$conf->data->set( nvsize => 8 );88 #$conf->data->set( cpuarch => 'i386' );89 $conf->data->set( osname => 'linux' );90 91 87 my $rv; 92 88 93 89 $can_build_call_frames = 0; … … 103 99 $conf->data->set( 'has_exec_protect' => undef ); 104 100 105 101 $can_build_call_frames = 1; 106 my $realos = $conf->data->get( 'osname' );107 $conf->data->set( 'osname' => 'foobar' );108 102 $rv = $step->_handle_can_build_call_frames( $conf, $can_build_call_frames ); 109 103 ok( $rv, "_handle_can_build_call_frames() returned true value" ); 110 104 is( $conf->data->get( 'cc_build_call_frames'), '-DCAN_BUILD_CALL_FRAMES', 111 105 "cc_build_call_frames set to expected value" ); 112 is( $conf->data->get( 'has_exec_protect' ), 0,113 "has_exec_protect is 0, as expected" );106 is( $conf->data->get( 'has_exec_protect' ), 1, 107 "has_exec_protect is 1, as expected" ); 114 108 is( $step->result(), 'yes', "Result is 'yes', as expected" ); 115 109 116 110 $conf->data->set( 'cc_build_call_frames' => undef ); 117 111 $conf->data->set( 'has_exec_protect' => undef ); 118 $conf->data->set( 'osname' => $realos );119 112 120 113 pass("Completed all tests in $0"); 121 114 -
config/auto/libjit.pm
93 93 my ($conf, $has_libjit, $extra_libs) = @_; 94 94 if ($has_libjit) { 95 95 $conf->data->set( 96 cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES',97 has_exec_protect => 1,98 96 libjit_has_alloca => ($conf->data->get('cpuarch') eq 'i386' ? '1' : '0'), 99 97 ); 100 98 $conf->data->add( ' ', libs => $extra_libs ); -
config/auto/frames.pm
55 55 my ($self, $conf, $can_build_call_frames) = @_; 56 56 if ( $can_build_call_frames ) { 57 57 $conf->data->set( 58 cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES', 58 cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES', 59 has_exec_protect => 1, 59 60 ); 60 # test for executable malloced memory61 my $osname = $conf->data->get( 'osname' );62 if ( -e "config/auto/frames/test_exec_${osname}_c.in" ) {63 $conf->cc_gen("config/auto/frames/test_exec_${osname}_c.in");64 eval { $conf->cc_build(); };65 if ($@) {66 $conf->data->set( has_exec_protect => 0 );67 }68 else {69 my $exec_protect_test = (70 $conf->cc_run(0) !~ /ok/ && $conf->cc_run(1) =~ /ok/71 );72 if ($exec_protect_test) {73 $conf->data->set( has_exec_protect => 1 );74 }75 else {76 $conf->data->set( has_exec_protect => 0 );77 }78 }79 $conf->cc_clean();80 }81 else {82 $conf->data->set( has_exec_protect => 0 );83 }84 61 $self->set_result( 'yes' ); 85 62 } 86 63 else { 87 $conf->data->set( 64 $conf->data->set(cc_build_call_frames => ''); 88 65 $self->set_result( 'no' ); 89 66 } 90 67 return 1; -
config/auto/frames/test_exec_openbsd_c.in
1 /*2 Copyright (C) 2004-2009, Parrot Foundation.3 $Id$4 5 test for exec privs6 */7 8 #include <stdio.h>9 #include <stdlib.h>10 #include <sys/mman.h>11 #include <limits.h>12 #include <errno.h>13 #include <malloc.h>14 #include <unistd.h>15 #ifndef PAGE_SIZE16 # define PAGE_SIZE sysconf(_SC_PAGESIZE)17 #endif18 19 /*20 * c equiv:21 int t() {22 return 1;23 }24 */25 26 char code[] = {27 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */28 0xC3 /* ret */29 };30 31 typedef int (*pf)(void);32 33 int34 main(int argc, char *argv[])35 {36 pf t;37 char *p;38 int rc;39 int prot = PROT_READ;40 41 if (argc != 2) {42 fprintf(stderr, "usage: test 0 | 1\n");43 exit(1);44 }45 if (atoi(argv[1]))46 prot |= PROT_EXEC;47 48 p = malloc(PAGE_SIZE);49 memcpy(p, code, sizeof (code));50 t = (pf) p;51 rc = mprotect(p, PAGE_SIZE, prot);52 if (rc) {53 fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p,54 PAGE_SIZE, PAGE_SIZE);55 perror("failure");56 }57 58 if (t() == 1)59 puts("ok");60 else61 return 1;62 63 return 0;64 }65 66 /*67 * Local variables:68 * c-file-style: "parrot"69 * End:70 * vim: expandtab shiftwidth=4:71 */ -
config/auto/frames/test_exec_linux_c.in
1 /*2 Copyright (C) 2004-2009, Parrot Foundation.3 $Id$4 5 test for exec privs6 */7 8 #include <stdio.h>9 #include <stdlib.h>10 #include <sys/mman.h>11 #include <limits.h>12 #include <errno.h>13 #include <malloc.h>14 #include <unistd.h>15 #ifndef PAGE_SIZE16 # define PAGE_SIZE getpagesize()17 #endif18 19 /*20 * c equiv:21 int t() {22 return 1;23 }24 */25 26 char code[] = {27 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */28 0xC3 /* ret */29 };30 31 typedef int (*pf)(void);32 33 int34 main(int argc, char *argv[])35 {36 pf t;37 char *p;38 int rc;39 int prot = PROT_READ;40 41 if (argc != 2) {42 fprintf(stderr, "usage: test 0 | 1\n");43 exit(1);44 }45 if (atoi(argv[1]))46 prot |= PROT_EXEC;47 48 p = memalign(PAGE_SIZE, sizeof (code));49 memcpy(p, code, sizeof (code));50 t = (pf) p;51 rc = mprotect(p, PAGE_SIZE, prot);52 if (rc) {53 fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p,54 PAGE_SIZE, PAGE_SIZE);55 perror("failure");56 }57 58 if (t() == 1)59 puts("ok");60 else61 return 1;62 63 return 0;64 }65 66 /*67 * Local variables:68 * c-file-style: "parrot"69 * End:70 * vim: expandtab shiftwidth=4:71 */ -
config/auto/frames/test_exec_cygwin_c.in
1 /*2 Copyright (C) 2008-2009, Parrot Foundation.3 $Id$4 5 test for exec privs6 */7 8 #include <stdio.h>9 #include <stdlib.h>10 #include <sys/mman.h>11 #include <limits.h>12 #include <errno.h>13 #include <malloc.h>14 #include <unistd.h>15 #include <string.h>16 #ifndef PAGE_SIZE17 # define PAGE_SIZE getpagesize()18 #endif19 #20 21 /*22 * c equiv:23 int t() {24 return 1;25 }26 */27 28 char code[] = {29 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */30 0xC3 /* ret */31 };32 33 typedef int (*pf)(void);34 35 int36 main(int argc, char *argv[])37 {38 pf t;39 char *p;40 int rc;41 int prot = PROT_READ;42 43 if (argc != 2) {44 fprintf(stderr, "usage: test 0 | 1\n");45 exit(1);46 }47 48 if (atoi(argv[1]))49 prot |= PROT_EXEC;50 51 p = memalign(PAGE_SIZE, PAGE_SIZE);52 memcpy(p, code, sizeof (code));53 54 t = (pf) p;55 rc = mprotect(p, PAGE_SIZE, prot);56 57 if (rc) {58 fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p,59 PAGE_SIZE, PAGE_SIZE);60 perror("failure");61 }62 63 if (t() == 1)64 puts("ok");65 else66 return 1;67 68 return 0;69 }70 71 /*72 * Local variables:73 * c-file-style: "parrot"74 * End:75 * vim: expandtab shiftwidth=4:76 */ -
config/gen/libjit/frame_builder_libjit_h.in
19 19 20 20 #ifdef PARROT_HAS_LIBJIT 21 21 22 # include <jit/jit.h>22 # include <jit/jit.h> 23 23 24 24 /* 25 25 * JITted function state data … … 33 33 * JIT types 34 34 */ 35 35 36 # define JIT_TYPE_UINTVAL @libjit_uv@37 # define JIT_TYPE_INTVAL @libjit_iv@38 # define JIT_TYPE_FLOATVAL @libjit_nv@36 # define JIT_TYPE_UINTVAL @libjit_uv@ 37 # define JIT_TYPE_INTVAL @libjit_iv@ 38 # define JIT_TYPE_FLOATVAL @libjit_nv@ 39 39 40 40 /* 41 41 * JIT functions … … 63 63 /* 64 64 * workaround for platforms that lack libjit alloca support 65 65 */ 66 # if @libjit_has_alloca@67 # define JIT_ALLOCA(f, n) jit_insn_alloca(f, n)68 # define JIT_ALLOCA_FREE(f, p)69 # else70 # define JIT_ALLOCA(f, n) jit__mem_sys_allocate(f, n)71 # define JIT_ALLOCA_FREE(f, p) jit__mem_sys_free(f, p)72 # endif66 # if @libjit_has_alloca@ 67 # define JIT_ALLOCA(f, n) jit_insn_alloca((f), (n)) 68 # define JIT_ALLOCA_FREE(f, p) 69 # else 70 # define JIT_ALLOCA(f, n) jit__mem_sys_allocate((f), (n)) 71 # define JIT_ALLOCA_FREE(f, p) jit__mem_sys_free((f), (p)) 72 # endif 73 73 74 74 /* 75 75 * JIT wrappers