package/fluent-bit: rework wasm handling

Fluent-bit isn't very great at supporting the various architectures,
so help a little bit by defining the WAMR_BUILD_TARGET ourselves.

Two failures for MIPS while executing ./utils/test-pkg:

- sourcery-mips64:
core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f12,0($sp)'
core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips64r2 (mips64r2) `ldc1 $f14,8($sp)'
make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
make[4]: *** Waiting for unfinished jobs....

- sourcery-mips:
core/iwasm/common/arch/invokeNative_mips.s: Assembler messages:
core/iwasm/common/arch/invokeNative_mips.s:58: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f12,0($sp)'
core/iwasm/common/arch/invokeNative_mips.s:59: Error: opcode not supported on this processor: mips32r2 (mips32r2) `ldc1 $f14,8($sp)'
make[4]: *** [src/wasm/CMakeFiles/vmlib-static.dir/build.make:495: src/wasm/CMakeFiles/vmlib-static.dir/__/__/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/common/arch/invokeNative_mips.s.o] Error 1
make[4]: *** Waiting for unfinished jobs....

Which are fixed by setting the obscure flag "WAMR_BUILD_INVOKE_NATIVE_GENERAL".

See https://github.com/bytecodealliance/wasm-micro-runtime/issues/625 for more info:
“Hi, building the invokeNative_general.c explicitly is supported now, please pull the latest code and use

Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Devoogdt 2023-07-24 14:04:42 +02:00 committed by Thomas Petazzoni
parent f3597910cf
commit 9b19030f3f
2 changed files with 24 additions and 8 deletions

View File

@ -13,15 +13,21 @@ config BR2_PACKAGE_FLUENT_BIT
if BR2_PACKAGE_FLUENT_BIT
config BR2_PACKAGE_FLUENT_BIT_WASM_ARCH
string
default "AARCH64" if BR2_aarch64 || BR2_aarch64be
default "ARC" if BR2_arcle || BR2_arceb
default "ARM" if BR2_arm || BR2_armeb
default "MIPS" if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
default "RISCV32" if BR2_riscv && BR2_RISCV_32
default "RISCV64" if BR2_riscv && BR2_RISCV_64
default "X86_32" if BR2_i386
default "X86_64" if BR2_x86_64
default "XTENSA" if BR2_xtensa
config BR2_PACKAGE_FLUENT_BIT_WASM_ARCH_SUPPORTS
bool
# see lib/wasm-micro-runtime-WAMR-1.1.1/README.md#supported-architectures-and-platforms
default y if BR2_arc
default y if BR2_arm || BR2_armeb
default y if BR2_aarch64 || BR2_aarch64_be
default y if BR2_i386 || BR2_x86_64
default y if BR2_RISCV_64
default y if BR2_xtensa
default y if BR2_PACKAGE_FLUENT_BIT_WASM_ARCH != ""
config BR2_PACKAGE_FLUENT_BIT_WASM
bool "wasm runtime support"

View File

@ -23,7 +23,17 @@ FLUENT_BIT_CONF_OPTS += \
-DFLB_BACKTRACE=No
ifeq ($(BR2_PACKAGE_FLUENT_BIT_WASM),y)
FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes
FLUENT_BIT_WAMR_ARCH = $(call qstrip,$(BR2_PACKAGE_FLUENT_BIT_WASM_ARCH))
# https://github.com/bytecodealliance/wasm-micro-runtime/issues/625
# Fix unknown opcode 'ldc1', seen on mips32r2 and mips64r2.
ifeq ($(FLUENT_BIT_WAMR_ARCH),MIPS)
FLUENT_BIT_CONF_OPTS += \
-DWAMR_BUILD_INVOKE_NATIVE_GENERAL=1
endif
FLUENT_BIT_CONF_OPTS += -DFLB_WASM=Yes \
-DWAMR_BUILD_TARGET=$(FLUENT_BIT_WAMR_ARCH)
else
FLUENT_BIT_CONF_OPTS += -DFLB_WASM=No
endif