-
-
Notifications
You must be signed in to change notification settings - Fork 603
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aarch64: make java-base and related modules compile
This patch does more than what the title suggests and ideally should be split in at least 2 parts. But it would require substantial amount of work to untangle those and more importantly re-test at this point. So firstly, this patch modifies makefiles and module.py files of java related modules and others like golang that include modules/java-base/common.gmk to make it possible to build on aarch64 host. It achieves it mostly by including modules/common.gmk which provides necessary rules for compiling on both x64 and aarch64 hosts as well as cross-compiling aarch64 on x64 host. This also removes a lot of repeated boiler plate and makes many changed makefiles more consistent with each other. Finally all build artifacts like object files are output to ./build/<release|debug>.[arch]/modules/[module] directories instead of modules/[module]. Secondly, this patch also modifies the build process to dynamically determine which jdk to use and which java tests to run. Therefore new version of modules/java/module.py detects which version of java (8 or 9 and above) is in the PATH and accordingly selects openjdk8-from-host or openjdk9_1x-from-host. In addition, we also make java-tests makefile generate list of java tests to be executed when test.py is run. This is necessary because our java "wrapper" mechanism is no longer compatible with Java 9 and above and we need to filter out java-isolated and java-non-isolated tests. New version of test.py simply reads list of java tests to be executed from modules/java-tests/test_commands, generated during build time. Signed-off-by: Waldemar Kozaczuk <[email protected]> Message-Id: <[email protected]>
- Loading branch information
Showing
27 changed files
with
293 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,29 @@ | ||
SRC = $(shell readlink -f ../..) | ||
include $(SRC)/modules/java-base/common.gmk | ||
include ../common.gmk | ||
|
||
autodepend = -MD -MT $@ -MP | ||
CXXFLAGS = -g -rdynamic -Wall -std=c++11 -fPIC $(INCLUDES) $(autodepend) | ||
module_out := $(out)/modules/golang | ||
|
||
CXXFLAGS = -g -rdynamic -Wall -std=c++11 -fPIC $(COMMON) | ||
|
||
# the build target executable: | ||
TARGET = go | ||
CPP_FILES := $(TARGET).cc | ||
OBJ_FILES := $(addprefix obj/,$(CPP_FILES:.cc=.o)) | ||
OBJ_FILES := $(addprefix $(module_out)/,$(CPP_FILES:.cc=.o)) | ||
DEPS := $(OBJ_FILES:.o=.d) | ||
|
||
quiet = $(if $V, $1, @echo " $2"; $1) | ||
very-quiet = $(if $V, $1, @$1) | ||
|
||
$(TARGET).so: $(OBJ_FILES) | ||
$(call quiet, $(CXX) $(CXXFLAGS) -shared -o $(TARGET).so $^ $(LIBS), LINK $@) | ||
$(module_out)/$(TARGET).so: $(OBJ_FILES) | ||
$(call quiet, $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $(module_out)/$(TARGET).so $^ $(LIBS), LINK $@) | ||
|
||
obj/%.o: %.cc | ||
$(module_out)/%.o: %.cc | ||
$(call quiet, $(CXX) $(CXXFLAGS) -c -o $@ $<, CXX $@) | ||
|
||
init: | ||
@echo " MKDIRS" | ||
$(call very-quiet, mkdir -p obj) | ||
$(call very-quiet, mkdir -p $(module_out)) | ||
.PHONY: init | ||
|
||
module: init $(TARGET).so | ||
echo '/go.so: $${MODULE_DIR}/go.so' > usr.manifest | ||
module: init $(module_out)/$(TARGET).so | ||
echo '/go.so: ./modules/golang/go.so' > usr.manifest | ||
|
||
clean: | ||
rm -f $(TARGET)*.so usr.manifest | ||
$(call very-quiet, $(RM) -rf obj) | ||
$(call very-quiet, $(RM) -rf $(module_out)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr.manifest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
include ../common.gmk | ||
|
||
module_out := $(out)/modules/java-base | ||
export module_out | ||
|
||
include common.gmk | ||
|
||
ifeq ($(arch),aarch64) | ||
java-targets := | ||
else | ||
java-targets := obj/jni/monitor.so obj/jvm/jni_helpers.o obj/jvm/java_api.o obj/balloon/jvm_balloon.o | ||
endif | ||
java-targets := $(module_out)/jni/monitor.so $(module_out)/jvm/jni_helpers.o $(module_out)/jvm/java_api.o $(module_out)/balloon/jvm_balloon.o | ||
|
||
module: all | ||
|
||
all: $(init) $(java-targets) | ||
|
||
init: | ||
@echo " MKDIRS" | ||
$(call very-quiet, mkdir -p obj/jni) | ||
$(call very-quiet, mkdir -p obj/jvm) | ||
$(call very-quiet, mkdir -p obj/balloon) | ||
$(call very-quiet, mkdir -p $(module_out)/jni) | ||
$(call very-quiet, mkdir -p $(module_out)/jvm) | ||
$(call very-quiet, mkdir -p $(module_out)/balloon) | ||
.PHONY: init | ||
|
||
clean: | ||
$(call very-quiet, $(RM) -rf obj) | ||
$(call very-quiet, $(RM) -rf $(module_out)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,29 @@ | ||
jdkbase = $(dir $(shell readlink -f $$(which javac)))/.. | ||
|
||
INCLUDES = -I$(src)/arch/$(arch) -I$(src) -I$(src)/include -I$(src)/arch/common | ||
INCLUDES += -I$(src)/include/glibc-compat | ||
INCLUDES += $(shell $(CXX) -E -xc++ - -v </dev/null 2>&1 | awk '/^End/ {exit} /^ .*c\+\+/ {print "-isystem" $$0}') | ||
INCLUDES += -isystem $(src)/include/api | ||
INCLUDES += -isystem $(src)/include/api/$(arch) | ||
INCLUDES += -I$(src)/build/$(mode)/gen/include | ||
INCLUDES += -I$(src)/java | ||
INCLUDES += -I$(jdkbase)/include -I$(jdkbase)/include/linux | ||
|
||
autodepend = -MD -MT $@ -MP | ||
COMMON_FLAGS = -g -Wall -fPIC $(INCLUDES) -O2 $(autodepend) -DCONF_debug_memory=0 -D_KERNEL | ||
CXXFLAGS = -std=c++11 $(COMMON_FLAGS) | ||
CFLAGS = -std=gnu99 $(COMMON_FLAGS) | ||
COMMON += -g -Wall -fPIC -O2 -DCONF_debug_memory=0 -D_KERNEL | ||
|
||
src = $(shell readlink -f ../..) | ||
java-base-path := $(src)/modules/java-base | ||
|
||
RM := /bin/rm | ||
CXXFLAGS = -std=c++11 $(COMMON) | ||
CFLAGS = -std=gnu99 $(COMMON) | ||
|
||
ifndef arch | ||
arch = x64 | ||
endif | ||
java-base-path := $(src)/modules/java-base | ||
|
||
ifndef mode | ||
mode = release | ||
endif | ||
javac_exe_path = $(shell realpath $$(which javac)) | ||
javac_bin_path = $(shell dirname $(javac_exe_path)) | ||
java_jdk_path = $(shell dirname $(javac_bin_path)) | ||
|
||
configuration-defines = conf-preempt conf-debug_memory conf-logger_debug | ||
|
||
configuration = $(foreach cf,$(configuration-defines), \ | ||
-D$(cf:conf-%=CONF_%)=$($(cf))) | ||
|
||
quiet = $(if $V, $1, @echo " $2"; $1) | ||
very-quiet = $(if $V, $1, @$1) | ||
|
||
obj/%.o: %.cc | init | ||
$(module_out)/%.o: %.cc | init | ||
$(call quiet, $(CXX) $(CXXFLAGS) -c -MMD -o $@ $<, CXX $@) | ||
|
||
obj/%.o: %.c | init | ||
$(module_out)/%.o: %.c | init | ||
$(call quiet, $(CC) $(CFLAGS) -c -MMD -o $@ $<, CC $@) | ||
|
||
%.so: %.o | ||
$(call quiet, $(CXX) $(CXXFLAGS) -shared -o $@ $^, LINK $@) | ||
$(module_out)/%.so: %.o | init | ||
$(call quiet, $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -o $@ $^, LINK $@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.