From 83cc5e2b2f887d4bb2305658da382a65fdcaab29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Chigot?= Date: Thu, 16 Jul 2020 11:29:49 +0200 Subject: [PATCH] libgo: add AIX FAT libraries support AIX-style libraries contains both 32 and 64 bit shared objects. This patch follows the adding of FAT libraries support in other gcc libraries (libgcc, listdc++, etc). Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/242957 --- gcc/go/gofrontend/MERGE | 2 +- libgo/Makefile.am | 14 ++++++++++++++ libgo/Makefile.in | 10 ++++++++++ libgo/configure | 13 +++++++++++-- libgo/configure.ac | 8 ++++++++ libgo/testsuite/Makefile.in | 1 + 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 878df0d233a..d23e7377306 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -2d105e65cca6b536320284273353b7c640b12c5f +587d4595e446c597efe97ccdc81b2f05cbc04a21 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/Makefile.am b/libgo/Makefile.am index 5b1807228ad..52a8330ed2a 100644 --- a/libgo/Makefile.am +++ b/libgo/Makefile.am @@ -1228,3 +1228,17 @@ distclean-local: find . -name '*.lo.dep' -print | xargs rm -f include $(top_srcdir)/../multilib.am + +if LIBGO_IS_AIX +ALL_LOCAL_DEPS = add-aix-fat-library +else +ALL_LOCAL_DEPS = +endif +all-local: $(ALL_LOCAL_DEPS) + +MAJOR=$(firstword $(subst :, ,$(libtool_VERSION))) +add-aix-fat-library: all-multi + @if test "$(MULTIBUILDTOP)" = ""; then \ + ${AR} -X$(AIX_DEFAULT_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ + ${AR} -X$(AIX_DEFAULT_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ + fi diff --git a/libgo/Makefile.in b/libgo/Makefile.in index b2712eba971..5cb44841c78 100644 --- a/libgo/Makefile.in +++ b/libgo/Makefile.in @@ -377,6 +377,7 @@ CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = testsuite ACLOCAL = @ACLOCAL@ +AIX_DEFAULT_ARCH = @AIX_DEFAULT_ARCH@ ALLGOARCH = @ALLGOARCH@ ALLGOARCHFAMILY = @ALLGOARCHFAMILY@ ALLGOOS = @ALLGOOS@ @@ -1160,6 +1161,9 @@ MULTIDIRS = MULTISUBDIR = MULTIDO = true MULTICLEAN = true +@LIBGO_IS_AIX_FALSE@ALL_LOCAL_DEPS = +@LIBGO_IS_AIX_TRUE@ALL_LOCAL_DEPS = add-aix-fat-library +MAJOR = $(firstword $(subst :, ,$(libtool_VERSION))) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -3080,6 +3084,12 @@ mostlyclean-local: mostlyclean-multi clean-local: clean-multi distclean-local: distclean-multi maintainer-clean-local: maintainer-clean-multi +all-local: $(ALL_LOCAL_DEPS) +add-aix-fat-library: all-multi + @if test "$(MULTIBUILDTOP)" = ""; then \ + ${AR} -X$(AIX_DEFAULT_ARCH) rc .libs/$(PACKAGE).a ../ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ + ${AR} -X$(AIX_DEFAULT_ARCH) rc ../pthread/$(PACKAGE)/.libs/$(PACKAGE).a ../pthread/ppc$(AIX_DEFAULT_ARCH)/$(PACKAGE)/.libs/$(PACKAGE).so.$(MAJOR); \ + fi # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/libgo/configure b/libgo/configure index 2a9c7e61f63..67470acbadb 100755 --- a/libgo/configure +++ b/libgo/configure @@ -733,6 +733,7 @@ SED MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE +AIX_DEFAULT_ARCH am__fastdepCCAS_FALSE am__fastdepCCAS_TRUE CCASDEPMODE @@ -4713,6 +4714,14 @@ case ${host} in # static hash tables crashes on AIX when libgo is built with O2 CFLAGS="$CFLAGS -fno-section-anchors" GOCFLAGS="$GOCFLAGS -fno-section-anchors" + + # Check default architecture for FAT library creation + if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then + AIX_DEFAULT_ARCH='64' + else + AIX_DEFAULT_ARCH='32' + fi + ;; esac @@ -11492,7 +11501,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11495 "configure" +#line 11602 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11598,7 +11607,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11601 "configure" +#line 11708 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/libgo/configure.ac b/libgo/configure.ac index 235d867ccda..841cba1768e 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -36,6 +36,14 @@ case ${host} in # static hash tables crashes on AIX when libgo is built with O2 CFLAGS="$CFLAGS -fno-section-anchors" GOCFLAGS="$GOCFLAGS -fno-section-anchors" + + # Check default architecture for FAT library creation + if test -z "`$(CC) -x c -E /dev/null -g3 -o - | grep 64BIT`" ; then + AIX_DEFAULT_ARCH='64' + else + AIX_DEFAULT_ARCH='32' + fi + AC_SUBST(AIX_DEFAULT_ARCH) ;; esac diff --git a/libgo/testsuite/Makefile.in b/libgo/testsuite/Makefile.in index 3d55e2649d3..ae42fad38e5 100644 --- a/libgo/testsuite/Makefile.in +++ b/libgo/testsuite/Makefile.in @@ -131,6 +131,7 @@ am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) DEJATOOL = $(PACKAGE) RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir ACLOCAL = @ACLOCAL@ +AIX_DEFAULT_ARCH = @AIX_DEFAULT_ARCH@ ALLGOARCH = @ALLGOARCH@ ALLGOARCHFAMILY = @ALLGOARCHFAMILY@ ALLGOOS = @ALLGOOS@ -- 2.30.2