aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Edelsohn <dje.gcc@gmail.com>2020-05-15 17:46:08 -0400
committerDavid Edelsohn <dje.gcc@gmail.com>2020-06-21 14:14:46 -0400
commit47ddb895df311e546a6f54345e18b8749ac50324 (patch)
tree0b30e4df51b10fe25ab50b0119daeebd2c99ac6d /gcc
parent8ee2640bfdc62f835ec9740278f948034bc7d9f1 (diff)
downloadgcc-47ddb895df311e546a6f54345e18b8749ac50324.zip
gcc-47ddb895df311e546a6f54345e18b8749ac50324.tar.gz
gcc-47ddb895df311e546a6f54345e18b8749ac50324.tar.bz2
aix: Add GCC64 configuration and FAT target libraries.
This patch adds the ability to configure GCC on AIX to build as a 64 bit application and to build target libraries "FAT" libraries in both 32 bit and 64 bit mode. The patch adds makefile fragment hooks to target libraries that allows them to include target-specific rules. The target specific rules for AIX place both 32 bit and 64 bit objects and shared objects in archives at the top-level, not multilib subdirectories. The multilibs are built in subdirectories, but must be combined during the last parts of the target library build process. Because of the way that GCC bootstrap works, the libraries must be combined during the multiple stages of GCC bootstrap, not solely when installed in the final destination, so the libraries are correct at the end of each target library build stage, not solely an install recipe. gcc/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * config.gcc: Use t-aix64, biarch64 and default64 for cpu_is_64bit. * config/rs6000/aix72.h (ASM_SPEC): Remove aix64 option. (ASM_SPEC32): New. (ASM_SPEC64): New. (ASM_CPU_SPEC): Remove vsx and altivec options. (CPP_SPEC_COMMON): Rename from CPP_SPEC. (CPP_SPEC32): New. (CPP_SPEC64): New. (CPLUSPLUS_CPP_SPEC): Rename to CPLUSPLUS_CPP_SPEC_COMMON.. (TARGET_DEFAULT): Only define if not BIARCH. (LIB_SPEC_COMMON): Rename from LIB_SPEC. (LIB_SPEC32): New. (LIB_SPEC64): New. (LINK_SPEC_COMMON): Rename from LINK_SPEC. (LINK_SPEC32): New. (LINK_SPEC64): New. (STARTFILE_SPEC): Add 64 bit version of crtcxa and crtdbase. (ASM_SPEC): Define 32 and 64 bit alternatives using DEFAULT_ARCH64_P. (CPP_SPEC): Same. (CPLUSPLUS_CPP_SPEC): Same. (LIB_SPEC): Same. (LINK_SPEC): Same. (SUBTARGET_EXTRA_SPECS): Add new 32/64 specs. * config/rs6000/defaultaix64.h: New file. * config/rs6000/t-aix64: New file. libgcc/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * config.host (extra_parts): Add crtcxa_64 and crtdbase_64. * config/rs6000/t-aix-cxa: Explicitly compile 32 bit with -maix32 and 64 bit with -maix64. * config/rs6000/t-slibgcc-aix: Remove extra @multilib_dir@ level. Build and install AIX-style FAT libraries. libgomp/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * Makefile.am (tmake_file): Build and install AIX-style FAT libraries. * Makefile.in: Regenerate * configure.ac (tmake_file): Substitute. * configure: Regenerate. * configure.tgt (powerpc-ibm-aix*): Define tmake_file. * config/t-aix: New file. libstdc++-v3/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * Makefile.am (tmake_file): Build and install AIX-style FAT libraries. * Makefile.in: Regenerate. * configure.ac (tmake_file): Substitute. * configure: Regenerate. * configure.host (aix*): Define tmake_file. * config/os/aix/t-aix: New file. libatomic/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * Makefile.am (tmake_file): Build and install AIX-style FAT libraries. * Makefile.in: Regenerate. * configure.ac (tmake_file): Substitute. * configure: Regenerate. * configure.tgt (powerpc-ibm-aix*): Define tmake_file. * config/t-aix: New file. libgfortran/ChangeLog 2020-06-21 David Edelsohn <dje.gcc@gmail.com> * Makefile.am (tmake_file): Build and install AIX-style FAT libraries. * Makefile.in: Regenerate. * configure.ac (tmake_file): Substitute. * configure: Regenerate. * configure.host: Add system configury stanza. Define tmake_file. * config/t-aix: New file.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/config.gcc6
-rw-r--r--gcc/config/rs6000/aix72.h89
-rw-r--r--gcc/config/rs6000/defaultaix64.h28
-rw-r--r--gcc/config/rs6000/t-aix6427
4 files changed, 128 insertions, 22 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 06ad813..365263a 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3040,8 +3040,12 @@ rs6000-ibm-aix7.1.* | powerpc-ibm-aix7.1.*)
default_use_cxa_atexit=yes
;;
rs6000-ibm-aix[789].* | powerpc-ibm-aix[789].*)
- tm_file="${tm_file} rs6000/aix.h rs6000/aix72.h rs6000/xcoff.h rs6000/aix-stdint.h"
tmake_file="rs6000/t-aix52 t-slibgcc"
+ if test x$cpu_is_64bit = xyes; then
+ tm_file="${tm_file} rs6000/biarch64.h rs6000/defaultaix64.h"
+ tmake_file="rs6000/t-aix64 t-slibgcc"
+ fi
+ tm_file="${tm_file} rs6000/aix.h rs6000/aix72.h rs6000/xcoff.h rs6000/aix-stdint.h"
extra_options="${extra_options} rs6000/aix64.opt"
use_collect2=yes
thread_file='aix'
diff --git a/gcc/config/rs6000/aix72.h b/gcc/config/rs6000/aix72.h
index 6cb1673..b0262af 100644
--- a/gcc/config/rs6000/aix72.h
+++ b/gcc/config/rs6000/aix72.h
@@ -64,8 +64,9 @@ do { \
} \
} while (0)
-#undef ASM_SPEC
-#define ASM_SPEC "-u %{maix64:-a64} %(asm_cpu)"
+#define ASM_SPEC32 "-a32"
+#define ASM_SPEC64 "-a64"
+#define ASM_SPEC_COMMON "-u %(asm_cpu)"
/* Common ASM definitions used by ASM_SPEC amongst the various targets for
handling -mcpu=xxx switches. There is a parallel list in driver-rs6000.c to
@@ -91,10 +92,7 @@ do { \
mcpu=620: -m620; \
mcpu=630: -m620; \
mcpu=970|mcpu=G5: -m970; \
- !mcpu*: %{mvsx: -mpwr6; \
- maltivec: -m970; \
- maix64|mpowerpc64: -mppc64; \
- : %(asm_default)}} \
+ !mcpu*: %(asm_default)} \
-many"
#undef ASM_DEFAULT_SPEC
@@ -115,19 +113,17 @@ do { \
} \
while (0)
-#undef CPP_SPEC
-#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
+#define CPP_SPEC32 ""
+#define CPP_SPEC64 "-D__64BIT__"
+#define CPP_SPEC_COMMON "%{posix: -D_POSIX_SOURCE} \
%{ansi: -D_ANSI_C_SOURCE} \
- %{maix64: -D__64BIT__} \
%{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
/* The GNU C++ standard library requires that these macros be
defined. Synchronize with libstdc++ os_defines.h. */
-#undef CPLUSPLUS_CPP_SPEC
-#define CPLUSPLUS_CPP_SPEC \
+#define CPLUSPLUS_CPP_SPEC_COMMON \
"-D_ALL_SOURCE -D__COMPATMATH__ \
- %{maix64: -D__64BIT__} \
%{mpe: -I%R/usr/lpp/ppe.poe/include} \
%{pthread: -D_THREAD_SAFE}"
@@ -135,8 +131,10 @@ do { \
#include "rs6000-cpus.def"
#undef RS6000_CPU
+#ifndef RS6000_BI_ARCH
#undef TARGET_DEFAULT
#define TARGET_DEFAULT ISA_2_6_MASKS_EMBEDDED
+#endif
#undef PROCESSOR_DEFAULT
#define PROCESSOR_DEFAULT PROCESSOR_POWER7
@@ -155,29 +153,78 @@ do { \
the target makefile fragment or if none of the options listed in
`MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */
-#undef MULTILIB_DEFAULTS
+#undef MULTILIB_DEFAULTS
-#undef LIB_SPEC
-#define LIB_SPEC "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
+#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
+
+#define LIB_SPEC32 "%{!shared:%{g*:-lg}}"
+#define LIB_SPEC64 ""
+#define LIB_SPEC_COMMON "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
%{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
- %{!maix64:%{!shared:%{g*:-lg}}}\
%{fprofile-arcs|fprofile-generate*|coverage:-lpthreads}\
%{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
%{mlong-double-128:-lc128}\
%{pthread:-lpthreads} -lc"
-#undef LINK_SPEC
-#define LINK_SPEC "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\
+#define LINK_SPEC32 "%{!shared:%{g*: %(link_libg) }} -b32"
+#define LINK_SPEC64 "-b64"
+#define LINK_SPEC_COMMON "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\
%{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
- %{!maix64:%{!shared:%{g*: %(link_libg) }}} %{maix64:-b64}\
- %{mpe:-binitfini:poe_remote_main}"
+ %{mpe:-binitfini:poe_remote_main} "
#undef STARTFILE_SPEC
+#if DEFAULT_ARCH64_P
+#define STARTFILE_SPEC "%{!shared:\
+ %{!maix32:%{pg:gcrt0_64%O%s;:%{p:mcrt0_64%O%s;:crt0_64%O%s}};:\
+ %{pthread:%{pg:gcrt0_r%O%s;:%{p:mcrt0_r%O%s;:crt0_r%O%s}};:\
+ %{pg:gcrt0%O%s;:%{p:mcrt0%O%s;:crt0%O%s}}}}}\
+ %{!maix32:%{shared:crtcxa_64_s%O%s;:crtcxa_64%O%s} crtdbase_64%O%s;:\
+ %{shared:crtcxa_s%O%s;:crtcxa%O%s} crtdbase%O%s}"
+#else
#define STARTFILE_SPEC "%{!shared:\
%{maix64:%{pg:gcrt0_64%O%s;:%{p:mcrt0_64%O%s;:crt0_64%O%s}};:\
%{pthread:%{pg:gcrt0_r%O%s;:%{p:mcrt0_r%O%s;:crt0_r%O%s}};:\
%{pg:gcrt0%O%s;:%{p:mcrt0%O%s;:crt0%O%s}}}}}\
- %{shared:crtcxa_s%O%s;:crtcxa%O%s} crtdbase%O%s"
+ %{maix64:%{shared:crtcxa_64_s%O%s;:crtcxa_64%O%s} crtdbase_64%O%s;:\
+ %{shared:crtcxa_s%O%s;:crtcxa%O%s} crtdbase%O%s}"
+#endif
+
+
+#undef ASM_SPEC
+#undef CPP_SPEC
+#undef CPLUSPLUS_CPP_SPEC
+#undef LIB_SPEC
+#undef LINK_SPEC
+
+#if DEFAULT_ARCH64_P
+#define ASM_SPEC "%{maix32:%(asm_spec32);:%(asm_spec64)} %(asm_spec_common)"
+#define CPP_SPEC "%{maix32:%(cpp_spec32);:%(cpp_spec64)} %(cpp_spec_common)"
+#define CPLUSPLUS_CPP_SPEC "%{maix32:%(cpp_spec32);:%(cpp_spec64)} %(cplusplus_cpp_spec_common)"
+#define LIB_SPEC "%{maix32:%(lib_spec32);:%(lib_spec64)} %(lib_spec_common)"
+#define LINK_SPEC "%{maix32:%(link_spec32);:%(link_spec64)} %(link_spec_common)"
+#else
+#define ASM_SPEC "%{maix64:%(asm_spec64);:%(asm_spec32)} %(asm_spec_common)"
+#define CPP_SPEC "%{maix64:%(cpp_spec64);:%(cpp_spec32)} %(cpp_spec_common)"
+#define CPLUSPLUS_CPP_SPEC "%{maix64:%(cpp_spec64);:%(cpp_spec32)} %(cplusplus_cpp_spec_common)"
+#define LIB_SPEC "%{maix64:%(lib_spec64);:%(lib_spec32)} %(lib_spec_common)"
+#define LINK_SPEC "%{maix64:%(link_spec64);:%(link_spec32)} %(link_spec_common)"
+#endif
+
+#undef SUBTARGET_EXTRA_SPECS
+#define SUBTARGET_EXTRA_SPECS \
+ { "asm_spec_common", ASM_SPEC_COMMON }, \
+ { "asm_spec32", ASM_SPEC32 }, \
+ { "asm_spec64", ASM_SPEC64 }, \
+ { "cpp_spec_common", CPP_SPEC_COMMON }, \
+ { "cplusplus_cpp_spec_common", CPLUSPLUS_CPP_SPEC_COMMON }, \
+ { "cpp_spec32", CPP_SPEC32 }, \
+ { "cpp_spec64", CPP_SPEC64 }, \
+ { "lib_spec_common", LIB_SPEC_COMMON }, \
+ { "lib_spec32", LIB_SPEC32 }, \
+ { "lib_spec64", LIB_SPEC64 }, \
+ { "link_spec_common", LINK_SPEC_COMMON }, \
+ { "link_spec32", LINK_SPEC32 }, \
+ { "link_spec64", LINK_SPEC64 },
/* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int". */
diff --git a/gcc/config/rs6000/defaultaix64.h b/gcc/config/rs6000/defaultaix64.h
new file mode 100644
index 0000000..ecac576
--- /dev/null
+++ b/gcc/config/rs6000/defaultaix64.h
@@ -0,0 +1,28 @@
+/* Definitions of target machine for GNU compiler,
+ for 64 bit powerpc linux defaulting to -m64.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#define RS6000_CPU(NAME, CPU, FLAGS)
+#include "rs6000-cpus.def"
+#undef RS6000_CPU
+
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT (ISA_2_6_MASKS_EMBEDDED | MASK_POWERPC64 | MASK_64BIT)
+#undef ASM_DEFAULT_SPEC
+#define ASM_DEFAULT_SPEC "-mpwr7"
diff --git a/gcc/config/rs6000/t-aix64 b/gcc/config/rs6000/t-aix64
new file mode 100644
index 0000000..8134e19
--- /dev/null
+++ b/gcc/config/rs6000/t-aix64
@@ -0,0 +1,27 @@
+# Copyright (C) 2002-2020 Free Software Foundation, Inc.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GCC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Build the libraries for pthread and all of the
+# different processor models
+
+MULTILIB_OPTIONS = pthread maix64/maix32
+
+MULTILIB_DIRNAMES = pthread ppc64 ppc32
+
+MULTILIB_MATCHES = .=maix32
+