aix: Support GCC64 for AIX 7.1.
authorDavid Edelsohn <dje.gcc@gmail.com>
Fri, 24 Jul 2020 19:05:42 +0000 (15:05 -0400)
committerDavid Edelsohn <dje.gcc@gmail.com>
Fri, 24 Jul 2020 23:57:14 +0000 (19:57 -0400)
gcc/ChangeLog:

2020-07-24  David Edelsohn  <dje.gcc@gmail.com>
    Clement Chigot  <clement.chigot@atos.net>

* config.gcc (powerpc-ibm-aix7.1): Use t-aix64 and biarch64 for
cpu_is_64bit.
* config/rs6000/aix71.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): Use 64 bit mask if 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/aix72.h (TARGET_DEFAULT): Use 64 bit mask if BIARCH.
* config/rs6000/defaultaix64.h: Delete.

gcc/config.gcc
gcc/config/rs6000/aix71.h
gcc/config/rs6000/aix72.h
gcc/config/rs6000/defaultaix64.h [deleted file]

index 30b51c3dc81e85f9e072b36b860b2d3b17952c53..23703681deb7bf08bafc03882d14b4fcf4890552 100644 (file)
@@ -3031,8 +3031,12 @@ rs6000-ibm-aix6.* | powerpc-ibm-aix6.*)
        default_use_cxa_atexit=yes
        ;;
 rs6000-ibm-aix7.1.* | powerpc-ibm-aix7.1.*)
-       tm_file="${tm_file} rs6000/aix.h rs6000/aix71.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"
+           tmake_file="rs6000/t-aix64 t-slibgcc"
+       fi
+       tm_file="${tm_file} rs6000/aix.h rs6000/aix71.h rs6000/xcoff.h rs6000/aix-stdint.h"
        extra_options="${extra_options} rs6000/aix64.opt"
        use_collect2=yes
        thread_file='aix'
@@ -3042,7 +3046,7 @@ rs6000-ibm-aix7.1.* | powerpc-ibm-aix7.1.*)
 rs6000-ibm-aix[789].* | powerpc-ibm-aix[789].*)
        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"
+           tm_file="${tm_file} rs6000/biarch64.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"
index 5f98eb05fc6f68abb904c7f5fda7d5d841586550..8b12a2d12c856e9349065e5254ce699b20eceb6b 100644 (file)
@@ -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
@@ -114,19 +112,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,7 +131,11 @@ do {                                                                       \
 #undef RS6000_CPU
 
 #undef  TARGET_DEFAULT
+#ifdef RS6000_BI_ARCH
+#define TARGET_DEFAULT (MASK_PPC_GPOPT | MASK_PPC_GFXOPT | MASK_MFCRF | MASK_POWERPC64 | MASK_64BIT)
+#else
 #define TARGET_DEFAULT (MASK_PPC_GPOPT | MASK_PPC_GFXOPT | MASK_MFCRF)
+#endif
 
 #undef  PROCESSOR_DEFAULT
 #define PROCESSOR_DEFAULT PROCESSOR_POWER7
@@ -154,29 +154,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".  */
 
index b0262afb2602e2a3f5620252c31f17196ba4b68a..121420b4360926cc141a453f41b230ca25a76860 100644 (file)
@@ -131,8 +131,10 @@ do {                                                                       \
 #include "rs6000-cpus.def"
 #undef RS6000_CPU
 
-#ifndef RS6000_BI_ARCH
 #undef  TARGET_DEFAULT
+#ifdef RS6000_BI_ARCH
+#define TARGET_DEFAULT (ISA_2_6_MASKS_EMBEDDED | MASK_POWERPC64 | MASK_64BIT)
+#else
 #define TARGET_DEFAULT ISA_2_6_MASKS_EMBEDDED
 #endif
 
diff --git a/gcc/config/rs6000/defaultaix64.h b/gcc/config/rs6000/defaultaix64.h
deleted file mode 100644 (file)
index ecac576..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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"