From a4d4db8eb454acea7fbfa8032d46b4e3d661fd83 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 1 Jun 2009 12:12:29 -0600 Subject: [PATCH] fix cygwin/msys bootimage build --- makefile | 10 ++++++---- src/bootimage.cpp | 16 ++++++++++++---- src/machine.h | 2 +- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/makefile b/makefile index c4710d5511..59099aa323 100644 --- a/makefile +++ b/makefile @@ -14,7 +14,9 @@ build-platform = \ | sed 's/^cygwin.*$$/cygwin/') arch = $(build-arch) -platform = $(subst cygwin,windows,$(subst mingw32,windows,$(build-platform))) +bootimage-platform = \ + $(subst cygwin,windows,$(subst mingw32,windows,$(build-platform))) +platform = $(bootimage-platform) ifeq ($(platform),windows) arch = i386 @@ -273,7 +275,7 @@ bootimage-generator-sources = $(src)/bootimage.cpp bootimage-generator-objects = \ $(call cpp-objects,$(bootimage-generator-sources),$(src),$(native-build)) bootimage-generator = \ - $(build)/$(build-platform)-$(build-arch)$(options)/bootimage-generator + $(build)/$(bootimage-platform)-$(build-arch)$(options)/bootimage-generator bootimage-bin = $(native-build)/bootimage.bin bootimage-object = $(native-build)/bootimage-bin.o @@ -489,7 +491,7 @@ $(static-library): $(vm-objects) $(jni-objects) $(vm-heapwalk-objects) $(ranlib) $(@) $(bootimage-bin): $(bootimage-generator) - $(<) $(classpath-build) > $(@) + $(<) $(classpath-build) $(@) $(bootimage-object): $(bootimage-bin) $(binaryToMacho) @echo "creating $(@)" @@ -524,7 +526,7 @@ make-bootimage-generator: (unset MAKEFLAGS && \ make mode=$(mode) \ arch=$(build-arch) \ - platform=$(build-platform) \ + platform=$(bootimage-platform) \ bootimage=$(bootimage) \ heapdump=$(heapdump) \ bootimage-generator= \ diff --git a/src/bootimage.cpp b/src/bootimage.cpp index eab820af1d..2e11905ef9 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -373,8 +373,8 @@ writeBootImage(Thread* t, FILE* out, BootImage* image, uint8_t* code, int main(int ac, const char** av) { - if (ac < 2 or ac > 5) { - fprintf(stderr, "usage: %s " + if (ac < 3 or ac > 6) { + fprintf(stderr, "usage: %s " "[ [ []]]\n", av[0]); return -1; } @@ -395,9 +395,17 @@ main(int ac, const char** av) enter(t, Thread::ActiveState); enter(t, Thread::IdleState); + FILE* output = fopen(av[2], "wb"); + if (output == 0) { + fprintf(stderr, "unable to open %s\n", av[2]); + return -1; + } + writeBootImage - (t, stdout, &image, code, CodeCapacity, - (ac > 2 ? av[2] : 0), (ac > 3 ? av[3] : 0), (ac > 4 ? av[4] : 0)); + (t, output, &image, code, CodeCapacity, + (ac > 3 ? av[3] : 0), (ac > 4 ? av[4] : 0), (ac > 5 ? av[5] : 0)); + + fclose(output); if (t->exception) { printTrace(t, t->exception); diff --git a/src/machine.h b/src/machine.h index 67e2dbf071..9029811b05 100644 --- a/src/machine.h +++ b/src/machine.h @@ -1325,7 +1325,7 @@ class Thread { #endif // VM_STRESS }; -typedef uint64_t (*FastNativeFunction)(Thread*, object, uintptr_t*); +typedef uint64_t (JNICALL *FastNativeFunction)(Thread*, object, uintptr_t*); inline object objectClass(Thread*, object o)