diff options
author | David Allsopp <david.allsopp@metastack.com> | 2017-08-29 10:42:23 +0100 |
---|---|---|
committer | Mark Shinwell <mshinwell@gmail.com> | 2017-08-29 10:42:23 +0100 |
commit | 82b3cdc6ee881001755ef880f38b5606ebc889a4 (patch) | |
tree | 848ea508be618514387f0445d78401ef157d802f | |
parent | 16d54d5cf3f27ef87f1db4e449670b70bcdd7dda (diff) | |
download | ocaml-82b3cdc6ee881001755ef880f38b5606ebc889a4.tar.gz |
Restore 32bit compilation (#1295)
-rwxr-xr-x | .travis-ci.sh | 34 | ||||
-rw-r--r-- | .travis.yml | 12 | ||||
-rw-r--r-- | Changes | 8 | ||||
-rw-r--r-- | HACKING.adoc | 2 | ||||
-rw-r--r-- | appveyor_build.sh | 6 | ||||
-rw-r--r-- | byterun/caml/config.h | 4 | ||||
-rw-r--r-- | byterun/gc_ctrl.c | 8 | ||||
-rw-r--r-- | config/m-nt.h | 5 | ||||
-rw-r--r-- | yacc/main.c | 3 |
9 files changed, 53 insertions, 29 deletions
diff --git a/.travis-ci.sh b/.travis-ci.sh index 83c6488927..a3977baefc 100755 --- a/.travis-ci.sh +++ b/.travis-ci.sh @@ -41,8 +41,7 @@ case $TRAVIS_EVENT_TYPE in esac BuildAndTest () { - case $XARCH in - i386) + mkdir -p $PREFIX cat<<EOF ------------------------------------------------------------------------ This test builds the OCaml compiler distribution with your pull request @@ -53,26 +52,33 @@ critical errors that must be understood and fixed before your pull request can be merged. ------------------------------------------------------------------------ EOF - mkdir -p $PREFIX + case $XARCH in + x64) ./configure --prefix $PREFIX -with-debug-runtime \ -with-instrumented-runtime $CONFIG_ARG - export PATH=$PREFIX/bin:$PATH - $MAKE world.opt - $MAKE ocamlnat - (cd testsuite && $MAKE all) - (cd testsuite && $MAKE USE_RUNTIME="d" all) - $MAKE install - # check_all_arches checks tries to compile all backends in place, - # we need to redo (small parts of) world.opt afterwards - $MAKE check_all_arches - $MAKE world.opt - $MAKE manual-pregen + ;; + i386) + ./configure --prefix $PREFIX -with-debug-runtime \ + -with-instrumented-runtime $CONFIG_ARG \ + -host i686-pc-linux-gnu ;; *) echo unknown arch exit 1 ;; esac + + export PATH=$PREFIX/bin:$PATH + $MAKE world.opt + $MAKE ocamlnat + (cd testsuite && $MAKE all) + [ $XARCH = "i386" ] || (cd testsuite && $MAKE USE_RUNTIME="d" all) + $MAKE install + $MAKE manual-pregen + # check_all_arches checks tries to compile all backends in place, + # we would need to redo (small parts of) world.opt afterwards to + # use the compiler again + $MAKE check_all_arches } CheckChangesModified () { diff --git a/.travis.yml b/.travis.yml index 2719adcf92..6290cc9971 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,17 @@ script: bash -ex .travis-ci.sh matrix: include: - env: CI_KIND=build XARCH=i386 - - env: CI_KIND=build XARCH=i386 CONFIG_ARG=-flambda OCAMLRUNPARAM=b,v=0 + addons: + apt: + packages: + - gcc:i386 + - cpp:i386 + - binutils:i386 + - binutils-dev:i386 + - libx11-dev:i386 + - libc6-dev:i386 + - env: CI_KIND=build XARCH=x64 + - env: CI_KIND=build XARCH=x64 CONFIG_ARG=-flambda OCAMLRUNPARAM=b,v=0 - env: CI_KIND=changes - env: CI_KIND=tests allow_failures: @@ -429,10 +429,10 @@ Working version ### Runtime system: -- GPR#1070: enable gcc typechecking for caml_alloc_sprintf, caml_gc_message. - Make caml_gc_message a variadic function. Fix many caml_gc_message format - strings. - (Olivier Andrieu) +- GPR#1070, GPR#1295: enable gcc typechecking for caml_alloc_sprintf, + caml_gc_message. Make caml_gc_message a variadic function. Fix many + caml_gc_message format strings. + (Olivier Andrieu, review and 32bit fix by David Allsopp) - GPR#71: The runtime can now be shut down gracefully by means of the new caml_shutdown and caml_startup_pooled functions. The new 'c' flag in diff --git a/HACKING.adoc b/HACKING.adoc index b0216abb4e..91a68e10bc 100644 --- a/HACKING.adoc +++ b/HACKING.adoc @@ -243,7 +243,7 @@ machine, you can use the configuration values and run command taken from link:.travis.yml[]: ---- -CI_KIND=build XARCH=i386 bash -ex .travis-ci.sh +CI_KIND=build XARCH=x64 bash -ex .travis-ci.sh ---- The scripts support two other kinds of tests (values of the diff --git a/appveyor_build.sh b/appveyor_build.sh index e6272bdda1..806f260f14 100644 --- a/appveyor_build.sh +++ b/appveyor_build.sh @@ -44,7 +44,7 @@ if [[ $1 = "msvc32-only" ]] ; then PREFIX="C:/Program Files/OCaml-msmvc32" echo "Edit config/Makefile to set PREFIX=$PREFIX" - sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/\(BYTE\|NATIVE\)CCCOMPOPTS=./s/\r\?$/ -WX\0/" config/Makefile.msvc > config/Makefile + sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc > config/Makefile run "make world" make world run "make runtimeopt" make runtimeopt @@ -73,7 +73,7 @@ cp config/m-nt.h byterun/caml/m.h cp config/s-nt.h byterun/caml/s.h echo "Edit config/Makefile to set PREFIX=$PREFIX" -sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/\(BYTE\|NATIVE\)CCCOMPOPTS=./s/\r\?$/ -WX\0/" config/Makefile.msvc64 > config/Makefile +sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -WX\0/" config/Makefile.msvc64 > config/Makefile #run "Content of config/Makefile" cat config/Makefile run "make world" make world @@ -88,7 +88,7 @@ cp config/s-nt.h byterun/caml/s.h PREFIX="C:/Program Files/OCaml-mingw32" echo "Edit config/Makefile to set PREFIX=$PREFIX" -sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/\(BYTE\|NATIVE\)CCCOMPOPTS=./s/\r\?$/ -Werror\0/" config/Makefile.mingw > config/Makefile +sed -e "s|PREFIX=.*|PREFIX=$PREFIX|" -e "/^ *CFLAGS *=/s/\r\?$/ -Werror\0/" config/Makefile.mingw > config/Makefile #run "Content of config/Makefile" cat config/Makefile run "make flexdll" make flexdll diff --git a/byterun/caml/config.h b/byterun/caml/config.h index 5e6260d5c3..cee3e8bfa4 100644 --- a/byterun/caml/config.h +++ b/byterun/caml/config.h @@ -33,6 +33,10 @@ #include <stdint.h> #endif +#ifndef ARCH_SIZET_PRINTF_FORMAT +#define ARCH_SIZET_PRINTF_FORMAT "z" +#endif + /* Types for 32-bit integers, 64-bit integers, and native integers (as wide as a pointer type) */ diff --git a/byterun/gc_ctrl.c b/byterun/gc_ctrl.c index 18b4565489..1cec4a2540 100644 --- a/byterun/gc_ctrl.c +++ b/byterun/gc_ctrl.c @@ -461,7 +461,7 @@ CAMLprim value caml_gc_set(value v) newminwsz = norm_minsize (Long_val (Field (v, 0))); if (newminwsz != caml_minor_heap_wsz){ caml_gc_message (0x20, "New minor heap size: %" - ARCH_INTNAT_PRINTF_FORMAT "uk words\n", newminwsz / 1024); + ARCH_SIZET_PRINTF_FORMAT "uk words\n", newminwsz / 1024); caml_set_minor_heap_size (Bsize_wsize (newminwsz)); } CAML_INSTR_TIME (tmr, "explicit/gc_set"); @@ -603,7 +603,7 @@ void caml_init_gc (uintnat minor_size, uintnat major_size, caml_init_major_heap (major_heap_size); caml_major_window = norm_window (window); caml_gc_message (0x20, "Initial minor heap size: %" - ARCH_INTNAT_PRINTF_FORMAT "uk words\n", + ARCH_SIZET_PRINTF_FORMAT "uk words\n", caml_minor_heap_wsz / 1024); caml_gc_message (0x20, "Initial major heap size: %" ARCH_INTNAT_PRINTF_FORMAT "uk bytes\n", @@ -647,10 +647,11 @@ extern int caml_parser_trace; CAMLprim value caml_runtime_parameters (value unit) { #define F_Z ARCH_INTNAT_PRINTF_FORMAT +#define F_S ARCH_SIZET_PRINTF_FORMAT CAMLassert (unit == Val_unit); return caml_alloc_sprintf - ("a=%d,b=%d,H=%"F_Z"u,i=%"F_Z"u,l=%"F_Z"u,o=%"F_Z"u,O=%"F_Z"u,p=%d,s=%"F_Z"u,t=%"F_Z"u,v=%"F_Z"u,w=%d,W=%"F_Z"u", + ("a=%d,b=%d,H=%"F_Z"u,i=%"F_Z"u,l=%"F_Z"u,o=%"F_Z"u,O=%"F_Z"u,p=%d,s=%"F_S"u,t=%"F_Z"u,v=%"F_Z"u,w=%d,W=%"F_Z"u", /* a */ (int) caml_allocation_policy, /* b */ caml_backtrace_active, /* h */ /* missing */ /* FIXME add when changed to min_heap_size */ @@ -672,6 +673,7 @@ CAMLprim value caml_runtime_parameters (value unit) /* W */ caml_runtime_warnings ); #undef F_Z +#undef F_S } /* Control runtime warnings */ diff --git a/config/m-nt.h b/config/m-nt.h index 56a50feb79..8d46abc509 100644 --- a/config/m-nt.h +++ b/config/m-nt.h @@ -41,6 +41,11 @@ #define ARCH_UINT64_TYPE unsigned __int64 #endif #define ARCH_INT64_PRINTF_FORMAT "I64" +#if _MSC_VER >= 1800 +#define ARCH_SIZET_PRINTF_FORMAT "z" +#else +#define ARCH_SIZET_PRINTF_FORMAT "I" +#endif #if defined(_MSC_VER) && !defined(__cplusplus) #define inline __inline diff --git a/yacc/main.c b/yacc/main.c index ee5cb53b6f..9bb3786184 100644 --- a/yacc/main.c +++ b/yacc/main.c @@ -100,9 +100,6 @@ char *nullable; #if !defined(HAS_MKSTEMP) extern char *mktemp(char *); #endif -#ifdef _WIN32 -extern char *getenv(const char *); -#endif void done(int k) |