1  /* Definitions of target machine for GNU compiler,
       2     for 64 bit PowerPC linux.
       3     Copyright (C) 2000-2023 Free Software Foundation, Inc.
       4  
       5     This file is part of GCC.
       6  
       7     GCC is free software; you can redistribute it and/or modify it
       8     under the terms of the GNU General Public License as published
       9     by the Free Software Foundation; either version 3, or (at your
      10     option) any later version.
      11  
      12     GCC is distributed in the hope that it will be useful, but WITHOUT
      13     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
      14     or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
      15     License for more details.
      16  
      17     Under Section 7 of GPL version 3, you are granted additional
      18     permissions described in the GCC Runtime Library Exception, version
      19     3.1, as published by the Free Software Foundation.
      20  
      21     You should have received a copy of the GNU General Public License and
      22     a copy of the GCC Runtime Library Exception along with this program;
      23     see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
      24     <http://www.gnu.org/licenses/>.  */
      25  
      26  #ifndef RS6000_BI_ARCH
      27  
      28  #undef	TARGET_64BIT
      29  #define	TARGET_64BIT 1
      30  
      31  #define	DEFAULT_ARCH64_P 1
      32  #define	RS6000_BI_ARCH_P 0
      33  
      34  #else
      35  
      36  #define	DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT)
      37  #define	RS6000_BI_ARCH_P 1
      38  
      39  #endif
      40  
      41  #ifdef IN_LIBGCC2
      42  #undef TARGET_64BIT
      43  #ifdef __powerpc64__
      44  #define TARGET_64BIT 1
      45  #else
      46  #define TARGET_64BIT 0
      47  #endif
      48  #endif
      49  
      50  #undef	TARGET_AIX
      51  #define	TARGET_AIX TARGET_64BIT
      52  
      53  #ifdef HAVE_LD_NO_DOT_SYMS
      54  /* New ABI uses a local sym for the function entry point.  */
      55  extern int dot_symbols;
      56  #undef DOT_SYMBOLS
      57  #define DOT_SYMBOLS dot_symbols
      58  #endif
      59  
      60  #define TARGET_PROFILE_KERNEL profile_kernel
      61  
      62  #undef TARGET_KEEP_LEAF_WHEN_PROFILED
      63  #define TARGET_KEEP_LEAF_WHEN_PROFILED rs6000_keep_leaf_when_profiled
      64  
      65  #define TARGET_USES_LINUX64_OPT 1
      66  #ifdef HAVE_LD_LARGE_TOC
      67  #undef TARGET_CMODEL
      68  #define TARGET_CMODEL rs6000_current_cmodel
      69  #define SET_CMODEL(opt) rs6000_current_cmodel = opt
      70  #else
      71  #define SET_CMODEL(opt) do {} while (0)
      72  #endif
      73  
      74  #undef  PROCESSOR_DEFAULT
      75  #define PROCESSOR_DEFAULT PROCESSOR_POWER7
      76  #undef  PROCESSOR_DEFAULT64
      77  #define PROCESSOR_DEFAULT64 PROCESSOR_POWER8
      78  
      79  /* We don't need to generate entries in .fixup, except when
      80     -mrelocatable or -mrelocatable-lib is given.  */
      81  #undef RELOCATABLE_NEEDS_FIXUP
      82  #define RELOCATABLE_NEEDS_FIXUP \
      83    (rs6000_isa_flags & rs6000_isa_flags_explicit & OPTION_MASK_RELOCATABLE)
      84  
      85  #undef	RS6000_ABI_NAME
      86  #define	RS6000_ABI_NAME "linux"
      87  
      88  #define INVALID_64BIT "%<-m%s%> not supported in this configuration"
      89  #define INVALID_32BIT INVALID_64BIT
      90  
      91  #ifdef LINUX64_DEFAULT_ABI_ELFv2
      92  #define ELFv2_ABI_CHECK (rs6000_elf_abi != 1)
      93  #else
      94  #define ELFv2_ABI_CHECK (rs6000_elf_abi == 2)
      95  #endif
      96  
      97  #undef	SUBSUBTARGET_OVERRIDE_OPTIONS
      98  #define	SUBSUBTARGET_OVERRIDE_OPTIONS				\
      99    do rs6000_linux64_override_options (); while (0)
     100  
     101  #undef	ASM_SPEC
     102  #undef	LINK_OS_LINUX_SPEC
     103  #undef	LINK_SECURE_PLT_SPEC
     104  
     105  #ifndef	RS6000_BI_ARCH
     106  #define	ASM_SPEC	 "%(asm_spec64) %(asm_spec_common)"
     107  #define	LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)"
     108  #define	LINK_SECURE_PLT_SPEC ""
     109  #else
     110  #if DEFAULT_ARCH64_P
     111  #define	ASM_SPEC	 "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)"
     112  #define	LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}"
     113  #define	LINK_SECURE_PLT_SPEC "%{m32: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
     114  #else
     115  #define	ASM_SPEC	 "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
     116  #define	LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}"
     117  #define	LINK_SECURE_PLT_SPEC "%{!m64: " LINK_SECURE_PLT_DEFAULT_SPEC "}"
     118  #endif
     119  #endif
     120  
     121  #define ASM_SPEC32 "-a32 \
     122  %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
     123  %{memb|msdata=eabi: -memb}"
     124  
     125  #define ASM_SPEC64 "-a64"
     126  
     127  #define ASM_SPEC_COMMON "%(asm_cpu) \
     128  %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
     129    ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
     130  
     131  #undef	SUBSUBTARGET_EXTRA_SPECS
     132  #define SUBSUBTARGET_EXTRA_SPECS \
     133    { "asm_spec_common",		ASM_SPEC_COMMON },			\
     134    { "asm_spec32",		ASM_SPEC32 },				\
     135    { "asm_spec64",		ASM_SPEC64 },				\
     136    { "link_os_linux_spec32",	LINK_OS_LINUX_SPEC32 },			\
     137    { "link_os_linux_spec64",	LINK_OS_LINUX_SPEC64 },			\
     138    { "link_os_extra_spec32",	LINK_OS_EXTRA_SPEC32 },			\
     139    { "link_os_extra_spec64",	LINK_OS_EXTRA_SPEC64 },			\
     140    { "link_os_new_dtags",	LINK_OS_NEW_DTAGS_SPEC },		\
     141    { "include_extra",		INCLUDE_EXTRA_SPEC },			\
     142    { "dynamic_linker_prefix",	DYNAMIC_LINKER_PREFIX },
     143  
     144  /* Optional specs used for overriding the system include directory, default
     145     -rpath links, and prefix for the dynamic linker.  Normally, there are not
     146     defined, but if the user configure with the --with-advance-toolchain=<xxx>
     147     option, the advance-toolchain.h file will override these.  */
     148  #ifndef INCLUDE_EXTRA_SPEC
     149  #define INCLUDE_EXTRA_SPEC	""
     150  #endif
     151  
     152  #ifndef LINK_OS_EXTRA_SPEC32
     153  #define LINK_OS_EXTRA_SPEC32	""
     154  #endif
     155  
     156  #ifndef LINK_OS_EXTRA_SPEC64
     157  #define LINK_OS_EXTRA_SPEC64	""
     158  #endif
     159  
     160  #ifndef LINK_OS_NEW_DTAGS_SPEC
     161  #define LINK_OS_NEW_DTAGS_SPEC	""
     162  #endif
     163  
     164  #ifndef DYNAMIC_LINKER_PREFIX
     165  #define DYNAMIC_LINKER_PREFIX	""
     166  #endif
     167  
     168  #undef	MULTILIB_DEFAULTS
     169  #if DEFAULT_ARCH64_P
     170  #define MULTILIB_DEFAULTS { "m64" }
     171  #else
     172  #define MULTILIB_DEFAULTS { "m32" }
     173  #endif
     174  
     175  /* Split stack is only supported for 64 bit, and requires glibc >= 2.18.  */
     176  #if TARGET_GLIBC_MAJOR * 1000 + TARGET_GLIBC_MINOR >= 2018
     177  # ifndef RS6000_BI_ARCH
     178  #  define TARGET_CAN_SPLIT_STACK
     179  # else
     180  #  if DEFAULT_ARCH64_P
     181  /* Supported, and the default is -m64  */
     182  #   define TARGET_CAN_SPLIT_STACK_64BIT 1
     183  #  else
     184  /* Supported, and the default is -m32  */
     185  #   define TARGET_CAN_SPLIT_STACK_64BIT 0
     186  #  endif
     187  # endif
     188  #endif
     189  
     190  #ifndef RS6000_BI_ARCH
     191  
     192  /* 64-bit PowerPC Linux always has a TOC.  */
     193  #undef  TARGET_HAS_TOC
     194  #define TARGET_HAS_TOC		1
     195  
     196  /* Some things from sysv4.h we don't do when 64 bit.  */
     197  #undef	OPTION_RELOCATABLE
     198  #define	OPTION_RELOCATABLE	0
     199  #undef	OPTION_EABI
     200  #define	OPTION_EABI		0
     201  #undef	OPTION_PROTOTYPE
     202  #define	OPTION_PROTOTYPE	0
     203  #undef RELOCATABLE_NEEDS_FIXUP
     204  #define RELOCATABLE_NEEDS_FIXUP 0
     205  
     206  #endif
     207  
     208  /* We use glibc _mcount for profiling.  */
     209  #define NO_PROFILE_COUNTERS 1
     210  #define PROFILE_HOOK(LABEL) \
     211    do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
     212  
     213  /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given.  */
     214  #undef  ADJUST_FIELD_ALIGN
     215  #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
     216    ((TARGET_64BIT							\
     217      && TARGET_ALIGN_NATURAL == 0					\
     218      && TYPE_MODE (strip_array_types (TYPE)) == DFmode)			\
     219     ? MIN ((COMPUTED), 32)						\
     220     : (COMPUTED))
     221  
     222  /* PowerPC64 Linux increases natural record alignment to doubleword if
     223     the first field is an FP double, only if in power alignment mode.  */
     224  #undef  ROUND_TYPE_ALIGN
     225  #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
     226    ((TARGET_64BIT							\
     227      && (TREE_CODE (STRUCT) == RECORD_TYPE				\
     228  	|| TREE_CODE (STRUCT) == UNION_TYPE				\
     229  	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
     230      && TARGET_ALIGN_NATURAL == 0)					\
     231     ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
     232     : MAX ((COMPUTED), (SPECIFIED)))
     233  
     234  /* Use the default for compiling target libs.  */
     235  #ifdef IN_TARGET_LIBS
     236  #undef TARGET_ALIGN_NATURAL
     237  #define TARGET_ALIGN_NATURAL 1
     238  #endif
     239  
     240  /* Indicate that jump tables go in the text section.  */
     241  #undef  JUMP_TABLES_IN_TEXT_SECTION
     242  #define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT
     243  
     244  /* The linux ppc64 ABI isn't explicit on whether aggregates smaller
     245     than a doubleword should be padded upward or downward.  You could
     246     reasonably assume that they follow the normal rules for structure
     247     layout treating the parameter area as any other block of memory,
     248     then map the reg param area to registers.  i.e. pad upward.
     249     Setting both of the following defines results in this behavior.
     250     Setting just the first one will result in aggregates that fit in a
     251     doubleword being padded downward, and others being padded upward.
     252     Not a bad idea as this results in struct { int x; } being passed
     253     the same way as an int.  */
     254  #define AGGREGATE_PADDING_FIXED TARGET_64BIT
     255  #define AGGREGATES_PAD_UPWARD_ALWAYS 0
     256  
     257  /* Specify padding for the last element of a block move between
     258     registers and memory.  FIRST is nonzero if this is the only
     259     element.  */
     260  #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
     261    (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
     262  
     263  /* Linux doesn't support saving and restoring 64-bit regs in a 32-bit
     264     process.  */
     265  #define OS_MISSING_POWERPC64 !TARGET_64BIT
     266  
     267  #ifdef SINGLE_LIBC
     268  #define OPTION_GLIBC_P(opts)	(DEFAULT_LIBC == LIBC_GLIBC)
     269  #define OPTION_UCLIBC_P(opts)	(DEFAULT_LIBC == LIBC_UCLIBC)
     270  #define OPTION_BIONIC_P(opts)	(DEFAULT_LIBC == LIBC_BIONIC)
     271  #undef OPTION_MUSL_P
     272  #define OPTION_MUSL_P(opts)	(DEFAULT_LIBC == LIBC_MUSL)
     273  #else
     274  #define OPTION_GLIBC_P(opts)	((opts)->x_linux_libc == LIBC_GLIBC)
     275  #define OPTION_UCLIBC_P(opts)	((opts)->x_linux_libc == LIBC_UCLIBC)
     276  #define OPTION_BIONIC_P(opts)	((opts)->x_linux_libc == LIBC_BIONIC)
     277  #undef OPTION_MUSL_P
     278  #define OPTION_MUSL_P(opts)	((opts)->x_linux_libc == LIBC_MUSL)
     279  #endif
     280  #define OPTION_GLIBC		OPTION_GLIBC_P (&global_options)
     281  #define OPTION_UCLIBC		OPTION_UCLIBC_P (&global_options)
     282  #define OPTION_BIONIC		OPTION_BIONIC_P (&global_options)
     283  #undef OPTION_MUSL
     284  #define OPTION_MUSL		OPTION_MUSL_P (&global_options)
     285  
     286  /* Determine what functions are present at the runtime;
     287     this includes full c99 runtime and sincos.  */
     288  #undef TARGET_LIBC_HAS_FUNCTION
     289  #define TARGET_LIBC_HAS_FUNCTION linux_libc_has_function
     290  
     291  #undef  TARGET_OS_CPP_BUILTINS
     292  #define TARGET_OS_CPP_BUILTINS()			\
     293    do							\
     294      {							\
     295        if (strcmp (rs6000_abi_name, "linux") == 0	\
     296  	  || strcmp (rs6000_abi_name, "aixdesc") == 0)	\
     297  	GNU_USER_TARGET_OS_CPP_BUILTINS();		\
     298        if (TARGET_64BIT)					\
     299  	{						\
     300  	  builtin_define ("__PPC__");			\
     301  	  builtin_define ("__PPC64__");			\
     302  	  builtin_define ("__powerpc__");		\
     303  	  builtin_define ("__powerpc64__");		\
     304  	  if (!DOT_SYMBOLS)				\
     305  	    builtin_define ("_CALL_LINUX");		\
     306  	  builtin_assert ("cpu=powerpc64");		\
     307  	  builtin_assert ("machine=powerpc64");		\
     308  	}						\
     309        else						\
     310  	{						\
     311  	  builtin_define_std ("PPC");			\
     312  	  builtin_define_std ("powerpc");		\
     313  	  builtin_assert ("cpu=powerpc");		\
     314  	  builtin_assert ("machine=powerpc");		\
     315  	  TARGET_OS_SYSV_CPP_BUILTINS ();		\
     316  	}						\
     317      }							\
     318    while (0)
     319  
     320  #undef  CPP_OS_DEFAULT_SPEC
     321  #define CPP_OS_DEFAULT_SPEC "%(cpp_os_linux) %(include_extra)"
     322  
     323  #undef  LINK_SHLIB_SPEC
     324  #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}} \
     325    %{static-pie:-static -pie --no-dynamic-linker -z text}"
     326  
     327  #undef  LIB_DEFAULT_SPEC
     328  #define LIB_DEFAULT_SPEC "%(lib_linux)"
     329  
     330  #undef  STARTFILE_DEFAULT_SPEC
     331  #define STARTFILE_DEFAULT_SPEC "%(startfile_linux)"
     332  
     333  #undef	ENDFILE_DEFAULT_SPEC
     334  #define ENDFILE_DEFAULT_SPEC "%(endfile_linux)"
     335  
     336  #undef	LINK_START_DEFAULT_SPEC
     337  #define LINK_START_DEFAULT_SPEC "%(link_start_linux)"
     338  
     339  #undef	LINK_OS_DEFAULT_SPEC
     340  #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)"
     341  
     342  #define GLIBC_DYNAMIC_LINKER32 "%(dynamic_linker_prefix)/lib/ld.so.1"
     343  
     344  #ifdef LINUX64_DEFAULT_ABI_ELFv2
     345  #define GLIBC_DYNAMIC_LINKER64 \
     346  "%{mabi=elfv1:%(dynamic_linker_prefix)/lib64/ld64.so.1;" \
     347  ":%(dynamic_linker_prefix)/lib64/ld64.so.2}"
     348  #else
     349  #define GLIBC_DYNAMIC_LINKER64 \
     350  "%{mabi=elfv2:%(dynamic_linker_prefix)/lib64/ld64.so.2;" \
     351  ":%(dynamic_linker_prefix)/lib64/ld64.so.1}"
     352  #endif
     353  
     354  #undef MUSL_DYNAMIC_LINKER32
     355  #define MUSL_DYNAMIC_LINKER32 \
     356    "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
     357  #undef MUSL_DYNAMIC_LINKER64
     358  #define MUSL_DYNAMIC_LINKER64 \
     359    "/lib/ld-musl-powerpc64" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
     360  
     361  #undef  DEFAULT_ASM_ENDIAN
     362  #if (TARGET_DEFAULT & MASK_LITTLE_ENDIAN)
     363  #define DEFAULT_ASM_ENDIAN " -mlittle"
     364  #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
     365  					   " -m elf32lppclinux",	\
     366  					   " -m elf32lppclinux")
     367  #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc",		\
     368  					   " -m elf64lppc",		\
     369  					   " -m elf64lppc")
     370  #else
     371  #define DEFAULT_ASM_ENDIAN " -mbig"
     372  #define LINK_OS_LINUX_EMUL32 ENDIAN_SELECT(" -m elf32ppclinux",		\
     373  					   " -m elf32lppclinux",	\
     374  					   " -m elf32ppclinux")
     375  #define LINK_OS_LINUX_EMUL64 ENDIAN_SELECT(" -m elf64ppc",		\
     376  					   " -m elf64lppc",		\
     377  					   " -m elf64ppc")
     378  #endif
     379  
     380  #define LINK_OS_LINUX_SPEC32 LINK_OS_LINUX_EMUL32 " %{!shared: %{!static: \
     381    %{!static-pie: \
     382      %{rdynamic:-export-dynamic} \
     383      -dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "}}} \
     384    %(link_os_extra_spec32)"
     385  
     386  #define LINK_OS_LINUX_SPEC64 LINK_OS_LINUX_EMUL64 " %{!shared: %{!static: \
     387    %{!static-pie: \
     388      %{rdynamic:-export-dynamic} \
     389      -dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "}}} \
     390    %(link_os_extra_spec64)"
     391  
     392  /* Use gnu-user.h LINK_GCC_SEQUENCE_SPEC for linux.  */
     393  #undef LINK_GCC_C_SEQUENCE_SPEC
     394  #define	LINK_GCC_C_SEQUENCE_SPEC \
     395    "%{mads|myellowknife|mmvme|msim:%G %L %G;" \
     396    "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \
     397    ":%G %L %G}"
     398  
     399  #undef  TOC_SECTION_ASM_OP
     400  #define TOC_SECTION_ASM_OP \
     401    (TARGET_64BIT						\
     402     ? "\t.section\t\".toc\",\"aw\""			\
     403     : "\t.section\t\".got\",\"aw\"")
     404  
     405  #undef  MINIMAL_TOC_SECTION_ASM_OP
     406  #define MINIMAL_TOC_SECTION_ASM_OP \
     407    (TARGET_64BIT						\
     408     ? "\t.section\t\".toc1\",\"aw\""			\
     409     : (flag_pic						\
     410        ? "\t.section\t\".got2\",\"aw\""			\
     411        : "\t.section\t\".got1\",\"aw\""))
     412  
     413  /* Must be at least as big as our pointer type.  */
     414  #undef	SIZE_TYPE
     415  #define	SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
     416  
     417  #undef	PTRDIFF_TYPE
     418  #define	PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
     419  
     420  #undef	WCHAR_TYPE
     421  #define	WCHAR_TYPE (TARGET_64BIT ? "int" : "long int")
     422  #undef  WCHAR_TYPE_SIZE
     423  #define WCHAR_TYPE_SIZE 32
     424  
     425  #undef  RS6000_MCOUNT
     426  #define RS6000_MCOUNT "_mcount"
     427  
     428  #ifdef __powerpc64__
     429  /* _init and _fini functions are built from bits spread across many
     430     object files, each potentially with a different TOC pointer.  For
     431     that reason, place a nop after the call so that the linker can
     432     restore the TOC pointer if a TOC adjusting call stub is needed.  */
     433  #if DOT_SYMBOLS
     434  #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
     435    asm (SECTION_OP "\n"					\
     436  "	bl ." #FUNC "\n"				\
     437  "	nop\n"						\
     438  "	.previous");
     439  #else
     440  #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC)	\
     441    asm (SECTION_OP "\n"					\
     442  "	bl " #FUNC "\n"					\
     443  "	nop\n"						\
     444  "	.previous");
     445  #endif
     446  #endif
     447  
     448  /* FP save and restore routines.  */
     449  #undef  SAVE_FP_PREFIX
     450  #define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
     451  #undef  SAVE_FP_SUFFIX
     452  #define SAVE_FP_SUFFIX ""
     453  #undef  RESTORE_FP_PREFIX
     454  #define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
     455  #undef  RESTORE_FP_SUFFIX
     456  #define RESTORE_FP_SUFFIX ""
     457  
     458  /* Dwarf2 debugging.  */
     459  #undef  PREFERRED_DEBUGGING_TYPE
     460  #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG
     461  
     462  /* This is how to declare the size of a function.  */
     463  #undef	ASM_DECLARE_FUNCTION_SIZE
     464  #define	ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL)			\
     465    do									\
     466      {									\
     467        if (!flag_inhibit_size_directive)					\
     468  	{								\
     469  	  fputs ("\t.size\t", (FILE));					\
     470  	  if (TARGET_64BIT && DOT_SYMBOLS)				\
     471  	    putc ('.', (FILE));						\
     472  	  assemble_name ((FILE), (FNAME));				\
     473  	  fputs (",.-", (FILE));					\
     474  	  rs6000_output_function_entry (FILE, FNAME);			\
     475  	  putc ('\n', (FILE));						\
     476  	}								\
     477      }									\
     478    while (0)
     479  
     480  /* Return nonzero if this entry is to be written into the constant
     481     pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
     482     or a CONST containing one of them.  If -mfp-in-toc (the default),
     483     we also do this for floating-point constants.  We actually can only
     484     do this if the FP formats of the target and host machines are the
     485     same, but we can't check that since not every file that uses
     486     the macros includes real.h.  We also do this when we can write an
     487     integer into the TOC and the entry is not larger than a TOC entry,
     488     but not for -mcmodel=medium where we'll use a toc-relative load for
     489     constants outside the TOC.  */
     490  
     491  #undef  ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
     492  #define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE)			\
     493    (TARGET_TOC								\
     494     && (SYMBOL_REF_P (X)							\
     495         || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
     496  	   && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
     497         || GET_CODE (X) == LABEL_REF					\
     498         || (CONST_INT_P (X)						\
     499  	   && TARGET_CMODEL != CMODEL_MEDIUM				\
     500  	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
     501         || (CONST_DOUBLE_P (X)						\
     502  	   && ((TARGET_64BIT						\
     503  		&& (TARGET_MINIMAL_TOC					\
     504  		    || (SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
     505  			&& ! TARGET_NO_FP_IN_TOC)))			\
     506  	       || (!TARGET_64BIT					\
     507  		   && !TARGET_NO_FP_IN_TOC				\
     508  		   && SCALAR_FLOAT_MODE_P (GET_MODE (X))		\
     509  		   && BITS_PER_WORD == HOST_BITS_PER_INT)))))
     510  
     511  /* Select a format to encode pointers in exception handling data.  CODE
     512     is 0 for data, 1 for code labels, 2 for function pointers.  GLOBAL is
     513     true if the symbol may be affected by dynamic relocations.  */
     514  #undef	ASM_PREFERRED_EH_DATA_FORMAT
     515  #define	ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
     516    (TARGET_64BIT || flag_pic						\
     517     ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel		\
     518        | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4))		\
     519     : DW_EH_PE_absptr)
     520  
     521  /* For backward compatibility, we must continue to use the AIX
     522     structure return convention.  */
     523  #undef DRAFT_V4_STRUCT_RET
     524  #define DRAFT_V4_STRUCT_RET (!TARGET_64BIT)
     525  
     526  #ifdef TARGET_LIBC_PROVIDES_SSP
     527  /* ppc32 glibc provides __stack_chk_guard in -0x7008(2),
     528     ppc64 glibc provides it at -0x7010(13).  */
     529  #define TARGET_THREAD_SSP_OFFSET	(TARGET_64BIT ? -0x7010 : -0x7008)
     530  #endif
     531  
     532  #define POWERPC_LINUX
     533  
     534  /* ppc{32,64} linux has 128-bit long double support in glibc 2.4 and later.  */
     535  #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
     536  #define RS6000_DEFAULT_LONG_DOUBLE_SIZE 128
     537  #endif
     538  
     539  /* Static stack checking is supported by means of probes.  */
     540  #define STACK_CHECK_STATIC_BUILTIN 1
     541  
     542  /* The default value isn't sufficient in 64-bit mode.  */
     543  #define STACK_CHECK_PROTECT (TARGET_64BIT ? 16 * 1024 : 12 * 1024)
     544  
     545  /* Software floating point support for exceptions and rounding modes
     546     depends on the C library in use.  */
     547  #undef TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P
     548  #define TARGET_FLOAT_EXCEPTIONS_ROUNDING_SUPPORTED_P \
     549    rs6000_linux_float_exceptions_rounding_supported_p
     550  
     551  /* Support for TARGET_ATOMIC_ASSIGN_EXPAND_FENV without FPRs depends
     552     on glibc 2.19 or greater.  */
     553  #if TARGET_GLIBC_MAJOR > 2 \
     554    || (TARGET_GLIBC_MAJOR == 2 && TARGET_GLIBC_MINOR >= 19)
     555  #define RS6000_GLIBC_ATOMIC_FENV 1
     556  #endif
     557  
     558  /* The IEEE 128-bit emulator is only built on Linux systems.  Flag that we
     559     should enable the type handling for KFmode on VSX systems even if we are not
     560     enabling the __float128 keyword.  */
     561  #undef	TARGET_FLOAT128_ENABLE_TYPE
     562  #define TARGET_FLOAT128_ENABLE_TYPE 1
     563  
     564  /* Enable using prefixed PC-relative addressing on POWER10 if the ABI
     565     supports it.  The ELF v2 ABI only supports PC-relative relocations for
     566     the medium code model.  */
     567  #define PCREL_SUPPORTED_BY_OS	(TARGET_POWER10 && TARGET_PREFIXED	\
     568  				 && ELFv2_ABI_CHECK			\
     569  				 && TARGET_CMODEL == CMODEL_MEDIUM)