package/gcc: Introduce BR2_GCC_TARGET_SIMD option

Introduce BR2_GCC_TARGET_SIMD for gcc to handle --with-simd/-msimd
present at loongarch's gcc options.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Jiaxun Yang
2025-06-18 19:20:26 +01:00
committed by Julien Olivain
parent 31af509b4f
commit 286f5bacd7
5 changed files with 18 additions and 0 deletions

View File

@@ -353,6 +353,12 @@ config BR2_GCC_TARGET_FPU
config BR2_GCC_TARGET_FLOAT_ABI config BR2_GCC_TARGET_FLOAT_ABI
string string
# The value of this option will be passed as --with-simd=<value> when
# building gcc (internal backend) or -simd=<value> in the toolchain
# wrapper (external toolchain)
config BR2_GCC_TARGET_SIMD
string
# The value of this option will be passed as --with-mode=<value> when # The value of this option will be passed as --with-mode=<value> when
# building gcc (internal backend) or -m<value> in the toolchain # building gcc (internal backend) or -m<value> in the toolchain
# wrapper (external toolchain) # wrapper (external toolchain)

View File

@@ -16,6 +16,7 @@ GCC_TARGET_FP32_MODE := $(call qstrip,$(BR2_GCC_TARGET_FP32_MODE))
GCC_TARGET_CPU := $(call qstrip,$(BR2_GCC_TARGET_CPU)) GCC_TARGET_CPU := $(call qstrip,$(BR2_GCC_TARGET_CPU))
GCC_TARGET_FPU := $(call qstrip,$(BR2_GCC_TARGET_FPU)) GCC_TARGET_FPU := $(call qstrip,$(BR2_GCC_TARGET_FPU))
GCC_TARGET_FLOAT_ABI := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI)) GCC_TARGET_FLOAT_ABI := $(call qstrip,$(BR2_GCC_TARGET_FLOAT_ABI))
GCC_TARGET_SIMD := $(call qstrip,$(BR2_GCC_TARGET_SIMD))
GCC_TARGET_MODE := $(call qstrip,$(BR2_GCC_TARGET_MODE)) GCC_TARGET_MODE := $(call qstrip,$(BR2_GCC_TARGET_MODE))
# Explicitly set LD's "max-page-size" instead of relying on some defaults # Explicitly set LD's "max-page-size" instead of relying on some defaults

View File

@@ -251,6 +251,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI) HOST_GCC_COMMON_CONF_OPTS += --with-float=$(GCC_TARGET_FLOAT_ABI)
endif endif
ifneq ($(GCC_TARGET_SIMD),)
HOST_GCC_COMMON_CONF_OPTS += --with-simd=$(GCC_TARGET_SIMD)
endif
ifneq ($(GCC_TARGET_MODE),) ifneq ($(GCC_TARGET_MODE),)
HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE) HOST_GCC_COMMON_CONF_OPTS += --with-mode=$(GCC_TARGET_MODE)
endif endif

View File

@@ -217,6 +217,10 @@ ifneq ($(GCC_TARGET_FLOAT_ABI),)
TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(GCC_TARGET_FLOAT_ABI) TOOLCHAIN_EXTERNAL_CFLAGS += -mfloat-abi=$(GCC_TARGET_FLOAT_ABI)
TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(GCC_TARGET_FLOAT_ABI)"' TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_FLOAT_ABI='"$(GCC_TARGET_FLOAT_ABI)"'
endif endif
ifneq ($(GCC_TARGET_SIMD),)
TOOLCHAIN_EXTERNAL_CFLAGS += -msimd=$(GCC_TARGET_SIMD)
TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_SIMD='"$(GCC_TARGET_SIMD)"'
endif
ifneq ($(GCC_TARGET_MODE),) ifneq ($(GCC_TARGET_MODE),)
TOOLCHAIN_EXTERNAL_CFLAGS += -m$(GCC_TARGET_MODE) TOOLCHAIN_EXTERNAL_CFLAGS += -m$(GCC_TARGET_MODE)
TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(GCC_TARGET_MODE)"' TOOLCHAIN_EXTERNAL_TOOLCHAIN_WRAPPER_ARGS += -DBR_MODE='"$(GCC_TARGET_MODE)"'

View File

@@ -77,6 +77,9 @@ static char *predef_args[] = {
#ifdef BR_SOFTFLOAT #ifdef BR_SOFTFLOAT
"-msoft-float", "-msoft-float",
#endif /* BR_SOFTFLOAT */ #endif /* BR_SOFTFLOAT */
#ifdef BR_SIMD
"-msimd=" BR_SIMD,
#endif
#ifdef BR_MODE #ifdef BR_MODE
"-m" BR_MODE, "-m" BR_MODE,
#endif #endif