(root)/
gcc-13.2.0/
gcc/
config/
rs6000/
aix72.h
       1  // SPDX-License-Identifier: GPL-3.0-or-later
       2  /* Definitions of target machine for GNU compiler,
       3     for IBM RS/6000 POWER running AIX V7.2.
       4     Copyright (C) 2002-2023 Free Software Foundation, Inc.
       5     Contributed by David Edelsohn (edelsohn@gnu.org).
       6  
       7     This file is part of GCC.
       8  
       9     GCC is free software; you can redistribute it and/or modify it
      10     under the terms of the GNU General Public License as published
      11     by the Free Software Foundation; either version 3, or (at your
      12     option) any later version.
      13  
      14     GCC is distributed in the hope that it will be useful, but WITHOUT
      15     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
      16     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      17     License for more details.
      18  
      19     You should have received a copy of the GNU General Public License
      20     along with GCC; see the file COPYING3.  If not see
      21     <http://www.gnu.org/licenses/>.  */
      22  
      23  /* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
      24     get control in TARGET_OPTION_OVERRIDE.  */
      25  
      26  #define SUBTARGET_OVERRIDE_OPTIONS					\
      27  do {									\
      28    if (TARGET_64BIT && ! TARGET_POWERPC64)				\
      29      {									\
      30        rs6000_isa_flags |= OPTION_MASK_POWERPC64;			\
      31        warning (0, "%<-maix64%> requires PowerPC64 architecture remain enabled"); \
      32      }									\
      33    if (TARGET_SOFT_FLOAT && TARGET_LONG_DOUBLE_128)			\
      34      {									\
      35        rs6000_long_double_type_size = 64;				\
      36        if (OPTION_SET_P (rs6000_long_double_type_size))		\
      37  	warning (0, "soft-float and long-double-128 are incompatible");	\
      38      }									\
      39    if (TARGET_POWERPC64 && ! TARGET_64BIT)				\
      40      {									\
      41        error ("%<-maix64%> required: 64-bit computation with 32-bit addressing not yet supported"); \
      42      }									\
      43    if ((rs6000_isa_flags_explicit					\
      44         & OPTION_MASK_MINIMAL_TOC) != 0)					\
      45      {									\
      46        if (OPTION_SET_P (rs6000_current_cmodel)			\
      47  	  && rs6000_current_cmodel != CMODEL_SMALL)			\
      48  	error ("%<-mcmodel%> incompatible with other toc options"); 	\
      49        SET_CMODEL (CMODEL_SMALL);					\
      50      }									\
      51    if (rs6000_current_cmodel != CMODEL_SMALL)				\
      52      {									\
      53        TARGET_NO_FP_IN_TOC = 1;						\
      54        TARGET_NO_SUM_IN_TOC = 1;						\
      55      }									\
      56    if (rs6000_current_cmodel == CMODEL_MEDIUM)				\
      57      {									\
      58        rs6000_current_cmodel = CMODEL_LARGE;				\
      59      }									\
      60    if (! strcmp (lang_hooks.name, "GNU Go")				\
      61        && TARGET_32BIT)							\
      62      {									\
      63        /* aix/ppc doesn't support -mvsx and -maltivec with Go */		\
      64        rs6000_isa_flags &= ~(OPTION_MASK_VSX | OPTION_MASK_ALTIVEC);	\
      65      }									\
      66    if (!OPTION_SET_P (dwarf_version))				\
      67      /* AIX only supports DWARF 4.  */					\
      68      dwarf_version = 4;							\
      69  } while (0)
      70  
      71  #define ASM_SPEC32 "-a32"
      72  #define ASM_SPEC64 "-a64"
      73  #define ASM_SPEC_COMMON "-u %(asm_cpu)"
      74  
      75  /* Common ASM definitions used by ASM_SPEC amongst the various targets for
      76     handling -mcpu=xxx switches.  There is a parallel list in driver-rs6000.cc to
      77     provide the default assembler options if the user uses -mcpu=native, so if
      78     you make changes here, make them there also.  */
      79  #undef ASM_CPU_SPEC
      80  #define ASM_CPU_SPEC \
      81  "%{mcpu=native: %(asm_cpu_native); \
      82    mcpu=power10: -mpwr10; \
      83    mcpu=power9: -mpwr9; \
      84    mcpu=power8: -mpwr8; \
      85    mcpu=power7: -mpwr7; \
      86    mcpu=power6x|mcpu=power6: -mpwr6; \
      87    mcpu=power5+: -mpwr5x; \
      88    mcpu=power5: -mpwr5; \
      89    mcpu=power4: -mpwr4; \
      90    mcpu=power3: -m620; \
      91    mcpu=powerpc: -mppc; \
      92    mcpu=rs64: -mppc; \
      93    mcpu=603: -m603; \
      94    mcpu=603e: -m603; \
      95    mcpu=604: -m604; \
      96    mcpu=604e: -m604; \
      97    mcpu=620: -m620; \
      98    mcpu=630: -m620; \
      99    mcpu=970|mcpu=G5: -m970; \
     100    !mcpu*: %(asm_default)} \
     101  -many"
     102  
     103  #undef	ASM_DEFAULT_SPEC
     104  #define ASM_DEFAULT_SPEC "-mpwr7"
     105  
     106  #undef TARGET_OS_CPP_BUILTINS
     107  #define TARGET_OS_CPP_BUILTINS()     \
     108    do                                 \
     109      {                                \
     110        builtin_define ("_AIX43");     \
     111        builtin_define ("_AIX51");     \
     112        builtin_define ("_AIX52");     \
     113        builtin_define ("_AIX53");     \
     114        builtin_define ("_AIX61");     \
     115        builtin_define ("_AIX71");     \
     116        builtin_define ("_AIX72");     \
     117        TARGET_OS_AIX_CPP_BUILTINS (); \
     118      }                                \
     119    while (0)
     120  
     121  #define CPP_SPEC32 ""
     122  #define CPP_SPEC64 "-D__64BIT__"
     123  #define CPP_SPEC_COMMON "%{posix: -D_POSIX_SOURCE} \
     124    %{ansi: -D_ANSI_C_SOURCE}			\
     125    %{mpe: -I%R/usr/lpp/ppe.poe/include}		\
     126    %{pthread: -D_THREAD_SAFE}"
     127  
     128  /* The GNU C++ standard library requires that these macros be
     129     defined.  Synchronize with libstdc++ os_defines.h.  */
     130  #define CPLUSPLUS_CPP_SPEC_COMMON		\
     131    "-D_ALL_SOURCE -D__COMPATMATH__		\
     132     %{mpe: -I%R/usr/lpp/ppe.poe/include}		\
     133     %{pthread: -D_THREAD_SAFE}"
     134  
     135  #define RS6000_CPU(NAME, CPU, FLAGS)
     136  #include "rs6000-cpus.def"
     137  #undef RS6000_CPU
     138  
     139  #undef  TARGET_DEFAULT
     140  #ifdef RS6000_BI_ARCH
     141  #define TARGET_DEFAULT (ISA_2_6_MASKS_EMBEDDED | MASK_POWERPC64 | MASK_64BIT)
     142  #else
     143  #define TARGET_DEFAULT ISA_2_6_MASKS_EMBEDDED
     144  #endif
     145  
     146  #undef  PROCESSOR_DEFAULT
     147  #define PROCESSOR_DEFAULT PROCESSOR_POWER7
     148  #undef  PROCESSOR_DEFAULT64
     149  #define PROCESSOR_DEFAULT64 PROCESSOR_POWER7
     150  
     151  /* AIX 7.2 kernel and assembler have necessary support for Altivec and VSX.  */
     152  #undef OS_MISSING_ALTIVEC
     153  
     154  /* Define this macro as a C expression for the initializer of an
     155     array of string to tell the driver program which options are
     156     defaults for this target and thus do not need to be handled
     157     specially when using `MULTILIB_OPTIONS'.
     158  
     159     Do not define this macro if `MULTILIB_OPTIONS' is not defined in
     160     the target makefile fragment or if none of the options listed in
     161     `MULTILIB_OPTIONS' are set by default.  *Note Target Fragment::.  */
     162  
     163  #undef MULTILIB_DEFAULTS
     164  
     165  #define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
     166  
     167  #define LIB_SPEC32 "%{!shared:%{g*:-lg}}"
     168  #define LIB_SPEC64 ""
     169  #define LIB_SPEC_COMMON "%{pg:-L%R/lib/profiled -L%R/usr/lib/profiled}\
     170     %{p:-L%R/lib/profiled -L%R/usr/lib/profiled}\
     171     %{fprofile-arcs|fprofile-generate*|coverage:-lpthreads}\
     172     %{mpe:-L%R/usr/lpp/ppe.poe/lib -lmpi -lvtd}\
     173     %{mlong-double-128:-lc128}\
     174     %{pthread:-lpthreads} -lc"
     175  
     176  #define LINK_SPEC32 "%{!shared:%{g*: %(link_libg) }} -b32"
     177  #define LINK_SPEC64 "-b64"
     178  #define LINK_SPEC_COMMON "-bpT:0x10000000 -bpD:0x20000000 %{!r:-btextro}\
     179     %{static:-bnso %(link_syscalls) } %{shared:-bM:SRE %{!e:-bnoentry}}\
     180     %{mpe:-binitfini:poe_remote_main} "
     181  
     182  #undef STARTFILE_SPEC
     183  #if DEFAULT_ARCH64_P
     184  #define STARTFILE_SPEC "%{!shared:\
     185     %{!maix32:%{pg:gcrt0_64%O%s;:%{p:mcrt0_64%O%s;:crt0_64%O%s}};:\
     186       %{pthread:%{pg:gcrt0_r%O%s;:%{p:mcrt0_r%O%s;:crt0_r%O%s}};:\
     187         %{pg:gcrt0%O%s;:%{p:mcrt0%O%s;:crt0%O%s}}}}}\
     188     %{!maix32:%{shared:crtcxa_64_s%O%s;:crtcxa_64%O%s} crtdbase_64%O%s;:\
     189       %{shared:crtcxa_s%O%s;:crtcxa%O%s} crtdbase%O%s}"
     190  #else
     191  #define STARTFILE_SPEC "%{!shared:\
     192     %{maix64:%{pg:gcrt0_64%O%s;:%{p:mcrt0_64%O%s;:crt0_64%O%s}};:\
     193       %{pthread:%{pg:gcrt0_r%O%s;:%{p:mcrt0_r%O%s;:crt0_r%O%s}};:\
     194         %{pg:gcrt0%O%s;:%{p:mcrt0%O%s;:crt0%O%s}}}}}\
     195     %{maix64:%{shared:crtcxa_64_s%O%s;:crtcxa_64%O%s} crtdbase_64%O%s;:\
     196       %{shared:crtcxa_s%O%s;:crtcxa%O%s} crtdbase%O%s}"
     197  #endif
     198  
     199  
     200  #undef ASM_SPEC
     201  #undef CPP_SPEC
     202  #undef CPLUSPLUS_CPP_SPEC
     203  #undef LIB_SPEC
     204  #undef LINK_SPEC
     205  
     206  #if DEFAULT_ARCH64_P
     207  #define ASM_SPEC "%{maix32:%(asm_spec32);:%(asm_spec64)} %(asm_spec_common)"
     208  #define CPP_SPEC "%{maix32:%(cpp_spec32);:%(cpp_spec64)} %(cpp_spec_common)"
     209  #define CPLUSPLUS_CPP_SPEC "%{maix32:%(cpp_spec32);:%(cpp_spec64)} %(cplusplus_cpp_spec_common)"
     210  #define LIB_SPEC "%{maix32:%(lib_spec32);:%(lib_spec64)} %(lib_spec_common)"
     211  #define LINK_SPEC "%{maix32:%(link_spec32);:%(link_spec64)} %(link_spec_common)"
     212  #else
     213  #define ASM_SPEC "%{maix64:%(asm_spec64);:%(asm_spec32)} %(asm_spec_common)"
     214  #define CPP_SPEC "%{maix64:%(cpp_spec64);:%(cpp_spec32)} %(cpp_spec_common)"
     215  #define CPLUSPLUS_CPP_SPEC "%{maix64:%(cpp_spec64);:%(cpp_spec32)} %(cplusplus_cpp_spec_common)"
     216  #define LIB_SPEC "%{maix64:%(lib_spec64);:%(lib_spec32)} %(lib_spec_common)"
     217  #define LINK_SPEC "%{maix64:%(link_spec64);:%(link_spec32)} %(link_spec_common)"
     218  #endif
     219  
     220  #undef SUBTARGET_EXTRA_SPECS
     221  #define SUBTARGET_EXTRA_SPECS					\
     222    { "asm_spec_common",		ASM_SPEC_COMMON },		\
     223    { "asm_spec32",		ASM_SPEC32 },			\
     224    { "asm_spec64",		ASM_SPEC64 },			\
     225    { "cpp_spec_common",		CPP_SPEC_COMMON },		\
     226    { "cplusplus_cpp_spec_common", CPLUSPLUS_CPP_SPEC_COMMON },	\
     227    { "cpp_spec32",		CPP_SPEC32 },			\
     228    { "cpp_spec64",		CPP_SPEC64 },			\
     229    { "lib_spec_common",		LIB_SPEC_COMMON },		\
     230    { "lib_spec32",		LIB_SPEC32 },			\
     231    { "lib_spec64",		LIB_SPEC64 },			\
     232    { "link_spec_common",		LINK_SPEC_COMMON },		\
     233    { "link_spec32",		LINK_SPEC32 },			\
     234    { "link_spec64",		LINK_SPEC64 },
     235  
     236  /* AIX V5 typedefs ptrdiff_t as "long" while earlier releases used "int".  */
     237  
     238  #undef PTRDIFF_TYPE
     239  #define PTRDIFF_TYPE "long int"
     240  
     241  /* Type used for wchar_t, as a string used in a declaration.  */
     242  #undef  WCHAR_TYPE
     243  #define WCHAR_TYPE (!TARGET_64BIT ? "short unsigned int" : "unsigned int")
     244  
     245  /* Width of wchar_t in bits.  */
     246  #undef  WCHAR_TYPE_SIZE
     247  #define WCHAR_TYPE_SIZE (!TARGET_64BIT ? 16 : 32)
     248  
     249  /* AIX 4.2 and above provides initialization and finalization function
     250     support from linker command line.  */
     251  #undef HAS_INIT_SECTION
     252  #define HAS_INIT_SECTION
     253  
     254  #undef LD_INIT_SWITCH
     255  #define LD_INIT_SWITCH "-binitfini"
     256  
     257  #ifndef _AIX52
     258  extern long long int    atoll(const char *);
     259  #endif
     260  
     261  /* This target uses the aix64.opt file.  */
     262  #define TARGET_USES_AIX64_OPT 1
     263  
     264  /* Large TOC Support */
     265  #ifdef HAVE_LD_LARGE_TOC
     266  #undef TARGET_CMODEL
     267  #define TARGET_CMODEL rs6000_current_cmodel
     268  #define SET_CMODEL(opt) rs6000_current_cmodel = opt
     269  #else
     270  #define SET_CMODEL(opt) do {} while (0)
     271  #endif
     272  
     273  /* System headers are not C++-aware.  */
     274  #define SYSTEM_IMPLICIT_EXTERN_C 1
     275  
     276  /* This target defines SUPPORTS_WEAK and TARGET_ASM_NAMED_SECTION,
     277     but does not have crtbegin/end.  */
     278  
     279  #define TARGET_AIX_VERSION 72
     280  
     281  /* AIX 7.2 supports DWARF3+ debugging.  */
     282  #define DWARF2_DEBUGGING_INFO 1
     283  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
     284  #define DEBUG_INFO_SECTION	"0x10000"
     285  #define DEBUG_LINE_SECTION	"0x20000"
     286  #define DEBUG_PUBNAMES_SECTION	"0x30000"
     287  #define DEBUG_PUBTYPES_SECTION	"0x40000"
     288  #define DEBUG_ARANGES_SECTION	"0x50000"
     289  #define DEBUG_ABBREV_SECTION	"0x60000"
     290  #define DEBUG_STR_SECTION	"0x70000"
     291  #define DEBUG_RANGES_SECTION	"0x80000"
     292  #define DEBUG_LOC_SECTION	"0x90000"
     293  #define DEBUG_FRAME_SECTION	"0xA0000"
     294  #define DEBUG_MACINFO_SECTION	"0xB0000"
     295  #define DEBUG_MACRO_SECTION	"0xB0000"
     296