/* Target definitions for GNU compiler for PowerPC running System V.4
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GCC.
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* Header files should be C++ aware in general. */
-#undef NO_IMPLICIT_EXTERN_C
-#define NO_IMPLICIT_EXTERN_C
+#undef GNU_USER_TARGET_CRTI
+#define GNU_USER_TARGET_CRTI "%{mnewlib:ecrti.o%s;:crti.o%s}"
+#undef GNU_USER_TARGET_CRTN
+#define GNU_USER_TARGET_CRTN "%{mnewlib:ecrtn.o%s;:crtn.o%s}"
/* Yes! We are ELF. */
#define TARGET_OBJECT_FORMAT OBJECT_ELF
/* Override rs6000.h definition. */
#undef ASM_DEFAULT_SPEC
-#define ASM_DEFAULT_SPEC "-mppc"
+#define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
-#define TARGET_TOC ((target_flags & MASK_64BIT) \
- || ((target_flags & (MASK_RELOCATABLE \
- | MASK_MINIMAL_TOC)) \
+#define TARGET_HAS_TOC (TARGET_64BIT \
+ || (TARGET_MINIMAL_TOC \
&& flag_pic > 1) \
- || DEFAULT_ABI == ABI_AIX)
+ || DEFAULT_ABI != ABI_V4)
#define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE)
#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN)
#define TARGET_PROTOTYPE target_prototype
#define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE)
-#define TARGET_NO_TOC (! TARGET_TOC)
#define TARGET_NO_EABI (! TARGET_EABI)
#define TARGET_REGNAMES rs6000_regnames
#define TARGET_SECURE_PLT secure_plt
#endif
+#if HAVE_AS_PLTSEQ
+#undef TARGET_PLTSEQ
+#define TARGET_PLTSEQ rs6000_pltseq
+#endif
+
#define SDATA_DEFAULT_SIZE 8
/* The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to
else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \
{ \
rs6000_current_abi = ABI_V4; \
- target_flags &= ~ MASK_EABI; \
+ rs6000_isa_flags &= ~ OPTION_MASK_EABI; \
} \
else if (!strcmp (rs6000_abi_name, "sysv-eabi") \
|| !strcmp (rs6000_abi_name, "eabi")) \
{ \
rs6000_current_abi = ABI_V4; \
- target_flags |= MASK_EABI; \
+ rs6000_isa_flags |= OPTION_MASK_EABI; \
} \
else if (!strcmp (rs6000_abi_name, "aixdesc")) \
rs6000_current_abi = ABI_AIX; \
- else if (!strcmp (rs6000_abi_name, "freebsd")) \
- rs6000_current_abi = ABI_V4; \
- else if (!strcmp (rs6000_abi_name, "linux")) \
+ else if (!strcmp (rs6000_abi_name, "freebsd") \
+ || !strcmp (rs6000_abi_name, "linux")) \
{ \
if (TARGET_64BIT) \
rs6000_current_abi = ABI_AIX; \
else \
rs6000_current_abi = ABI_V4; \
} \
- else if (!strcmp (rs6000_abi_name, "gnu")) \
- rs6000_current_abi = ABI_V4; \
else if (!strcmp (rs6000_abi_name, "netbsd")) \
rs6000_current_abi = ABI_V4; \
else if (!strcmp (rs6000_abi_name, "openbsd")) \
else if (!strcmp (rs6000_abi_name, "i960-old")) \
{ \
rs6000_current_abi = ABI_V4; \
- target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI); \
- target_flags &= ~MASK_STRICT_ALIGN; \
+ rs6000_isa_flags |= (OPTION_MASK_LITTLE_ENDIAN | OPTION_MASK_EABI); \
+ rs6000_isa_flags &= ~OPTION_MASK_STRICT_ALIGN; \
TARGET_NO_BITFIELD_WORD = 1; \
} \
else \
{ \
rs6000_current_abi = ABI_V4; \
- error ("bad value for -mcall-%s", rs6000_abi_name); \
+ error ("bad value for %<%s-%s%>", "-mcall", rs6000_abi_name); \
} \
\
if (rs6000_sdata_name) \
else if (!strcmp (rs6000_sdata_name, "eabi")) \
rs6000_sdata = SDATA_EABI; \
else \
- error ("bad value for -msdata=%s", rs6000_sdata_name); \
+ error ("bad value for %<%s=%s%>", "-msdata", rs6000_sdata_name);\
} \
else if (DEFAULT_ABI == ABI_V4) \
{ \
(rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \
{ \
rs6000_sdata = SDATA_DATA; \
- error ("-mrelocatable and -msdata=%s are incompatible", \
- rs6000_sdata_name); \
+ error ("%qs and %<%s=%s%> are incompatible", rs6000_sdata_name, \
+ "-mrelocatable", "-msdata"); \
} \
\
- else if (flag_pic && DEFAULT_ABI != ABI_AIX \
+ else if (flag_pic && DEFAULT_ABI == ABI_V4 \
&& (rs6000_sdata == SDATA_EABI \
|| rs6000_sdata == SDATA_SYSV)) \
{ \
rs6000_sdata = SDATA_DATA; \
- error ("-f%s and -msdata=%s are incompatible", \
+ error ("%<-f%s%> and %<%s=%s%> are incompatible", \
(flag_pic > 1) ? "PIC" : "pic", \
- rs6000_sdata_name); \
+ "-msdata", rs6000_sdata_name); \
} \
\
if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \
|| (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \
{ \
rs6000_sdata = SDATA_NONE; \
- error ("-msdata=%s and -mcall-%s are incompatible", \
- rs6000_sdata_name, rs6000_abi_name); \
+ error ("%<%s=%s%> and %<%s-%s%> are incompatible", \
+ "-msdata", rs6000_sdata_name, "-mcall", rs6000_abi_name); \
} \
\
targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \
\
if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \
{ \
- target_flags |= MASK_MINIMAL_TOC; \
- error ("-mrelocatable and -mno-minimal-toc are incompatible"); \
+ rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
+ error ("%qs and %qs are incompatible", "-mrelocatable", \
+ "-mno-minimal-toc"); \
} \
\
- if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \
+ if (TARGET_RELOCATABLE && rs6000_current_abi != ABI_V4) \
{ \
- target_flags &= ~MASK_RELOCATABLE; \
- error ("-mrelocatable and -mcall-%s are incompatible", \
- rs6000_abi_name); \
+ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
+ error ("%qs and %<%s-%s%> are incompatible", \
+ "-mrelocatable", "-mcall", rs6000_abi_name); \
} \
\
- if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \
+ if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi != ABI_V4) \
{ \
flag_pic = 0; \
- error ("-fPIC and -mcall-%s are incompatible", \
- rs6000_abi_name); \
+ error ("%qs and %<%s-%s%> are incompatible", \
+ "-fPIC", "-mcall", rs6000_abi_name); \
} \
\
- if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \
+ if (TARGET_SECURE_PLT != secure_plt) \
{ \
- target_flags &= ~MASK_LITTLE_ENDIAN; \
- error ("-mcall-aixdesc must be big endian"); \
+ error ("%qs not supported by your assembler", "-msecure-plt"); \
} \
\
- if (TARGET_SECURE_PLT != secure_plt) \
+ if (TARGET_PLTSEQ != rs6000_pltseq \
+ && global_options_set.x_rs6000_pltseq) \
+ { \
+ error ("%qs not supported by your assembler", "-mpltseq"); \
+ } \
+ \
+ if (DEFAULT_ABI == ABI_V4 && TARGET_PLTSEQ && !TARGET_SECURE_PLT) \
{ \
- error ("-msecure-plt not supported by your assembler"); \
+ if (global_options_set.x_rs6000_pltseq) \
+ { \
+ if (global_options_set.x_secure_plt) \
+ error ("%qs and %qs are incompatible", \
+ "-mpltseq", "-mbss-plt"); \
+ else \
+ secure_plt = true; \
+ } \
+ if (!TARGET_SECURE_PLT) \
+ rs6000_pltseq = false; \
} \
\
- /* Treat -fPIC the same as -mrelocatable. */ \
- if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \
+ if (flag_pic > 1 && DEFAULT_ABI == ABI_V4) \
{ \
- target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC; \
+ /* Note: flag_pic should not change any option flags that would \
+ be invalid with or pessimise -fno-PIC code. LTO turns off \
+ flag_pic when linking/recompiling a fixed position executable. \
+ However, if the objects were originally compiled with -fPIC, \
+ then other target options forced on here by -fPIC are restored \
+ when recompiling those objects without -fPIC. In particular \
+ TARGET_RELOCATABLE must not be enabled here by flag_pic. */ \
+ rs6000_isa_flags |= OPTION_MASK_MINIMAL_TOC; \
TARGET_NO_FP_IN_TOC = 1; \
} \
\
- else if (TARGET_RELOCATABLE) \
- if (!flag_pic) \
- flag_pic = 2; \
+ if (TARGET_RELOCATABLE) \
+ { \
+ if (!flag_pic) \
+ flag_pic = 2; \
+ TARGET_NO_FP_IN_TOC = 1; \
+ } \
} while (0)
#ifndef RS6000_BI_ARCH
# define SUBSUBTARGET_OVERRIDE_OPTIONS \
do { \
- if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \
- error ("-m%s not supported in this configuration", \
- (target_flags & MASK_64BIT) ? "64" : "32"); \
+ if ((TARGET_DEFAULT ^ rs6000_isa_flags) & OPTION_MASK_64BIT) \
+ error ("%<-m%s%> not supported in this configuration", \
+ (rs6000_isa_flags & OPTION_MASK_64BIT) ? "64" : "32"); \
} while (0)
#endif
/* Override rs6000.h definition. */
#undef TARGET_DEFAULT
-#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS)
+#define TARGET_DEFAULT 0
/* Override rs6000.h definition. */
#undef PROCESSOR_DEFAULT
#define PROCESSOR_DEFAULT PROCESSOR_PPC750
-/* SVR4 only defined for PowerPC, so short-circuit POWER patterns. */
-#undef TARGET_POWER
-#define TARGET_POWER 0
-
#define FIXED_R2 1
/* System V.4 uses register 13 as a pointer to the small data area,
so it is not available to the normal user. */
#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN)
#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN)
-/* Define cutoff for using external functions to save floating point.
- When optimizing for size, use external functions when profitable. */
-#define FP_SAVE_INLINE(FIRST_REG) (optimize_size \
- ? ((FIRST_REG) == 62 \
- || (FIRST_REG) == 63) \
- : (FIRST_REG) < 64)
-/* And similarly for general purpose registers. */
-#define GP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 32 \
- && !optimize_size)
-
/* Put jump tables in read-only memory, rather than in .text. */
#define JUMP_TABLES_IN_TEXT_SECTION 0
/* An expression for the alignment of a structure field FIELD if the
alignment computed in the usual way is COMPUTED. */
-#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \
- ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \
+#define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \
+ (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \
? 128 : COMPUTED)
#undef BIGGEST_FIELD_ALIGNMENT
/* Put PC relative got entries in .got2. */
#define MINIMAL_TOC_SECTION_ASM_OP \
- (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \
- ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
+ (flag_pic ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"")
#define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\""
#define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\""
#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
(TARGET_TOC \
- && (GET_CODE (X) == SYMBOL_REF \
+ && (SYMBOL_REF_P (X) \
|| (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
- && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
+ && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0))) \
|| GET_CODE (X) == LABEL_REF \
- || (GET_CODE (X) == CONST_INT \
+ || (CONST_INT_P (X) \
&& GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
|| (!TARGET_NO_FP_IN_TOC \
- && !TARGET_RELOCATABLE \
- && GET_CODE (X) == CONST_DOUBLE \
+ && CONST_DOUBLE_P (X) \
&& SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
&& BITS_PER_WORD == HOST_BITS_PER_INT)))
{ \
fprintf (FILE, "%s", LCOMM_ASM_OP); \
assemble_name ((FILE), (NAME)); \
- fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
+ fprintf ((FILE), "," HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \
(SIZE), (ALIGN) / BITS_PER_UNIT); \
} \
ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \
do { \
if (DEFAULT_ABI == ABI_V4) \
asm_fprintf (FILE, \
- "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \
+ "\tstwu %s,-16(%s)\n\tstw %s,12(%s)\n", \
reg_names[1], reg_names[1], reg_names[REGNO], \
reg_names[1]); \
} while (0)
do { \
if (DEFAULT_ABI == ABI_V4) \
asm_fprintf (FILE, \
- "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \
+ "\tlwz %s,12(%s)\n\taddi %s,%s,16\n", \
reg_names[REGNO], reg_names[1], reg_names[1], \
reg_names[1]); \
} while (0)
#define DBX_FUNCTION_FIRST
/* This is the end of what might become sysv4dbx.h. */
-
-#ifndef TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)");
-#endif
\f
#define TARGET_OS_SYSV_CPP_BUILTINS() \
do \
{ \
- if (target_flags_explicit \
- & MASK_RELOCATABLE) \
+ if (rs6000_isa_flags_explicit \
+ & OPTION_MASK_RELOCATABLE) \
builtin_define ("_RELOCATABLE"); \
} \
while (0)
while (0)
#endif
+/* Select one of BIG_OPT, LITTLE_OPT or DEFAULT_OPT depending
+ on various -mbig, -mlittle and -mcall- options. */
+#define ENDIAN_SELECT(BIG_OPT, LITTLE_OPT, DEFAULT_OPT) \
+"%{mlittle|mlittle-endian:" LITTLE_OPT ";" \
+ "mbig|mbig-endian:" BIG_OPT ";" \
+ "mcall-i960-old:" LITTLE_OPT ";" \
+ ":" DEFAULT_OPT "}"
+
+#define DEFAULT_ASM_ENDIAN " -mbig"
+
#undef ASM_SPEC
#define ASM_SPEC "%(asm_cpu) \
%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \
-%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
-%{memb|msdata=eabi: -memb} \
-%{mlittle|mlittle-endian:-mlittle; \
- mbig|mbig-endian :-mbig; \
- mcall-aixdesc | \
- mcall-freebsd | \
- mcall-netbsd | \
- mcall-openbsd | \
- mcall-linux | \
- mcall-gnu :-mbig; \
- mcall-i960-old :-mlittle}"
-
-#define CC1_ENDIAN_BIG_SPEC ""
-
-#define CC1_ENDIAN_LITTLE_SPEC "\
-%{!mstrict-align: %{!mno-strict-align: \
- %{!mcall-i960-old: \
- -mstrict-align \
- } \
-}}"
-
-#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)"
+%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
+%{memb|msdata=eabi: -memb}" \
+ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
#ifndef CC1_SECURE_PLT_DEFAULT_SPEC
#define CC1_SECURE_PLT_DEFAULT_SPEC ""
#endif
+#ifndef LINK_SECURE_PLT_DEFAULT_SPEC
+#define LINK_SECURE_PLT_DEFAULT_SPEC ""
+#endif
-/* Pass -G xxx to the compiler and set correct endian mode. */
-#define CC1_SPEC "%{G*} %(cc1_cpu) \
-%{mlittle|mlittle-endian: %(cc1_endian_little); \
- mbig |mbig-endian : %(cc1_endian_big); \
- mcall-aixdesc | \
- mcall-freebsd | \
- mcall-netbsd | \
- mcall-openbsd | \
- mcall-linux | \
- mcall-gnu : -mbig %(cc1_endian_big); \
- mcall-i960-old : -mlittle %(cc1_endian_little); \
- : %(cc1_endian_default)} \
-%{meabi: %{!mcall-*: -mcall-sysv }} \
+/* Pass -G xxx to the compiler. */
+#undef CC1_SPEC
+#define CC1_SPEC "%{G*} %(cc1_cpu)" \
+"%{meabi: %{!mcall-*: -mcall-sysv }} \
%{!meabi: %{!mno-eabi: \
%{mrelocatable: -meabi } \
%{mcall-freebsd: -mno-eabi } \
%{mcall-i960-old: -meabi } \
%{mcall-linux: -mno-eabi } \
- %{mcall-gnu: -mno-eabi } \
%{mcall-netbsd: -mno-eabi } \
%{mcall-openbsd: -mno-eabi }}} \
%{msdata: -msdata=default} \
%{mno-sdata: -msdata=none} \
-%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \
-%{profile: -p}"
+%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}}" \
+GNU_USER_TARGET_CC1_SPEC
/* Default starting address if specified. */
#define LINK_START_SPEC "\
msim : %(link_start_sim) ; \
mcall-freebsd: %(link_start_freebsd) ; \
mcall-linux : %(link_start_linux) ; \
- mcall-gnu : %(link_start_gnu) ; \
mcall-netbsd : %(link_start_netbsd) ; \
mcall-openbsd: %(link_start_openbsd) ; \
: %(link_start_default) }"
#define LINK_START_DEFAULT_SPEC ""
+#define LINK_SECURE_PLT_SPEC LINK_SECURE_PLT_DEFAULT_SPEC
#undef LINK_SPEC
#define LINK_SPEC "\
%{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \
-%{YP,*} %{R*} \
-%{Qy:} %{!Qn:-Qy} \
+%{R*} \
%(link_shlib) \
%{!T*: %(link_start) } \
-%(link_target) \
+%{!static: %{!mbss-plt: %(link_secure_plt)}} \
%(link_os)"
/* Shared libraries are not default. */
%{shared:-G -dy -z text } \
%{symbolic:-Bsymbolic -G -dy -z text }"
-/* Override the default target of the linker. */
-#define LINK_TARGET_SPEC "\
-%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \
-%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \
- %{mcall-i960-old: --oformat elf32-powerpcle} \
- }}}}"
-
/* Any specific OS flags. */
#define LINK_OS_SPEC "\
%{mads : %(link_os_ads) ; \
msim : %(link_os_sim) ; \
mcall-freebsd: %(link_os_freebsd) ; \
mcall-linux : %(link_os_linux) ; \
- mcall-gnu : %(link_os_gnu) ; \
mcall-netbsd : %(link_os_netbsd) ; \
mcall-openbsd: %(link_os_openbsd) ; \
: %(link_os_default) }"
#define LINK_OS_DEFAULT_SPEC ""
-#define DRIVER_SELF_SPECS "%{mfpu=none: %<mfpu=* \
- %<msingle-float %<mdouble-float}"
-
/* Override rs6000.h definition. */
#undef CPP_SPEC
#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \
msim : %(cpp_os_sim) ; \
mcall-freebsd: %(cpp_os_freebsd) ; \
mcall-linux : %(cpp_os_linux) ; \
- mcall-gnu : %(cpp_os_gnu) ; \
mcall-netbsd : %(cpp_os_netbsd) ; \
mcall-openbsd: %(cpp_os_openbsd) ; \
: %(cpp_os_default) }"
msim : %(startfile_sim) ; \
mcall-freebsd: %(startfile_freebsd) ; \
mcall-linux : %(startfile_linux) ; \
- mcall-gnu : %(startfile_gnu) ; \
mcall-netbsd : %(startfile_netbsd) ; \
mcall-openbsd: %(startfile_openbsd) ; \
: %(startfile_default) }"
msim : %(lib_sim) ; \
mcall-freebsd: %(lib_freebsd) ; \
mcall-linux : %(lib_linux) ; \
- mcall-gnu : %(lib_gnu) ; \
mcall-netbsd : %(lib_netbsd) ; \
mcall-openbsd: %(lib_openbsd) ; \
: %(lib_default) }"
msim : %(endfile_sim) ; \
mcall-freebsd: %(endfile_freebsd) ; \
mcall-linux : %(endfile_linux) ; \
- mcall-gnu : %(endfile_gnu) ; \
mcall-netbsd : %(endfile_netbsd) ; \
mcall-openbsd: %(endfile_openbsd) ; \
: %(crtsavres_default) %(endfile_default) }"
%{symbolic:-Bsymbolic}"
/* GNU/Linux support. */
-#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \
-%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \
-%{!shared: %{profile:-lc_p} %{!profile:-lc}}}"
-
-#ifdef HAVE_LD_PIE
-#define STARTFILE_LINUX_SPEC "\
-%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \
-%{mnewlib:ecrti.o%s;:crti.o%s} \
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#else
-#define STARTFILE_LINUX_SPEC "\
-%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \
-%{mnewlib:ecrti.o%s;:crti.o%s} \
-%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
-#endif
+#define LIB_LINUX_SPEC \
+ "%{mnewlib: --start-group -llinux -lc --end-group; \
+ :" GNU_USER_TARGET_LIB_SPEC "}"
-#define ENDFILE_LINUX_SPEC "\
-%{shared|pie:crtendS.o%s;:crtend.o%s} \
-%{mnewlib:ecrtn.o%s;:crtn.o%s}"
+#define STARTFILE_LINUX_SPEC GNU_USER_TARGET_STARTFILE_SPEC
+
+#define ENDFILE_LINUX_SPEC GNU_USER_TARGET_ENDFILE_SPEC
#define LINK_START_LINUX_SPEC ""
-#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
-#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
-#if DEFAULT_LIBC == LIBC_UCLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
-#elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
-#else
-#error "Unsupported DEFAULT_LIBC"
-#endif
-#define LINUX_DYNAMIC_LINKER \
- CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
+#define MUSL_DYNAMIC_LINKER_E ENDIAN_SELECT("","le","")
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
- %{rdynamic:-export-dynamic} \
- -dynamic-linker " LINUX_DYNAMIC_LINKER "}}"
+#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+#undef MUSL_DYNAMIC_LINKER
+#define MUSL_DYNAMIC_LINKER \
+ "/lib/ld-musl-powerpc" MUSL_DYNAMIC_LINKER_E "%{msoft-float:-sf}.so.1"
-#if defined(HAVE_LD_EH_FRAME_HDR)
-# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#ifndef GNU_USER_DYNAMIC_LINKER
+#define GNU_USER_DYNAMIC_LINKER GLIBC_DYNAMIC_LINKER
#endif
-#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \
-%{!undef: \
- %{!ansi: \
- %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \
- %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \
--Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
-
-/* GNU/Hurd support. */
-#define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \
-%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \
-%{profile:-lc_p} %{!profile:-lc}}}"
-
-#define STARTFILE_GNU_SPEC "\
-%{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \
-%{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \
-%{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \
-%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-#define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \
-%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}"
-
-#define LINK_START_GNU_SPEC ""
-
-#define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
- -dynamic-linker /lib/ld.so.1}}"
+ -dynamic-linker " GNU_USER_DYNAMIC_LINKER "}}"
-#define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \
-%{!undef: \
- %{!ansi: -Dunix -D__unix}} \
--Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}"
+#define CPP_OS_LINUX_SPEC "%{pthread:-D_REENTRANT}"
/* NetBSD support. */
#define LIB_NETBSD_SPEC "\
-%{profile:-lgmon -lc_p} %{!profile:-lc}"
+-lc"
#define STARTFILE_NETBSD_SPEC "\
ncrti.o%s crt0.o%s \
{ "lib_mvme", LIB_MVME_SPEC }, \
{ "lib_sim", LIB_SIM_SPEC }, \
{ "lib_freebsd", LIB_FREEBSD_SPEC }, \
- { "lib_gnu", LIB_GNU_SPEC }, \
{ "lib_linux", LIB_LINUX_SPEC }, \
{ "lib_netbsd", LIB_NETBSD_SPEC }, \
{ "lib_openbsd", LIB_OPENBSD_SPEC }, \
{ "startfile_mvme", STARTFILE_MVME_SPEC }, \
{ "startfile_sim", STARTFILE_SIM_SPEC }, \
{ "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \
- { "startfile_gnu", STARTFILE_GNU_SPEC }, \
{ "startfile_linux", STARTFILE_LINUX_SPEC }, \
{ "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \
{ "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \
{ "endfile_mvme", ENDFILE_MVME_SPEC }, \
{ "endfile_sim", ENDFILE_SIM_SPEC }, \
{ "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \
- { "endfile_gnu", ENDFILE_GNU_SPEC }, \
{ "endfile_linux", ENDFILE_LINUX_SPEC }, \
{ "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \
{ "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \
{ "endfile_default", ENDFILE_DEFAULT_SPEC }, \
{ "link_shlib", LINK_SHLIB_SPEC }, \
- { "link_target", LINK_TARGET_SPEC }, \
{ "link_start", LINK_START_SPEC }, \
{ "link_start_ads", LINK_START_ADS_SPEC }, \
{ "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \
{ "link_start_mvme", LINK_START_MVME_SPEC }, \
{ "link_start_sim", LINK_START_SIM_SPEC }, \
{ "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \
- { "link_start_gnu", LINK_START_GNU_SPEC }, \
{ "link_start_linux", LINK_START_LINUX_SPEC }, \
{ "link_start_netbsd", LINK_START_NETBSD_SPEC }, \
{ "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \
{ "link_os_sim", LINK_OS_SIM_SPEC }, \
{ "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \
{ "link_os_linux", LINK_OS_LINUX_SPEC }, \
- { "link_os_gnu", LINK_OS_GNU_SPEC }, \
{ "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \
{ "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \
{ "link_os_default", LINK_OS_DEFAULT_SPEC }, \
- { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \
- { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \
- { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \
{ "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \
+ { "link_secure_plt", LINK_SECURE_PLT_SPEC }, \
{ "cpp_os_ads", CPP_OS_ADS_SPEC }, \
{ "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \
{ "cpp_os_mvme", CPP_OS_MVME_SPEC }, \
{ "cpp_os_sim", CPP_OS_SIM_SPEC }, \
{ "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \
- { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \
{ "cpp_os_linux", CPP_OS_LINUX_SPEC }, \
{ "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \
{ "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \
/* Select a format to encode pointers in exception handling data. CODE
is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is
true if the symbol may be affected by dynamic relocations. */
-#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \
- ((flag_pic || TARGET_RELOCATABLE) \
- ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \
+#define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \
+ (flag_pic \
+ ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \
+ | DW_EH_PE_sdata4) \
: DW_EH_PE_absptr)
#define DOUBLE_INT_ASM_OP "\t.quad\t"
/* Generate entries in .fixup for relocatable addresses. */
#define RELOCATABLE_NEEDS_FIXUP 1
+#define TARGET_ASM_FILE_END rs6000_elf_file_end
+
+#undef TARGET_ASAN_SHADOW_OFFSET
+#define TARGET_ASAN_SHADOW_OFFSET rs6000_asan_shadow_offset
+
/* This target uses the sysv4.opt file. */
#define TARGET_USES_SYSV4_OPT 1
-#undef DBX_REGISTER_NUMBER
+/* Include order changes for musl, same as in generic linux.h. */
+#if DEFAULT_LIBC == LIBC_MUSL
+#define INCLUDE_DEFAULTS_MUSL_GPP \
+ { GPLUSPLUS_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 }, \
+ { GPLUSPLUS_TOOL_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 1 }, \
+ { GPLUSPLUS_BACKWARD_INCLUDE_DIR, "G++", 1, 1, \
+ GPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT, 0 },
+
+#ifdef LOCAL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_LOCAL \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 2 }, \
+ { LOCAL_INCLUDE_DIR, 0, 0, 1, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_LOCAL
+#endif
+
+#ifdef PREFIX_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_PREFIX \
+ { PREFIX_INCLUDE_DIR, 0, 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_PREFIX
+#endif
+
+#ifdef CROSS_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_CROSS \
+ { CROSS_INCLUDE_DIR, "GCC", 0, 0, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#ifdef TOOL_INCLUDE_DIR
+#define INCLUDE_DEFAULTS_MUSL_TOOL \
+ { TOOL_INCLUDE_DIR, "BINUTILS", 0, 1, 0, 0},
+#else
+#define INCLUDE_DEFAULTS_MUSL_TOOL
+#endif
+
+#ifdef NATIVE_SYSTEM_HEADER_DIR
+#define INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 2 }, \
+ { NATIVE_SYSTEM_HEADER_DIR, 0, 0, 0, 1, 0 },
+#else
+#define INCLUDE_DEFAULTS_MUSL_NATIVE
+#endif
+
+#if defined (CROSS_DIRECTORY_STRUCTURE) && !defined (TARGET_SYSTEM_ROOT)
+# undef INCLUDE_DEFAULTS_MUSL_LOCAL
+# define INCLUDE_DEFAULTS_MUSL_LOCAL
+# undef INCLUDE_DEFAULTS_MUSL_NATIVE
+# define INCLUDE_DEFAULTS_MUSL_NATIVE
+#else
+# undef INCLUDE_DEFAULTS_MUSL_CROSS
+# define INCLUDE_DEFAULTS_MUSL_CROSS
+#endif
+
+#undef INCLUDE_DEFAULTS
+#define INCLUDE_DEFAULTS \
+ { \
+ INCLUDE_DEFAULTS_MUSL_GPP \
+ INCLUDE_DEFAULTS_MUSL_LOCAL \
+ INCLUDE_DEFAULTS_MUSL_PREFIX \
+ INCLUDE_DEFAULTS_MUSL_CROSS \
+ INCLUDE_DEFAULTS_MUSL_TOOL \
+ INCLUDE_DEFAULTS_MUSL_NATIVE \
+ { GCC_INCLUDE_DIR, "GCC", 0, 1, 0, 0 }, \
+ { 0, 0, 0, 0, 0, 0 } \
+ }
+#endif