[Buildroot] [PATCH v4] package/coremark: use USE_PTHREAD when possible, allow custom CFLAGS
Andreas Ziegler
br025 at umbiko.net
Thu Mar 12 07:11:06 UTC 2026
Hi Jimmy, ALL
Sorry for another iteration :-(
On 2026-03-11 17:33, Jimmy Durand Wesolowski wrote:
> This passes -DUSE_PTHREAD to coremark CFLAGS
> BR2_TOOLCHAIN_HAS_THREAD is set, and allows passing any additional
> custom
> ones defined in the Buildroot configuration.
>
> Signed-off-by: Jimmy Durand Wesolowski <jimmy.wesolowski at mobileye.com>
>
> ---
> Changes v1 -> v2:
> - do not add mips-i6500 through a patch, but copy it through rsync
> in POST_EXTRACT_HOOKS (suggested by
> Andreas Ziegler <br025 at umbiko.net>)
> - allow specifying a port directory to use through kconfig, such as
> mips-i6500. The default stays linux for 32-bits architecture,
> linux64 for 64.
> - allow passing extra PORT_CFLAGS through kconfig (suggested by
> Andreas Ziegler <br025 at umbiko.net>)
>
> Changes v2 -> v3:
> - do not include the mips-i6500 files as they are redundant with
> the linux port. (suggested by Andreas Ziegler <br025 at umbiko.net>)
> - fix indentation in Config.in and coremark.mk
> - drop the ability to pass custom port (no longer necessary).
> - adapt the name and description of the patch accordingly.
> - author and signed-off-by reset due to patch significant changes.
>
> Changes v3 -> v4:
> - add -lpthread in CFLAGS (since only CFLAGS are used to compile
> and link).
>
> Signed-off-by: Jimmy Durand Wesolowski <jimmy.wesolowski at mobileye.com>
> ---
> package/coremark/Config.in | 10 ++++++++++
> package/coremark/coremark.mk | 14 +++++++++++---
> 2 files changed, 21 insertions(+), 3 deletions(-)
>
> diff --git a/package/coremark/Config.in b/package/coremark/Config.in
> index f0e13eda63..2f3b6f9551 100644
> --- a/package/coremark/Config.in
> +++ b/package/coremark/Config.in
> @@ -6,3 +6,13 @@ config BR2_PACKAGE_COREMARK
> used in embedded systems
>
> https://www.eembc.org/coremark/
> +
> +if BR2_PACKAGE_COREMARK
> +config BR2_PACKAGE_COREMARK_PORT_CFLAGS_EXTRA
> + string "coremark port extra CFLAGS"
> + default ""
> + help
> + Additional CFLAGS to pass to CoreMark platform specific port.
> + Any additional flags indicated here will be added to the
> + CFLAGS_PORT variable.
> +endif
> diff --git a/package/coremark/coremark.mk
> b/package/coremark/coremark.mk
> index 9ea8693e71..38d8ce99ec 100644
> --- a/package/coremark/coremark.mk
> +++ b/package/coremark/coremark.mk
> @@ -9,14 +9,22 @@ COREMARK_SITE = $(call
> github,eembc,coremark,v$(COREMARK_VERSION))
> COREMARK_LICENSE = Apache-2.0
> COREMARK_LICENSE_FILES = LICENSE.md
>
> +COREMARK_CFLAGS = \
> + $(TARGET_CFLAGS) \
> + $(call qstrip,$(BR2_PACKAGE_COREMARK_PORT_CFLAGS_EXTRA))
Qstrip unfortunately removes _all_ double quotes from the string.
Escaped strings, as in
BR2_PACKAGE_COREMARK_PORT_CFLAGS_EXTRA="-DUSE_CLOCK=1
-DMEM_LOCATION='\\\"LPDDR4-3200\\\"'"
(entered as -DUSE_CLOCK=1 -DMEM_LOCATION='\"LPDDR4-3200\"') thus get
mangled and confuse GCC. Running the string through 'echo' works, it
just removes the outer quotation.
+ $(shell echo $(BR2_PACKAGE_COREMARK_PORT_CFLAGS_EXTRA))
> +
> +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
> +COREMARK_CFLAGS += -DUSE_PTHREAD -lpthread
> +endif # BR2_TOOLCHAIN_HAS_THREADS=y
> +
> define COREMARK_BUILD_CMDS
> $(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" -C $(@D) \
> - PORT_CFLAGS="$(TARGET_CFLAGS)" \
> + PORT_CFLAGS="$(COREMARK_CFLAGS)" \
> PORT_DIR=linux$(if $(BR2_ARCH_IS_64),64) EXE= link
> -endef
> +endef # COREMARK_BUILD_CMDS
>
> define COREMARK_INSTALL_TARGET_CMDS
> $(INSTALL) -D $(@D)/coremark $(TARGET_DIR)/usr/bin/coremark
> -endef
> +endef # COREMARK_INSTALL_TARGET_CMDS
>
> $(eval $(generic-package))
> --
> 2.43.0
Kind regards,
Andreas
More information about the buildroot
mailing list