-
Notifications
You must be signed in to change notification settings - Fork 113
Allow JIT compilation for system emulation #521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+1,759
−285
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9cd48ea
Add "src/rv32_jit.c" into repository
vacantron e90cc11
Refactor "src/system.c" to enhence reusability
vacantron bc1a451
Allow JIT compilation for system simulation
vacantron 8d46115
CI: Add JIT system simulation test
vacantron 4ef61b8
Fix missing LLVM libraries
vacantron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -13,6 +13,8 @@ CFLAGS = -std=gnu99 $(OPT_LEVEL) -Wall -Wextra -Werror | |
CFLAGS += -Wno-unused-label | ||
CFLAGS += -include src/common.h -Isrc/ | ||
|
||
OBJS_EXT := | ||
|
||
# In the system test suite, the executable is an ELF file (e.g., MMU). | ||
# However, the Linux kernel emulation includes the Image, DT, and | ||
# root filesystem (rootfs). Therefore, the test suite needs this | ||
|
@@ -36,6 +38,10 @@ $(call set-feature, LOG_COLOR) | |
ENABLE_SYSTEM ?= 0 | ||
$(call set-feature, SYSTEM) | ||
|
||
ifeq ($(call has, SYSTEM), 1) | ||
OBJS_EXT += system.o | ||
endif | ||
|
||
# Definition that bridges: | ||
# Device Tree(initrd, memory range) | ||
# src/io.c(memory init) | ||
|
@@ -96,8 +102,6 @@ endif | |
# Disable Intel's Control-flow Enforcement Technology (CET) | ||
CFLAGS += $(CFLAGS_NO_CET) | ||
|
||
OBJS_EXT := | ||
|
||
# Integer Multiplication and Division instructions | ||
ENABLE_EXT_M ?= 1 | ||
$(call set-feature, EXT_M) | ||
|
@@ -248,7 +252,7 @@ ifeq ($(call has, JIT), 1) | |
ifeq ("$(CHECK_LLVM_LIBS)", "0") | ||
OBJS_EXT += t2c.o | ||
CFLAGS += -g $(shell $(LLVM_CONFIG) --cflags) | ||
LDFLAGS += $(shell $(LLVM_CONFIG) --libs) | ||
LDFLAGS += $(shell $(LLVM_CONFIG) --libfiles) | ||
vacantron marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else | ||
$(error No llvm-config-18 installed. Check llvm-config-18 installation in advance, or use "ENABLE_T2C=0" to disable tier-2 LLVM compiler) | ||
endif | ||
|
@@ -257,9 +261,6 @@ ifeq ($(call has, JIT), 1) | |
$(error JIT mode only supports for x64 and arm64 target currently.) | ||
endif | ||
|
||
src/rv32_jit.c: | ||
$(Q)tools/gen-jit-template.py $(CFLAGS) > $@ | ||
|
||
$(OUT)/jit.o: src/jit.c src/rv32_jit.c | ||
$(VECHO) " CC\t$@\n" | ||
$(Q)$(CC) -o $@ $(CFLAGS) -c -MMD -MF [email protected] $< | ||
|
@@ -409,9 +410,10 @@ endif | |
|
||
clean: | ||
$(VECHO) "Cleaning... " | ||
$(Q)$(RM) $(BIN) $(OBJS) $(DEV_OBJS) $(BUILD_DTB) $(BUILD_DTB2C) $(HIST_BIN) $(HIST_OBJS) $(deps) $(WEB_FILES) $(CACHE_OUT) src/rv32_jit.c | ||
$(Q)$(RM) $(BIN) $(OBJS) $(DEV_OBJS) $(BUILD_DTB) $(BUILD_DTB2C) $(HIST_BIN) $(HIST_OBJS) $(deps) $(WEB_FILES) $(CACHE_OUT) | ||
$(Q)-$(RM) $(SOFTFLOAT_LIB) | ||
$(Q)$(call notice, [OK]) | ||
|
||
distclean: clean | ||
$(VECHO) "Deleting all generated files... " | ||
$(Q)$(RM) -r $(OUT)/id1 | ||
|
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.