From 430f9b2c0dfd91081485ae6225a0e59b00d990ac Mon Sep 17 00:00:00 2001 From: Carl Kittelberger Date: Tue, 25 Jun 2024 04:08:03 +0200 Subject: [PATCH] Patch libffi to work with newer gcc. Refs #59 and https://github.com/libffi/libffi/issues/760. --- .../Forward-declare-open-temp-exec-file.patch | 42 +++++++++++++++++++ compile-buildroot.sh | 11 +++++ configure-buildroot.sh | 21 +++++++++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 buildroot-customizations/board/inmusic/common/patches/libffi/3.4.4/Forward-declare-open-temp-exec-file.patch diff --git a/buildroot-customizations/board/inmusic/common/patches/libffi/3.4.4/Forward-declare-open-temp-exec-file.patch b/buildroot-customizations/board/inmusic/common/patches/libffi/3.4.4/Forward-declare-open-temp-exec-file.patch new file mode 100644 index 0000000..5dec894 --- /dev/null +++ b/buildroot-customizations/board/inmusic/common/patches/libffi/3.4.4/Forward-declare-open-temp-exec-file.patch @@ -0,0 +1,42 @@ +From cbfb9b436ab13e4b4aba867d061e11d7f89a351c Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Wed, 1 Feb 2023 18:09:25 +0100 +Subject: [PATCH] Forward declare open_temp_exec_file + +It's defined in closures.c and used in tramp.c. +Also declare it as an hidden symbol, as it should be. +--- + include/ffi_common.h | 4 ++++ + src/tramp.c | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/include/ffi_common.h b/include/ffi_common.h +index 2bd31b03d..c53a79493 100644 +--- a/include/ffi_common.h ++++ b/include/ffi_common.h +@@ -128,6 +128,10 @@ void *ffi_data_to_code_pointer (void *data) FFI_HIDDEN; + static trampoline. */ + int ffi_tramp_is_present (void *closure) FFI_HIDDEN; + ++/* Return a file descriptor of a temporary zero-sized file in a ++ writable and executable filesystem. */ ++int open_temp_exec_file(void) FFI_HIDDEN; ++ + /* Extended cif, used in callback from assembly routine */ + typedef struct + { +diff --git a/src/tramp.c b/src/tramp.c +index b9d273a1a..c3f4c9933 100644 +--- a/src/tramp.c ++++ b/src/tramp.c +@@ -39,6 +39,10 @@ + #ifdef __linux__ + #define _GNU_SOURCE 1 + #endif ++ ++#include ++#include ++ + #include + #include + #include diff --git a/compile-buildroot.sh b/compile-buildroot.sh index 1454395..b04d840 100755 --- a/compile-buildroot.sh +++ b/compile-buildroot.sh @@ -56,9 +56,20 @@ export PATH="${PATH// /}" buildroot_path="buildroot/$(get_buildroot_version)" +BR2_GLOBAL_PATCH_DIR="" +for d in common "${device_id_lowercase}"; do + if [ -d "${SCRIPT_DIR}/buildroot-customizations/board/inmusic/$d/patches" ]; then + if [ -n "${BR2_GLOBAL_PATCH_DIR}" ]; then + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR} " + fi + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR}${SCRIPT_DIR}/buildroot-customizations/board/inmusic/$d/patches" + fi +done + make_flags=( -C "${buildroot_path}" BR2_EXTERNAL=../../buildroot-customizations + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR}" ) if [ -n "${BR2_JLEVEL:-}" ]; then diff --git a/configure-buildroot.sh b/configure-buildroot.sh index 6612a56..9fd1d92 100755 --- a/configure-buildroot.sh +++ b/configure-buildroot.sh @@ -16,5 +16,24 @@ if [ -z "$config_target" ]; then config_target=nconfig fi fi -make -C "$buildroot_path" -j$(nproc) BR2_EXTERNAL=../../buildroot-customizations "$config_target" + +BR2_GLOBAL_PATCH_DIR="" +for d in common "${device_id_lowercase}"; do + if [ -d "${SCRIPT_DIR}/buildroot-customizations/board/inmusic/$d/patches" ]; then + if [ -n "${BR2_GLOBAL_PATCH_DIR}" ]; then + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR} " + fi + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR}${SCRIPT_DIR}/buildroot-customizations/board/inmusic/$d/patches" + fi +done + +make_flags=( + -C "${buildroot_path}" + BR2_EXTERNAL=../../buildroot-customizations + BR2_GLOBAL_PATCH_DIR="${BR2_GLOBAL_PATCH_DIR}" +) + +make \ + "${make_flags[@]}" \ + "$config_target" cp -v "$buildroot_path/.config" buildroot-config