diff mbox series

aix: Add FAT library support for libffi for AIX

Message ID PA4PR02MB66869B8A3152C61BFA3D43D6EA8B9@PA4PR02MB6686.eurprd02.prod.outlook.com
State New
Headers show
Series aix: Add FAT library support for libffi for AIX | expand

Commit Message

Li, Pan2 via Gcc-patches Nov. 2, 2021, 9:47 a.m. UTC
Even if GCC64 is able to boostrap without libffi being a
FAT library on AIX, the tests for "-maix32" are not working
without it.

libffi/ChangeLog:
2021-10-21  Clément Chigot  <clement.chigo@atos.net>

        * Makefile.am (tmake_file): Build and install AIX-style FAT
          libraries.
        * Makefile.in: Regenerate.
        * include/Makefile.in: Regenerate.
        * man/Makefile.in: Regenerate.
        * testsuite/Makefile.in: Regenerate.
        * configure (tmake_file): Substitute.
        * configure.ac: Regenerate.
        * configure.host (powerpc-*-aix*): Define tmake_file.
        * src/powerpc/t-aix: New file.

I've already made a PR to libffi itself in order to add the common part of 
this patch to it. But for now, it's still unmerged: 
https://github.com/libffi/libffi/pull/661. 

Clément

Comments

Li, Pan2 via Gcc-patches Nov. 16, 2021, 8:44 a.m. UTC | #1
> Even if GCC64 is able to boostrap without libffi being a
> FAT library on AIX, the tests for "-maix32" are not working
> without it.
> 
> libffi/ChangeLog:
> 2021-10-21  Clément Chigot  <clement.chigo@atos.net>
> 
>       * Makefile.am (tmake_file): Build and install AIX-style FAT
>          libraries.
>       * Makefile.in: Regenerate.
>       * include/Makefile.in: Regenerate.
>       * man/Makefile.in: Regenerate.
>       * testsuite/Makefile.in: Regenerate.
>        * configure (tmake_file): Substitute.
>        * configure.ac: Regenerate.
>        * configure.host (powerpc-*-aix*): Define tmake_file.
>        * src/powerpc/t-aix: New file.
>
> I've already made a PR to libffi itself in order to add the common part of 
> this patch to it. But for now, it's still unmerged: 
> https://github.com/libffi/libffi/pull/661. 

Gentle ping, 

Thanks
Clément
diff mbox series

Patch

From 9722d209326b84d8817c1ae654190bdc6b546690 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <clement.chigot@atos.net>
Date: Thu, 21 Oct 2021 09:07:04 +0200
Subject: [PATCH] aix: Add FAT library support for libffi for AIX
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Even if GCC64 is able to boostrap without libffi being a
FAT library on AIX, the tests for "-maix32" are not working
without it.

libffi/ChangeLog:
2021-10-21  Clément Chigot  <clement.chigo@atos.net>

        * Makefile.am (tmake_file): Build and install AIX-style FAT
          libraries.
        * Makefile.in: Regenerate.
        * include/Makefile.in: Regenerate.
        * man/Makefile.in: Regenerate.
        * testsuite/Makefile.in: Regenerate.
        * configure (tmake_file): Substitute.
        * configure.ac: Regenerate.
        * configure.host (powerpc-*-aix*): Define tmake_file.
        * src/powerpc/t-aix: New file.
---
 libffi/Makefile.am           |  3 +++
 libffi/Makefile.in           |  4 ++++
 libffi/configure             | 17 +++++++++++++++--
 libffi/configure.ac          | 12 ++++++++++++
 libffi/configure.host        |  2 ++
 libffi/include/Makefile.in   |  1 +
 libffi/man/Makefile.in       |  1 +
 libffi/src/powerpc/t-aix     | 14 ++++++++++++++
 libffi/testsuite/Makefile.in |  1 +
 9 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 libffi/src/powerpc/t-aix

diff --git a/libffi/Makefile.am b/libffi/Makefile.am
index 02e36176c67..c671444c57c 100644
--- a/libffi/Makefile.am
+++ b/libffi/Makefile.am
@@ -228,4 +228,7 @@  clean-recursive: clean-multi
 distclean-recursive: distclean-multi
 maintainer-clean-recursive: maintainer-clean-multi
 
+# target overrides
+-include $(tmake_file)
+
 include $(top_srcdir)/../multilib.am
diff --git a/libffi/Makefile.in b/libffi/Makefile.in
index 6ff0c67a779..86eb1104f94 100644
--- a/libffi/Makefile.in
+++ b/libffi/Makefile.in
@@ -439,6 +439,7 @@  target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+tmake_file = @tmake_file@
 toolexecdir = @toolexecdir@
 toolexeclibdir = @toolexeclibdir@
 top_build_prefix = @top_build_prefix@
@@ -1931,6 +1932,9 @@  clean-recursive: clean-multi
 distclean-recursive: distclean-multi
 maintainer-clean-recursive: maintainer-clean-multi
 
+# target overrides
+-include $(tmake_file)
+
 # GNU Make needs to see an explicit $(MAKE) variable in the command it
 # runs to enable its job server during parallel builds.  Hence the
 # comments below.
diff --git a/libffi/configure b/libffi/configure
index 4bababb87f5..9550a0906eb 100755
--- a/libffi/configure
+++ b/libffi/configure
@@ -644,6 +644,7 @@  LIBFFI_BUILD_VERSIONED_SHLIB_FALSE
 LIBFFI_BUILD_VERSIONED_SHLIB_TRUE
 OPT_LDFLAGS
 SECTION_LDFLAGS
+tmake_file
 toolexeclibdir
 toolexecdir
 FFI_DEBUG_FALSE
@@ -11481,7 +11482,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11484 "configure"
+#line 11485 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11587,7 +11588,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11590 "configure"
+#line 11591 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -16384,6 +16385,18 @@  esac
 
 
 
+# Conditionalize the makefile for this target machine.
+tmake_file_=
+for f in ${tmake_file}
+do
+  if test -f ${srcdir}/src/$TARGETDIR/$f
+  then
+    tmake_file_="${tmake_file_} \$(srcdir)/src/$TARGETDIR/$f"
+  fi
+done
+tmake_file="${tmake_file_}"
+
+
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
 else
diff --git a/libffi/configure.ac b/libffi/configure.ac
index bff5a1e7189..71777ea9b11 100644
--- a/libffi/configure.ac
+++ b/libffi/configure.ac
@@ -403,6 +403,18 @@  esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
 
+# Conditionalize the makefile for this target machine.
+tmake_file_=
+for f in ${tmake_file}
+do
+  if test -f ${srcdir}/src/$TARGETDIR/$f
+  then
+    tmake_file_="${tmake_file_} \$(srcdir)/src/$TARGETDIR/$f"
+  fi
+done
+tmake_file="${tmake_file_}"
+AC_SUBST(tmake_file)
+
 if test "${multilib}" = "yes"; then
   multilib_arg="--enable-multilib"
 else
diff --git a/libffi/configure.host b/libffi/configure.host
index 268267183a0..49704cb7056 100644
--- a/libffi/configure.host
+++ b/libffi/configure.host
@@ -207,6 +207,8 @@  case "${host}" in
 	;;
   powerpc-*-aix* | rs6000-*-aix*)
 	TARGET=POWERPC_AIX; TARGETDIR=powerpc
+	# Create AIX-style "FAT" libraries.
+	tmake_file="t-aix"
 	;;
   powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*)
 	TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
diff --git a/libffi/include/Makefile.in b/libffi/include/Makefile.in
index c76e2a8c6f5..a0c4d7ea5e3 100644
--- a/libffi/include/Makefile.in
+++ b/libffi/include/Makefile.in
@@ -311,6 +311,7 @@  target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+tmake_file = @tmake_file@
 toolexecdir = @toolexecdir@
 toolexeclibdir = @toolexeclibdir@
 top_build_prefix = @top_build_prefix@
diff --git a/libffi/man/Makefile.in b/libffi/man/Makefile.in
index 8dbe52ff5af..93c7a834c96 100644
--- a/libffi/man/Makefile.in
+++ b/libffi/man/Makefile.in
@@ -293,6 +293,7 @@  target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+tmake_file = @tmake_file@
 toolexecdir = @toolexecdir@
 toolexeclibdir = @toolexeclibdir@
 top_build_prefix = @top_build_prefix@
diff --git a/libffi/src/powerpc/t-aix b/libffi/src/powerpc/t-aix
new file mode 100644
index 00000000000..098a806c005
--- /dev/null
+++ b/libffi/src/powerpc/t-aix
@@ -0,0 +1,14 @@ 
+ifeq ($(MULTIBUILDTOP),)
+BITS=$(shell if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then \
+    echo '64'; else echo '32'; fi)
+ARX=$(shell echo $(AR) | sed -e 's/-X[^ ]*//g')
+LIBTOOL_VERSION_CURRENT=$(firstword $(subst :, ,$(shell grep -v '^\#' $(srcdir)/libtool-version)))
+LIBTOOL_VERSION_AGE=$(lastword $(subst :, ,$(shell grep -v '^\#' $(srcdir)/libtool-version)))
+MAJOR=$(shell echo $(LIBTOOL_VERSION_CURRENT)-$(LIBTOOL_VERSION_AGE) | bc)
+all-local: $(toolexeclib_LTLIBRARIES)
+	-rm -f .libs/$(PACKAGE).a ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a
+	$(AR) rc .libs/$(PACKAGE).a .libs/$(PACKAGE).so.$(MAJOR)
+	$(AR) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR)
+	$(ARX) -X$(BITS) rc .libs/$(PACKAGE).a ../ppc$(BITS)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR)
+	$(ARX) -X$(BITS) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(BITS)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR)
+endif
\ No newline at end of file
diff --git a/libffi/testsuite/Makefile.in b/libffi/testsuite/Makefile.in
index 3e9e937b752..ae9d870ee0f 100644
--- a/libffi/testsuite/Makefile.in
+++ b/libffi/testsuite/Makefile.in
@@ -266,6 +266,7 @@  target_alias = @target_alias@
 target_cpu = @target_cpu@
 target_os = @target_os@
 target_vendor = @target_vendor@
+tmake_file = @tmake_file@
 toolexecdir = @toolexecdir@
 toolexeclibdir = @toolexeclibdir@
 top_build_prefix = @top_build_prefix@
-- 
2.33.0