Skip to content

Commit

Permalink
Fix bootstrap under Ubuntu 24.04 or higher
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Feb 12, 2025
1 parent 2cf2bdd commit 0406cc8
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
From 580f46a7bc6e9fea3a2227b5268cc3aed1d60e3b Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <[email protected]>
Date: Thu, 7 Feb 2013 22:26:56 +0100
Subject: [PATCH] Fix installation location of libffi
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The libffi is currently declared as toolexeclib_LTLIBRARIES. In many
cases, toolexeclib libraries will be installed in /usr/lib, so it
doesn't make any difference.

However, with multilib toolchains, they get installed in a
subdirectory of /usr/lib/. For example, with a Sourcery CodeBench
PowerPC toolchain, if the e500mc multilib variant is used, the libffi
library gets installed in /usr/lib/te500mc/. This is due to the
following code in the configure script:

multi_os_directory=`$CC -print-multi-os-directory`
case $multi_os_directory in
.) ;; # Avoid trailing /.
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
esac

Once the library is installed in /usr/lib/te500mc/, nothing works
because this installation location is inconsistent with the
installation location declared in libffi.pc.

So, instead of using this bizarre toolexeclib_LTLIBRARIES, simply use
the more standard lib_LTLIBRARIES, which ensures that the libffi
library is always installed in /usr/lib.

Signed-off-by: Thomas Petazzoni <[email protected]>
[unfuzz for 3.2.1]
Signed-off-by: Jörg Krause <[email protected]>
---
Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 0e40451..309474c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -104,7 +104,7 @@ FLAGS_TO_PASS = $(AM_MAKEFLAGS)

MAKEOVERRIDES=

-toolexeclib_LTLIBRARIES = libffi.la
+lib_LTLIBRARIES = libffi.la
noinst_LTLIBRARIES = libffi_convenience.la

libffi_la_SOURCES = src/prep_cif.c src/types.c \
--
2.5.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 31b6b6bc14197cd4183bdbd311fddeb36b5ae100 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Krause?= <[email protected]>
Date: Sat, 19 Sep 2015 22:53:29 +0200
Subject: [PATCH] Fix use of compact eh frames on MIPS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Newer MIPS toolchains use a different (compact) eh_frame format.
libffi don't like them, so we have to switch to the older format.

This patch add -mno-compact-eh to CFLAGS when compiling for
Mips and compiler support it.

Signed-off-by: Jérôme Pouiller <[email protected]>
[unfuzz for 3.2.1]
Signed-off-by: Jörg Krause <[email protected]>
---
configure.ac | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/configure.ac b/configure.ac
index a7bf5ee..36cd0d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -469,6 +469,16 @@ esac
AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1)
AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE)

+if test x$TARGET = xMIPS; then
+ save_CFLAGS="$CFLAGS"
+ CFLAGS=-mno-compact-eh
+ AC_MSG_CHECKING([whether the C compiler needs -mno-compact-eh])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AC_MSG_RESULT([yes])]; [save_CFLAGS="$save_CFLAGS -mno-compact-eh"],
+ [AC_MSG_RESULT([no])])
+ CFLAGS="$save_CFLAGS"
+fi
+
if test x$TARGET = xX86_64; then
AC_CACHE_CHECK([toolchain supports unwind section type],
libffi_cv_as_x86_64_unwind_section_type, [
--
2.5.3

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
From 48bc37fabbc685b1e3293055bd33ca66c619305e Mon Sep 17 00:00:00 2001
From: Vicente Olivert Riera <[email protected]>
Date: Wed, 13 Jan 2016 14:49:59 +0000
Subject: [PATCH] libffi: enable hardfloat in the MIPS assembly code

This way it will be possible to build it for soft-float. This is only a
temporary fix. The package needs to be fixed properly.

Signed-off-by: Vicente Olivert Riera <[email protected]>
[Update for 3.3-rc0]
Signed-off-by: Fabrice Fontaine <[email protected]>
---
src/mips/n32.S | 1 +
src/mips/o32.S | 1 +
2 files changed, 2 insertions(+)

diff --git a/src/mips/n32.S b/src/mips/n32.S
index c6985d3..dc842d5 100644
--- a/src/mips/n32.S
+++ b/src/mips/n32.S
@@ -44,6 +44,7 @@
#endif
#if !defined(__mips_isa_rev) || (__mips_isa_rev<6)
.set mips4
#endif
+ .set hardfloat
.text
.align 2
.globl ffi_call_N32
diff --git a/src/mips/o32.S b/src/mips/o32.S
index eb27981..b653daf 100644
--- a/src/mips/o32.S
+++ b/src/mips/o32.S
@@ -42,6 +42,7 @@
#define RA_OFF (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG)

.abicalls
+ .set hardfloat
.text
.align 2
.globl ffi_call_O32
--
2.4.10

13 changes: 13 additions & 0 deletions global-packages/buildroot-2023.11.3/libffi/Config.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config BR2_PACKAGE_LIBFFI
bool "libffi"
depends on BR2_TOOLCHAIN_HAS_THREADS
help
The libffi library provides a portable, high level
programming interface to various calling conventions. This
allows a programmer to call any function specified by a call
interface description at run-time.

http://sourceware.org/libffi/

comment "libffi needs a toolchain w/ threads"
depends on !BR2_TOOLCHAIN_HAS_THREADS
4 changes: 4 additions & 0 deletions global-packages/buildroot-2023.11.3/libffi/libffi.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Locally calculated
sha256 b0dea9df23c863a7a50e825440f3ebffabd65df1497108e5d437747843895a4e libffi-3.4.6.tar.gz
# License files, locally calculated
sha256 2c9c2acb9743e6b007b91350475308aee44691d96aa20eacef8e199988c8c388 LICENSE
22 changes: 22 additions & 0 deletions global-packages/buildroot-2023.11.3/libffi/libffi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
################################################################################
#
# libffi
#
################################################################################

LIBFFI_VERSION = 3.4.6
LIBFFI_SITE = \
https://github.com/libffi/libffi/releases/download/v$(LIBFFI_VERSION)
LIBFFI_LICENSE = MIT
LIBFFI_LICENSE_FILES = LICENSE
LIBFFI_CPE_ID_VENDOR = libffi_project
LIBFFI_INSTALL_STAGING = YES
# We're patching Makefile.am
LIBFFI_AUTORECONF = YES

# The static exec trampolines is enabled by default since
# libffi 3.4.2. However it doesn't work with gobject-introspection.
LIBFFI_CONF_OPTS = --disable-exec-static-tramp

$(eval $(autotools-package))
$(eval $(host-autotools-package))

0 comments on commit 0406cc8

Please sign in to comment.