mirror of
https://github.com/corda/corda.git
synced 2025-01-16 09:50:11 +00:00
Various fixes (mostly making things more strict) to get the code to
compile on Mac OS X
This commit is contained in:
parent
8b17df5b48
commit
f430f3f00e
@ -1,6 +1,6 @@
|
|||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "zlib.h"
|
#include "zlib-custom.h"
|
||||||
|
|
||||||
#include "jni.h"
|
#include "jni.h"
|
||||||
#include "jni-util.h"
|
#include "jni-util.h"
|
||||||
|
22
makefile
22
makefile
@ -8,6 +8,19 @@ ifeq ($(arch),i686)
|
|||||||
arch = i386
|
arch = i386
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
platform = $(shell uname -s)
|
||||||
|
ifeq ($(platform),Darwin)
|
||||||
|
rdynamic =
|
||||||
|
thread-cflags =
|
||||||
|
shared = -dynamiclib
|
||||||
|
so-extension = dylib
|
||||||
|
else
|
||||||
|
rdynamic = -rdynamic
|
||||||
|
thread-cflags = -pthread
|
||||||
|
shared = -shared
|
||||||
|
so-extension = so
|
||||||
|
endif
|
||||||
|
|
||||||
mode = debug
|
mode = debug
|
||||||
|
|
||||||
bld = build/$(arch)/$(mode)
|
bld = build/$(arch)/$(mode)
|
||||||
@ -16,7 +29,7 @@ src = src
|
|||||||
classpath = classpath
|
classpath = classpath
|
||||||
test = test
|
test = test
|
||||||
|
|
||||||
input = $(cls)/GC.class
|
input = $(cls)/Hello.class
|
||||||
|
|
||||||
cxx = g++
|
cxx = g++
|
||||||
cc = gcc
|
cc = gcc
|
||||||
@ -30,7 +43,6 @@ show-size = :
|
|||||||
warnings = -Wall -Wextra -Werror -Wold-style-cast -Wunused-parameter \
|
warnings = -Wall -Wextra -Werror -Wold-style-cast -Wunused-parameter \
|
||||||
-Winit-self -Wconversion
|
-Winit-self -Wconversion
|
||||||
|
|
||||||
thread-cflags = -pthread
|
|
||||||
thread-lflags = -lpthread
|
thread-lflags = -lpthread
|
||||||
|
|
||||||
cflags = $(warnings) -fPIC -fno-rtti -fno-exceptions -fvisibility=hidden \
|
cflags = $(warnings) -fPIC -fno-rtti -fno-exceptions -fvisibility=hidden \
|
||||||
@ -63,7 +75,7 @@ stdcpp-objects = $(call cpp-objects,$(stdcpp-sources),$(src))
|
|||||||
jni-sources = $(shell find $(classpath) -name '*.cpp')
|
jni-sources = $(shell find $(classpath) -name '*.cpp')
|
||||||
jni-objects = $(call cpp-objects,$(jni-sources),$(classpath))
|
jni-objects = $(call cpp-objects,$(jni-sources),$(classpath))
|
||||||
jni-cflags = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(cflags)
|
jni-cflags = -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(cflags)
|
||||||
jni-library = $(bld)/libnatives.so
|
jni-library = $(bld)/libnatives.$(so-extension)
|
||||||
|
|
||||||
generated-code = \
|
generated-code = \
|
||||||
$(bld)/type-enums.cpp \
|
$(bld)/type-enums.cpp \
|
||||||
@ -213,11 +225,11 @@ $(jni-objects): $(bld)/%.o: $(classpath)/%.cpp
|
|||||||
|
|
||||||
$(jni-library): $(jni-objects)
|
$(jni-library): $(jni-objects)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
$(cc) $(lflags) -shared $(^) -o $(@)
|
$(cc) $(lflags) $(shared) $(^) -o $(@)
|
||||||
|
|
||||||
$(executable): $(interpreter-objects) $(stdcpp-objects)
|
$(executable): $(interpreter-objects) $(stdcpp-objects)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
$(cc) $(lflags) -rdynamic $(^) -o $(@)
|
$(cc) $(lflags) $(rdynamic) $(^) -o $(@)
|
||||||
@$(strip) --strip-all $(@)
|
@$(strip) --strip-all $(@)
|
||||||
@$(show-size) $(@)
|
@$(show-size) $(@)
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#include "builtin.h"
|
|
||||||
#include "machine.h"
|
#include "machine.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "run.h"
|
#include "run.h"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.globl cdeclCall
|
.globl _cdeclCall
|
||||||
.type cdeclCall, @function
|
//.type cdeclCall, @function
|
||||||
|
|
||||||
cdeclCall:
|
_cdeclCall:
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
movl %esp,%ebp
|
movl %esp,%ebp
|
||||||
|
|
||||||
|
@ -11,11 +11,14 @@
|
|||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
# define LD "d"
|
# define LD "d"
|
||||||
|
# define ULD "lu"
|
||||||
# define LLD "lld"
|
# define LLD "lld"
|
||||||
#elif defined __x86_64__
|
#elif defined __x86_64__
|
||||||
# define LD "ld"
|
# define LD "ld"
|
||||||
|
# define ULD "lu"
|
||||||
# define LLD "ld"
|
# define LLD "ld"
|
||||||
# define LLD "ld"
|
#else
|
||||||
|
#error "Unsupported architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_RETURN __attribute__((noreturn))
|
#define NO_RETURN __attribute__((noreturn))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "zlib.h"
|
#include "zlib-custom.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "finder.h"
|
#include "finder.h"
|
||||||
|
|
||||||
|
@ -1663,7 +1663,7 @@ inline uint32_t
|
|||||||
popInt(Thread* t)
|
popInt(Thread* t)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "pop int %"LD" at %d\n",
|
fprintf(stderr, "pop int %"ULD" at %d\n",
|
||||||
t->stack[((t->sp - 1) * 2) + 1],
|
t->stack[((t->sp - 1) * 2) + 1],
|
||||||
t->sp - 1);
|
t->sp - 1);
|
||||||
}
|
}
|
||||||
@ -1721,7 +1721,7 @@ inline uint32_t
|
|||||||
peekInt(Thread* t, unsigned index)
|
peekInt(Thread* t, unsigned index)
|
||||||
{
|
{
|
||||||
if (DebugStack) {
|
if (DebugStack) {
|
||||||
fprintf(stderr, "peek int %"LD" at %d\n",
|
fprintf(stderr, "peek int %"ULD" at %d\n",
|
||||||
t->stack[(index * 2) + 1],
|
t->stack[(index * 2) + 1],
|
||||||
index);
|
index);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ cdeclCall(void* function, void* stack, unsigned stackSize,
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
inline uint64_t
|
inline uint64_t
|
||||||
dynamicCall(void* function, uint32_t* arguments, uint8_t*,
|
dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
|
||||||
unsigned, unsigned argumentsSize, unsigned returnType)
|
unsigned, unsigned argumentsSize, unsigned returnType)
|
||||||
{
|
{
|
||||||
return cdeclCall(function, arguments, argumentsSize, returnType);
|
return cdeclCall(function, arguments, argumentsSize, returnType);
|
||||||
@ -511,7 +511,7 @@ class MySystem: public System {
|
|||||||
count -= *up;
|
count -= *up;
|
||||||
|
|
||||||
if (Verbose) {
|
if (Verbose) {
|
||||||
fprintf(stderr, "free %"LD"; count: %d; limit: %d\n",
|
fprintf(stderr, "free %"ULD"; count: %d; limit: %d\n",
|
||||||
*up, count, limit);
|
*up, count, limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
7
src/zlib-custom.h
Normal file
7
src/zlib-custom.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#include "zlib.h"
|
||||||
|
|
||||||
|
#ifdef inflateInit2
|
||||||
|
#undef inflateInit2
|
||||||
|
#define inflateInit2(strm, windowBits) \
|
||||||
|
inflateInit2_((strm), (windowBits), ZLIB_VERSION, static_cast<int>(sizeof(z_stream)))
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user