Add i368-elf-gcc v5.4 crosscompiler

This commit is contained in:
2026-02-23 19:58:18 +01:00
parent 25cb90296f
commit 9c1ae77007
6 changed files with 211 additions and 74 deletions

View File

@ -1,7 +1,7 @@
# C -> WASM
WASI_ROOT := /opt/wasi-sdk
WASI_CC := ${WASI_ROOT}/bin/clang
WASI_CFLAGS := --target=wasm64 \
WASI_ROOT := /opt/wasi-sdk
WASI_CC := ${WASI_ROOT}/bin/clang
WASI_CFLAGS := --target=wasm64 \
--sysroot=${WASI_ROOT}/share/wasi-sysroot \
-z stack-size=4096 \
-O0 -g -nostdlib \
@ -12,22 +12,21 @@ WASI_CFLAGS := --target=wasm64 \
-Wl,--export=__data_end
# WASM -> Baremetal
WAMR := /opt/wamr
IWASM_LIB := /opt/wamr-libiwasm-64
CC := gcc
WAMR := /opt/wamr
IWASM_LIB := /opt/wamr-libiwasm-64
CC := gcc
# NOTE: When compiling I get "error: bp cannot be used in asm here"
# I could remove "ebp" from the clobber list (ARCH_ASM_CLOBBER_ALL) or
# use the -fomit-frame-pointer flag to tell gcc it shouldn't rely on ebp for enter/leave...
CFLAGS := -I. -O0 -g -ffunction-sections -std=c11 -fomit-frame-pointer
LDFLAGS = $^ -Wl,--build-id=none -static -nostdlib \
CFLAGS := -I. -O0 -g -ffunction-sections -std=c11 -fomit-frame-pointer
LDFLAGS = $^ -Wl,--build-id=none -static -nostdlib \
-Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm -lgcc
INCL := -I${WAMR}/core/iwasm/include \
INCL := -I${WAMR}/core/iwasm/include \
-I${WAMR}/core/shared/utils \
-I${WAMR}/core/shared/platform/baremetal
WAMRC := /opt/wamr-wamrc/wamrc
WAMRCFLAGS := --target=i386 --format=object
XXD := busybox xxd
WAMRC := /opt/wamr-wamrc/wamrc
WAMRCFLAGS := --target=i386 --format=object
XXD := busybox xxd
################################################################
# C -> WASM
@ -35,7 +34,6 @@ ${BUILD_DIR}/%/module.wasm: %.c
mkdir -p $(shell dirname $@)
${WASI_CC} ${WASI_CFLAGS} $< -o $@
################################################################
# WASM -> Native Object File
# ${BUILD_DIR}/%/system.o: ${BUILD_DIR}/%/module.wasm
@ -47,7 +45,6 @@ ${BUILD_DIR}/%/module.wasm: %.c
# ${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
# ${CC} ${LDFLAGS} -o $@
################################################################
# WASM -> AOT -> Loaded by Runtime
${BUILD_DIR}/%/module.aot: ${BUILD_DIR}/%/module.wasm
@ -62,7 +59,7 @@ ${BUILD_DIR}/%/system.o: ${BUILD_DIR}/%/module_wasm.c
-e "s/__WASM_ARRAY_FILE__/module_wasm.c/g" \
-e "s/__WASM_ARRAY__/build_linux_$*_module_aot/g" \
-e "s/__WASM_ARRAY_LEN__/build_linux_$*_module_aot_len/g" \
${BUILD_DIR}/$*/module_host.c
${BUILD_DIR}/$*/module_host.c
${CC} ${CFLAGS} ${INCL} -c ${BUILD_DIR}/$*/module_host.c -o $@
${BUILD_DIR}/startup.o: arch/bochs/startup.s
@ -71,7 +68,6 @@ ${BUILD_DIR}/startup.o: arch/bochs/startup.s
${BUILD_DIR}/%/system.elf: ${BUILD_DIR}/%/system.o ${BUILD_DIR}/startup.o
${CC} ${LDFLAGS} -o $@
define arch-make-targets
build-$1: ${BUILD_DIR}/$1/system.elf