kumquat-buildroot/package/coremark-pro/coremark-pro.mk
Fabrice Fontaine 0f7019601f package/coremark-pro: fix build with uclibc-ng
Fix the following linking error with uClibc-ng:

/nvme/rc-buildroot-test/scripts/instance-1/output-1/host/bin/arc-buildroot-linux-uclibc-gcc  -o/nvme/rc-buildroot-test/scripts/instance-1/output-1/build/coremark-pro-1.1.2743/builds/linux/gcc/bin/cjpeg-rose7-preset cjpeg-rose7-preset.o /nvme/rc-buildroot-test/scripts/instance-1/output-1/build/coremark-pro-1.1.2743/builds/linux/gcc/obj/bench/consumer_v2/cjpeg/*.o  /nvme/rc-buildroot-test/scripts/instance-1/output-1/build/coremark-pro-1.1.2743/builds/linux/gcc/obj/mith.a -lm -lpthread  -lrt
/nvme/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: /nvme/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/libgcc.a(unwind-dw2-fde-dip.o): in function `_Unwind_Find_FDE':
/nvme/rc-buildroot-test/scripts/instance-1/output-1/build/host-gcc-final-arc-2020.09-release/build/arc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:469: undefined reference to `dl_iterate_phdr'
/nvme/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: /nvme/rc-buildroot-test/scripts/instance-1/output-1/build/host-gcc-final-arc-2020.09-release/build/arc-buildroot-linux-uclibc/libgcc/../../../libgcc/unwind-dw2-fde-dip.c:469: undefined reference to `dl_iterate_phdr'
/nvme/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: GOT and PLT relocations cannot be fixed with a non dynamic linker
/nvme/rc-buildroot-test/scripts/instance-1/output-1/host/lib/gcc/arc-buildroot-linux-uclibc/10.2.0/../../../../arc-buildroot-linux-uclibc/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
/nvme/rc-buildroot-test/scripts/instance-1/output-1/build/coremark-pro-1.1.2743/workloads/cjpeg-rose7-preset//Makefile:65: recipe for target '/nvme/rc-buildroot-test/scripts/instance-1/output-1/build/coremark-pro-1.1.2743/builds/linux/gcc/bin/cjpeg-rose7-preset' failed

Since uClibc-ng 1.0.18 a circular dependency between libc and libgcc
exist, when static linking is used. It can be resolved by the compiler
when -static is correctly passed in the linking step.

So use TARGET_LDFLAGS to pass LDFLAGS

Fixes:
 - http://autobuild.buildroot.org/results/ca86624b09fed961d2b9086fee8b2029845746ea

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2021-01-18 22:11:43 +01:00

63 lines
2.2 KiB
Makefile

################################################################################
#
# CoreMark-PRO
#
################################################################################
COREMARK_PRO_VERSION = 1.1.2743
COREMARK_PRO_SITE = $(call github,eembc,coremark-pro,v$(COREMARK_PRO_VERSION))
COREMARK_PRO_LICENSE = Apache-2.0
COREMARK_PRO_LICENSE_FILES = LICENSE.md
COREMARK_PRO_DEPENDENCIES = perl
COREMARK_PRO_LDFLAGS = $(TARGET_LDFLAGS) -lm
ifeq ($(BR2_ENDIAN),"BIG")
COREMARK_PRO_DEFINES += \
EE_BIG_ENDIAN=1 \
EE_LITTLE_ENDIAN=0
else
COREMARK_PRO_DEFINES += \
EE_BIG_ENDIAN=0 \
EE_LITTLE_ENDIAN=1
endif
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
COREMARK_PRO_DEFINES += \
USE_NATIVE_PTHREAD=1 \
USE_SINGLE_CONTEXT=0
COREMARK_PRO_LDFLAGS += -lpthread
else
COREMARK_PRO_DEFINES += \
USE_NATIVE_PTHREAD=0 \
USE_SINGLE_CONTEXT=1
endif
COREMARK_PRO_MAKE_OPTS += \
LINKER_LAST="$(COREMARK_PRO_LDFLAGS)" \
PLATFORM_DEFINES="$(COREMARK_PRO_DEFINES)" \
TARGET=linux$(if $(BR2_ARCH_IS_64),64) \
EXE=
define COREMARK_PRO_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_CC)" -C $(@D) \
$(COREMARK_PRO_MAKE_OPTS) build
endef
COREMARK_PRO_MARKS = cjpeg-rose7-preset core linear_alg-mid-100x100-sp loops-all-mid-10k-sp nnet_test parser-125k radix2-big-64k sha-test zip-test
COREMARK_PRO_SCRIPTS = results_parser.pl cert_median.pl cert_mark.pl headings.txt
define COREMARK_PRO_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/usr/share/coremark-pro/logs
$(foreach m,$(COREMARK_PRO_MARKS),\
$(INSTALL) -D $(@D)/builds/linux$(if $(BR2_ARCH_IS_64),64)/gcc$(if $(BR2_ARCH_IS_64),64)/bin/$(m) $(TARGET_DIR)/usr/bin/$(m)$(sep) \
size $(TARGET_DIR)/usr/bin/$(m) > $(TARGET_DIR)/usr/share/coremark-pro/logs/$(m).size.log$(sep))
$(INSTALL) -D $(@D)/builds/linux$(if $(BR2_ARCH_IS_64),64)/gcc$(if $(BR2_ARCH_IS_64),64)/data/libbmp/Rose256.bmp $(TARGET_DIR)/usr/share/coremark-pro/Rose256.bmp
$(foreach s,$(COREMARK_PRO_SCRIPTS),\
$(INSTALL) -D $(@D)/util/perl/$(s) $(TARGET_DIR)/usr/share/coremark-pro/util/perl/$(s)$(sep))
$(Q)sed "s/@COREMARK_PRO_MARKS@/$(COREMARK_PRO_MARKS)/" \
package/coremark-pro/coremark-pro.sh.in >$(TARGET_DIR)/usr/bin/coremark-pro.sh
endef
$(eval $(generic-package))