ports/devel/libffi321/files/patch-configure
Niclas Zeising 1a3e10283d devel/libffi: Fix build on i386 without objdump
FreeBSD 13 does not have any objdump in the default installation, which
causes issues with libffi on i386 with the recent update to llvm 11.
Add a patch originally from upstream, to use readelf instead of objdump.

The patch is for configure.ac originally.  I've applied it and rerun
autoreconf and committed the result, instead of adding a dependency on
autoreconf.

Fix devel/libffi321 in the same way.  While here, fix the fuzz on a few
other patches, which made it much easier to sort out the configure patch.

Thanks to dim@ for helping me figure out the issue.

MFH:		2020Q3
2020-08-20 11:34:28 +00:00

146 lines
4.5 KiB
Text

--- configure.orig 2014-11-12 11:59:57 UTC
+++ configure
@@ -17221,7 +17221,7 @@ case "$host" in
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
TARGET=MIPS; TARGETDIR=mips
;;
- mips*-*linux* | mips*-*-openbsd*)
+ mips*-*linux* | mips*-*-openbsd* | mips*-*-freebsd*)
# Support 128-bit long double for NewABI.
HAVE_LONG_DOUBLE='defined(__mips64)'
TARGET=MIPS; TARGETDIR=mips
@@ -17255,6 +17255,10 @@ case "$host" in
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
HAVE_LONG_DOUBLE_VARIANT=1
;;
+ powerpcspe-*-freebsd*)
+ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
+ CFLAGS="$CFLAGS -D__NO_FPRS__"
+ ;;
powerpc64-*-freebsd*)
TARGET=POWERPC; TARGETDIR=powerpc
;;
@@ -18289,7 +18293,8 @@ $as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.
fi
-if test x$TARGET = xSPARC; then
+case "$TARGET" in
+ SPARC)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5
$as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; }
if ${libffi_cv_as_sparc_ua_pcrel+:} false; then :
@@ -18363,9 +18368,9 @@ $as_echo "$libffi_cv_as_register_pseudo_op" >&6; }
$as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h
fi
-fi
+ ;;
-if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
+ X86*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5
$as_echo_n "checking assembler supports pc related relocs... " >&6; }
if ${libffi_cv_as_x86_pcrel+:} false; then :
@@ -18386,78 +18391,9 @@ $as_echo "$libffi_cv_as_x86_pcrel" >&6; }
$as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h
fi
+ ;;
+esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5
-$as_echo_n "checking assembler .ascii pseudo-op support... " >&6; }
-if ${libffi_cv_as_ascii_pseudo_op+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
- libffi_cv_as_ascii_pseudo_op=unknown
- # Check if we have .ascii
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-asm (".ascii \\"string\\"");
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- libffi_cv_as_ascii_pseudo_op=yes
-else
- libffi_cv_as_ascii_pseudo_op=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5
-$as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; }
- if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then
-
-$as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h
-
- fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5
-$as_echo_n "checking assembler .string pseudo-op support... " >&6; }
-if ${libffi_cv_as_string_pseudo_op+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
- libffi_cv_as_string_pseudo_op=unknown
- # Check if we have .string
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-asm (".string \\"string\\"");
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- libffi_cv_as_string_pseudo_op=yes
-else
- libffi_cv_as_string_pseudo_op=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5
-$as_echo "$libffi_cv_as_string_pseudo_op" >&6; }
- if test "x$libffi_cv_as_string_pseudo_op" = xyes; then
-
-$as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h
-
- fi
-fi
-
# On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC.
# Check whether --enable-pax_emutramp was given.
if test "${enable_pax_emutramp+set}" = set; then :
@@ -18592,16 +18528,12 @@ if ${libffi_cv_ro_eh_frame+:} false; then :
$as_echo_n "(cached) " >&6
else
- libffi_cv_ro_eh_frame=no
+ libffi_cv_ro_eh_frame=yes
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
- objdump -h conftest.o > conftest.dump 2>&1
- libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
- libffi_test_line=`expr $libffi_eh_frame_line + 1`p
- sed -n $libffi_test_line conftest.dump > conftest.line
- if grep READONLY conftest.line > /dev/null; then
- libffi_cv_ro_eh_frame=yes
- fi
+ if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
+ libffi_cv_ro_eh_frame=no
+ fi
fi
rm -f conftest.*