From e526b8b11debb184929abd013b7d589c9db245fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 18 Nov 2024 09:58:23 +0100 Subject: [PATCH] gnu: u-boot-tools: Fix segfault while running tests. Fixes . * gnu/packages/patches/u-boot-calloc-visibility.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/bootloaders.scm (u-boot): Use it. Reported-by: Jean-Francois GUILLAUME Reported-by: Christopher Howard Change-Id: Id0023e17367a80a0d1abd4a80b7d8e3a0c3cc5bc --- gnu/local.mk | 1 + gnu/packages/bootloaders.scm | 3 ++- .../patches/u-boot-calloc-visibility.patch | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/u-boot-calloc-visibility.patch diff --git a/gnu/local.mk b/gnu/local.mk index 60fc8c9d949cd95119571ebb8efb59df16e9b60e..ff6c6be5f0dd01baa60dc9b5a740f39d454049e3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -2255,6 +2255,7 @@ dist_patch_DATA = \ %D%/packages/patches/twinkle-bcg729.patch \ %D%/packages/patches/u-boot-allow-disabling-openssl.patch \ %D%/packages/patches/u-boot-build-without-libcrypto.patch \ + %D%/packages/patches/u-boot-calloc-visibility.patch \ %D%/packages/patches/u-boot-nintendo-nes-serial.patch \ %D%/packages/patches/u-boot-rockchip-inno-usb.patch \ %D%/packages/patches/ucx-tcp-iface-ioctl.patch \ diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 52a077eceafdada28be266250e0b3186f5ccbf19..da5abaca553e3d882b0a06139d680e10de462695 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -758,7 +758,8 @@ tree binary files. These are board description files used by Linux and BSD.") (patches (list %u-boot-rockchip-inno-usb-patch %u-boot-build-without-libcrypto-patch - %u-boot-allow-disabling-openssl-patch)) + %u-boot-allow-disabling-openssl-patch + (search-patch "u-boot-calloc-visibility.patch"))) (method url-fetch) (uri (string-append "https://ftp.denx.de/pub/u-boot/" diff --git a/gnu/packages/patches/u-boot-calloc-visibility.patch b/gnu/packages/patches/u-boot-calloc-visibility.patch new file mode 100644 index 0000000000000000000000000000000000000000..93c52ff7097491db31b9ab7418b7f5a3db0c40b6 --- /dev/null +++ b/gnu/packages/patches/u-boot-calloc-visibility.patch @@ -0,0 +1,18 @@ +Arrange so that LLVM's shared object doesn't end up using 'calloc' from +U-Boot's 'malloc_simple.c' when it's initialized. + + https://issues.guix.gnu.org/74270 + +diff --git a/common/malloc_simple.c b/common/malloc_simple.c +index 5a8ec538f8..4f5e350a3c 100644 +--- a/common/malloc_simple.c ++++ b/common/malloc_simple.c +@@ -64,6 +64,8 @@ void *memalign_simple(size_t align, size_t bytes) + } + + #if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) ++void *calloc(size_t nmemb, size_t elem_size) ++ __attribute__ ((visibility ("hidden"))); + void *calloc(size_t nmemb, size_t elem_size) + { + size_t size = nmemb * elem_size;