190075Sobrien/* Target definitions for GNU compiler for PowerPC running System V.4 2132718Skan Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 3169689Skan 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 490075Sobrien Contributed by Cygnus Support. 590075Sobrien 6132718Skan This file is part of GCC. 790075Sobrien 8132718Skan GCC is free software; you can redistribute it and/or modify it 9132718Skan under the terms of the GNU General Public License as published 10132718Skan by the Free Software Foundation; either version 2, or (at your 11132718Skan option) any later version. 1290075Sobrien 13132718Skan GCC is distributed in the hope that it will be useful, but WITHOUT 14132718Skan ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15132718Skan or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 16132718Skan License for more details. 1790075Sobrien 18132718Skan You should have received a copy of the GNU General Public License 19132718Skan along with GCC; see the file COPYING. If not, write to the 20169689Skan Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 21169689Skan MA 02110-1301, USA. */ 2290075Sobrien 23117395Skan/* Header files should be C++ aware in general. */ 24169689Skan#undef NO_IMPLICIT_EXTERN_C 25117395Skan#define NO_IMPLICIT_EXTERN_C 26117395Skan 2790075Sobrien/* Yes! We are ELF. */ 2890075Sobrien#define TARGET_OBJECT_FORMAT OBJECT_ELF 2990075Sobrien 3090075Sobrien/* Default ABI to compile code for. */ 3190075Sobrien#define DEFAULT_ABI rs6000_current_abi 3290075Sobrien 3390075Sobrien/* Default ABI to use. */ 3490075Sobrien#define RS6000_ABI_NAME "sysv" 3590075Sobrien 3690075Sobrien/* Override rs6000.h definition. */ 3790075Sobrien#undef ASM_DEFAULT_SPEC 3890075Sobrien#define ASM_DEFAULT_SPEC "-mppc" 3990075Sobrien 4090075Sobrien/* Small data support types. */ 4190075Sobrienenum rs6000_sdata_type { 4290075Sobrien SDATA_NONE, /* No small data support. */ 4390075Sobrien SDATA_DATA, /* Just put data in .sbss/.sdata, don't use relocs. */ 4490075Sobrien SDATA_SYSV, /* Use r13 to point to .sdata/.sbss. */ 4590075Sobrien SDATA_EABI /* Use r13 like above, r2 points to .sdata2/.sbss2. */ 4690075Sobrien}; 4790075Sobrien 4890075Sobrienextern enum rs6000_sdata_type rs6000_sdata; 4990075Sobrien 5090075Sobrien#define TARGET_TOC ((target_flags & MASK_64BIT) \ 5190075Sobrien || ((target_flags & (MASK_RELOCATABLE \ 5290075Sobrien | MASK_MINIMAL_TOC)) \ 5390075Sobrien && flag_pic > 1) \ 5490075Sobrien || DEFAULT_ABI == ABI_AIX) 5590075Sobrien 5690075Sobrien#define TARGET_BITFIELD_TYPE (! TARGET_NO_BITFIELD_TYPE) 5790075Sobrien#define TARGET_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) 5890075Sobrien#define TARGET_NO_PROTOTYPE (! TARGET_PROTOTYPE) 5990075Sobrien#define TARGET_NO_TOC (! TARGET_TOC) 6090075Sobrien#define TARGET_NO_EABI (! TARGET_EABI) 6190075Sobrien 62169689Skan#ifdef HAVE_AS_REL16 63169689Skan#undef TARGET_SECURE_PLT 64169689Skan#define TARGET_SECURE_PLT secure_plt 65169689Skan#endif 66169689Skan 6790075Sobrienextern const char *rs6000_abi_name; 6890075Sobrienextern const char *rs6000_sdata_name; 69132718Skanextern const char *rs6000_tls_size_string; /* For -mtls-size= */ 7090075Sobrien 7190075Sobrien#define SDATA_DEFAULT_SIZE 8 7290075Sobrien 7390075Sobrien/* Sometimes certain combinations of command options do not make sense 7490075Sobrien on a particular target machine. You can define a macro 7590075Sobrien `OVERRIDE_OPTIONS' to take account of this. This macro, if 7690075Sobrien defined, is executed once just after all the command options have 7790075Sobrien been parsed. 7890075Sobrien 7990075Sobrien The macro SUBTARGET_OVERRIDE_OPTIONS is provided for subtargets, to 8090075Sobrien get control. */ 8190075Sobrien 8290075Sobrien#define SUBTARGET_OVERRIDE_OPTIONS \ 8390075Sobriendo { \ 8490075Sobrien if (!g_switch_set) \ 8590075Sobrien g_switch_value = SDATA_DEFAULT_SIZE; \ 8690075Sobrien \ 87132718Skan if (rs6000_abi_name == NULL) \ 88132718Skan rs6000_abi_name = RS6000_ABI_NAME; \ 89132718Skan \ 9090075Sobrien if (!strcmp (rs6000_abi_name, "sysv")) \ 9190075Sobrien rs6000_current_abi = ABI_V4; \ 9290075Sobrien else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \ 9390075Sobrien { \ 9490075Sobrien rs6000_current_abi = ABI_V4; \ 9590075Sobrien target_flags &= ~ MASK_EABI; \ 9690075Sobrien } \ 9790075Sobrien else if (!strcmp (rs6000_abi_name, "sysv-eabi") \ 9890075Sobrien || !strcmp (rs6000_abi_name, "eabi")) \ 9990075Sobrien { \ 10090075Sobrien rs6000_current_abi = ABI_V4; \ 10190075Sobrien target_flags |= MASK_EABI; \ 10290075Sobrien } \ 10390075Sobrien else if (!strcmp (rs6000_abi_name, "aixdesc")) \ 10490075Sobrien rs6000_current_abi = ABI_AIX; \ 10590075Sobrien else if (!strcmp (rs6000_abi_name, "freebsd")) \ 10690075Sobrien rs6000_current_abi = ABI_V4; \ 10790075Sobrien else if (!strcmp (rs6000_abi_name, "linux")) \ 108169689Skan { \ 109169689Skan if (TARGET_64BIT) \ 110169689Skan rs6000_current_abi = ABI_AIX; \ 111169689Skan else \ 112169689Skan rs6000_current_abi = ABI_V4; \ 113169689Skan } \ 11496263Sobrien else if (!strcmp (rs6000_abi_name, "gnu")) \ 11596263Sobrien rs6000_current_abi = ABI_V4; \ 11690075Sobrien else if (!strcmp (rs6000_abi_name, "netbsd")) \ 11790075Sobrien rs6000_current_abi = ABI_V4; \ 118132718Skan else if (!strcmp (rs6000_abi_name, "openbsd")) \ 119132718Skan rs6000_current_abi = ABI_V4; \ 12090075Sobrien else if (!strcmp (rs6000_abi_name, "i960-old")) \ 12190075Sobrien { \ 12290075Sobrien rs6000_current_abi = ABI_V4; \ 12390075Sobrien target_flags |= (MASK_LITTLE_ENDIAN | MASK_EABI \ 12490075Sobrien | MASK_NO_BITFIELD_WORD); \ 12590075Sobrien target_flags &= ~MASK_STRICT_ALIGN; \ 12690075Sobrien } \ 12790075Sobrien else \ 12890075Sobrien { \ 12990075Sobrien rs6000_current_abi = ABI_V4; \ 13090075Sobrien error ("bad value for -mcall-%s", rs6000_abi_name); \ 13190075Sobrien } \ 13290075Sobrien \ 13390075Sobrien if (rs6000_sdata_name) \ 13490075Sobrien { \ 13590075Sobrien if (!strcmp (rs6000_sdata_name, "none")) \ 13690075Sobrien rs6000_sdata = SDATA_NONE; \ 13790075Sobrien else if (!strcmp (rs6000_sdata_name, "data")) \ 13890075Sobrien rs6000_sdata = SDATA_DATA; \ 13990075Sobrien else if (!strcmp (rs6000_sdata_name, "default")) \ 14090075Sobrien rs6000_sdata = (TARGET_EABI) ? SDATA_EABI : SDATA_SYSV; \ 14190075Sobrien else if (!strcmp (rs6000_sdata_name, "sysv")) \ 14290075Sobrien rs6000_sdata = SDATA_SYSV; \ 14390075Sobrien else if (!strcmp (rs6000_sdata_name, "eabi")) \ 14490075Sobrien rs6000_sdata = SDATA_EABI; \ 14590075Sobrien else \ 14690075Sobrien error ("bad value for -msdata=%s", rs6000_sdata_name); \ 14790075Sobrien } \ 14890075Sobrien else if (DEFAULT_ABI == ABI_V4) \ 14990075Sobrien { \ 15090075Sobrien rs6000_sdata = SDATA_DATA; \ 15190075Sobrien rs6000_sdata_name = "data"; \ 15290075Sobrien } \ 15390075Sobrien else \ 15490075Sobrien { \ 15590075Sobrien rs6000_sdata = SDATA_NONE; \ 15690075Sobrien rs6000_sdata_name = "none"; \ 15790075Sobrien } \ 15890075Sobrien \ 15990075Sobrien if (TARGET_RELOCATABLE && \ 16090075Sobrien (rs6000_sdata == SDATA_EABI || rs6000_sdata == SDATA_SYSV)) \ 16190075Sobrien { \ 16290075Sobrien rs6000_sdata = SDATA_DATA; \ 16390075Sobrien error ("-mrelocatable and -msdata=%s are incompatible", \ 16490075Sobrien rs6000_sdata_name); \ 16590075Sobrien } \ 16690075Sobrien \ 167132718Skan else if (flag_pic && DEFAULT_ABI != ABI_AIX \ 168132718Skan && (rs6000_sdata == SDATA_EABI \ 169132718Skan || rs6000_sdata == SDATA_SYSV)) \ 17090075Sobrien { \ 17190075Sobrien rs6000_sdata = SDATA_DATA; \ 17290075Sobrien error ("-f%s and -msdata=%s are incompatible", \ 17390075Sobrien (flag_pic > 1) ? "PIC" : "pic", \ 17490075Sobrien rs6000_sdata_name); \ 17590075Sobrien } \ 17690075Sobrien \ 177117395Skan if ((rs6000_sdata != SDATA_NONE && DEFAULT_ABI != ABI_V4) \ 178117395Skan || (rs6000_sdata == SDATA_EABI && !TARGET_EABI)) \ 17990075Sobrien { \ 18090075Sobrien rs6000_sdata = SDATA_NONE; \ 18190075Sobrien error ("-msdata=%s and -mcall-%s are incompatible", \ 18290075Sobrien rs6000_sdata_name, rs6000_abi_name); \ 18390075Sobrien } \ 18490075Sobrien \ 185117395Skan targetm.have_srodata_section = rs6000_sdata == SDATA_EABI; \ 186117395Skan \ 18790075Sobrien if (TARGET_RELOCATABLE && !TARGET_MINIMAL_TOC) \ 18890075Sobrien { \ 18990075Sobrien target_flags |= MASK_MINIMAL_TOC; \ 19090075Sobrien error ("-mrelocatable and -mno-minimal-toc are incompatible"); \ 19190075Sobrien } \ 19290075Sobrien \ 19390075Sobrien if (TARGET_RELOCATABLE && rs6000_current_abi == ABI_AIX) \ 19490075Sobrien { \ 19590075Sobrien target_flags &= ~MASK_RELOCATABLE; \ 19690075Sobrien error ("-mrelocatable and -mcall-%s are incompatible", \ 19790075Sobrien rs6000_abi_name); \ 19890075Sobrien } \ 19990075Sobrien \ 200132718Skan if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \ 20190075Sobrien { \ 20290075Sobrien flag_pic = 0; \ 20390075Sobrien error ("-fPIC and -mcall-%s are incompatible", \ 20490075Sobrien rs6000_abi_name); \ 20590075Sobrien } \ 20690075Sobrien \ 20790075Sobrien if (rs6000_current_abi == ABI_AIX && TARGET_LITTLE_ENDIAN) \ 20890075Sobrien { \ 20990075Sobrien target_flags &= ~MASK_LITTLE_ENDIAN; \ 21090075Sobrien error ("-mcall-aixdesc must be big endian"); \ 21190075Sobrien } \ 21290075Sobrien \ 213169689Skan if (TARGET_SECURE_PLT != secure_plt) \ 214169689Skan { \ 215169689Skan error ("-msecure-plt not supported by your assembler"); \ 216169689Skan } \ 217169689Skan \ 21890075Sobrien /* Treat -fPIC the same as -mrelocatable. */ \ 219132718Skan if (flag_pic > 1 && DEFAULT_ABI != ABI_AIX) \ 220169689Skan { \ 221169689Skan target_flags |= MASK_RELOCATABLE | MASK_MINIMAL_TOC; \ 222169689Skan TARGET_NO_FP_IN_TOC = 1; \ 223169689Skan } \ 22490075Sobrien \ 22590075Sobrien else if (TARGET_RELOCATABLE) \ 22690075Sobrien flag_pic = 2; \ 22790075Sobrien} while (0) 22890075Sobrien 229132718Skan#ifndef RS6000_BI_ARCH 230132718Skan# define SUBSUBTARGET_OVERRIDE_OPTIONS \ 231132718Skando { \ 232132718Skan if ((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \ 233132718Skan error ("-m%s not supported in this configuration", \ 234132718Skan (target_flags & MASK_64BIT) ? "64" : "32"); \ 235132718Skan} while (0) 236132718Skan#endif 23790075Sobrien 23890075Sobrien/* Override rs6000.h definition. */ 23990075Sobrien#undef TARGET_DEFAULT 24090075Sobrien#define TARGET_DEFAULT (MASK_POWERPC | MASK_NEW_MNEMONICS) 24190075Sobrien 24290075Sobrien/* Override rs6000.h definition. */ 24390075Sobrien#undef PROCESSOR_DEFAULT 24490075Sobrien#define PROCESSOR_DEFAULT PROCESSOR_PPC750 24590075Sobrien 246169689Skan/* SVR4 only defined for PowerPC, so short-circuit POWER patterns. */ 247169689Skan#undef TARGET_POWER 248169689Skan#define TARGET_POWER 0 249169689Skan 25090075Sobrien#define FIXED_R2 1 25190075Sobrien/* System V.4 uses register 13 as a pointer to the small data area, 25290075Sobrien so it is not available to the normal user. */ 25390075Sobrien#define FIXED_R13 1 25490075Sobrien 25590075Sobrien/* Override default big endianism definitions in rs6000.h. */ 25690075Sobrien#undef BYTES_BIG_ENDIAN 25790075Sobrien#undef WORDS_BIG_ENDIAN 25890075Sobrien#define BYTES_BIG_ENDIAN (TARGET_BIG_ENDIAN) 25990075Sobrien#define WORDS_BIG_ENDIAN (TARGET_BIG_ENDIAN) 26090075Sobrien 26190075Sobrien/* Define this to set the endianness to use in libgcc2.c, which can 26290075Sobrien not depend on target_flags. */ 263117395Skan#if !defined(__LITTLE_ENDIAN__) && !defined(__sun__) 26490075Sobrien#define LIBGCC2_WORDS_BIG_ENDIAN 1 26590075Sobrien#else 26690075Sobrien#define LIBGCC2_WORDS_BIG_ENDIAN 0 26790075Sobrien#endif 26890075Sobrien 26990075Sobrien/* Define cutoff for using external functions to save floating point. 27090075Sobrien Currently on V.4, always use inline stores. */ 27190075Sobrien#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) < 64) 27290075Sobrien 27390075Sobrien/* Put jump tables in read-only memory, rather than in .text. */ 27490075Sobrien#define JUMP_TABLES_IN_TEXT_SECTION 0 27590075Sobrien 27690075Sobrien/* Prefix and suffix to use to saving floating point. */ 27790075Sobrien#define SAVE_FP_PREFIX "_savefpr_" 27890075Sobrien#define SAVE_FP_SUFFIX "_l" 27990075Sobrien 28090075Sobrien/* Prefix and suffix to use to restoring floating point. */ 28190075Sobrien#define RESTORE_FP_PREFIX "_restfpr_" 28290075Sobrien#define RESTORE_FP_SUFFIX "_l" 28390075Sobrien 28490075Sobrien/* Type used for ptrdiff_t, as a string used in a declaration. */ 28590075Sobrien#define PTRDIFF_TYPE "int" 28690075Sobrien 28790075Sobrien/* Type used for wchar_t, as a string used in a declaration. */ 28890075Sobrien/* Override svr4.h definition. */ 28990075Sobrien#undef WCHAR_TYPE 29090075Sobrien#define WCHAR_TYPE "long int" 29190075Sobrien 29290075Sobrien/* Width of wchar_t in bits. */ 29390075Sobrien/* Override svr4.h definition. */ 29490075Sobrien#undef WCHAR_TYPE_SIZE 29590075Sobrien#define WCHAR_TYPE_SIZE 32 29690075Sobrien 29790075Sobrien/* Make int foo : 8 not cause structures to be aligned to an int boundary. */ 29890075Sobrien/* Override elfos.h definition. */ 29990075Sobrien#undef PCC_BITFIELD_TYPE_MATTERS 30090075Sobrien#define PCC_BITFIELD_TYPE_MATTERS (TARGET_BITFIELD_TYPE) 30190075Sobrien 30290075Sobrien#undef BITFIELD_NBYTES_LIMITED 30390075Sobrien#define BITFIELD_NBYTES_LIMITED (TARGET_NO_BITFIELD_WORD) 30490075Sobrien 30590075Sobrien/* Define this macro to be the value 1 if instructions will fail to 30690075Sobrien work if given data not on the nominal alignment. If instructions 30790075Sobrien will merely go slower in that case, define this macro as 0. */ 30890075Sobrien#undef STRICT_ALIGNMENT 30990075Sobrien#define STRICT_ALIGNMENT (TARGET_STRICT_ALIGN) 31090075Sobrien 311122180Skan/* Define this macro if you wish to preserve a certain alignment for 312122180Skan the stack pointer, greater than what the hardware enforces. The 313122180Skan definition is a C expression for the desired alignment (measured 314122180Skan in bits). This macro must evaluate to a value equal to or larger 315122180Skan than STACK_BOUNDARY. 316122180Skan For the SYSV ABI and variants the alignment of the stack pointer 317122180Skan is usually controlled manually in rs6000.c. However, to maintain 318122180Skan alignment across alloca () in all circumstances, 319122180Skan PREFERRED_STACK_BOUNDARY needs to be set as well. 320122180Skan This has the additional advantage of allowing a bigger maximum 321122180Skan alignment of user objects on the stack. */ 322122180Skan 323122180Skan#undef PREFERRED_STACK_BOUNDARY 324122180Skan#define PREFERRED_STACK_BOUNDARY 128 325122180Skan 32690075Sobrien/* Real stack boundary as mandated by the appropriate ABI. */ 327132718Skan#define ABI_STACK_BOUNDARY \ 328132718Skan ((TARGET_EABI && !TARGET_ALTIVEC && !TARGET_ALTIVEC_ABI) ? 64 : 128) 32990075Sobrien 33090075Sobrien/* An expression for the alignment of a structure field FIELD if the 33190075Sobrien alignment computed in the usual way is COMPUTED. */ 33290075Sobrien#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ 33390075Sobrien ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ 33490075Sobrien ? 128 : COMPUTED) 33590075Sobrien 33690075Sobrien#undef BIGGEST_FIELD_ALIGNMENT 33790075Sobrien 33890075Sobrien/* Use ELF style section commands. */ 33990075Sobrien 34090075Sobrien#define TEXT_SECTION_ASM_OP "\t.section\t\".text\"" 34190075Sobrien 34290075Sobrien#define DATA_SECTION_ASM_OP "\t.section\t\".data\"" 34390075Sobrien 34490075Sobrien#define BSS_SECTION_ASM_OP "\t.section\t\".bss\"" 34590075Sobrien 34690075Sobrien/* Override elfos.h definition. */ 34790075Sobrien#undef INIT_SECTION_ASM_OP 34890075Sobrien#define INIT_SECTION_ASM_OP "\t.section\t\".init\",\"ax\"" 34990075Sobrien 35090075Sobrien/* Override elfos.h definition. */ 35190075Sobrien#undef FINI_SECTION_ASM_OP 35290075Sobrien#define FINI_SECTION_ASM_OP "\t.section\t\".fini\",\"ax\"" 35390075Sobrien 35490075Sobrien#define TOC_SECTION_ASM_OP "\t.section\t\".got\",\"aw\"" 35590075Sobrien 35690075Sobrien/* Put PC relative got entries in .got2. */ 35790075Sobrien#define MINIMAL_TOC_SECTION_ASM_OP \ 358132718Skan (TARGET_RELOCATABLE || (flag_pic && DEFAULT_ABI != ABI_AIX) \ 359132718Skan ? "\t.section\t\".got2\",\"aw\"" : "\t.section\t\".got1\",\"aw\"") 36090075Sobrien 36190075Sobrien#define SDATA_SECTION_ASM_OP "\t.section\t\".sdata\",\"aw\"" 36290075Sobrien#define SDATA2_SECTION_ASM_OP "\t.section\t\".sdata2\",\"a\"" 36390075Sobrien#define SBSS_SECTION_ASM_OP "\t.section\t\".sbss\",\"aw\",@nobits" 36490075Sobrien 365117395Skan/* Override default elf definitions. */ 366169689Skan#define TARGET_ASM_INIT_SECTIONS rs6000_elf_asm_init_sections 367169689Skan#undef TARGET_ASM_RELOC_RW_MASK 368169689Skan#define TARGET_ASM_RELOC_RW_MASK rs6000_elf_reloc_rw_mask 369117395Skan#undef TARGET_ASM_SELECT_RTX_SECTION 370117395Skan#define TARGET_ASM_SELECT_RTX_SECTION rs6000_elf_select_rtx_section 37190075Sobrien 372117395Skan/* Return nonzero if this entry is to be written into the constant pool 37390075Sobrien in a special way. We do so if this is a SYMBOL_REF, LABEL_REF or a CONST 37490075Sobrien containing one of them. If -mfp-in-toc (the default), we also do 37590075Sobrien this for floating-point constants. We actually can only do this 37690075Sobrien if the FP formats of the target and host machines are the same, but 37790075Sobrien we can't check that since not every file that uses 37890075Sobrien GO_IF_LEGITIMATE_ADDRESS_P includes real.h. 37990075Sobrien 38090075Sobrien Unlike AIX, we don't key off of -mminimal-toc, but instead do not 38190075Sobrien allow floating point constants in the TOC if -mrelocatable. */ 38290075Sobrien 38390075Sobrien#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P 38490075Sobrien#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \ 38590075Sobrien (TARGET_TOC \ 38690075Sobrien && (GET_CODE (X) == SYMBOL_REF \ 38790075Sobrien || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \ 38890075Sobrien && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \ 38990075Sobrien || GET_CODE (X) == LABEL_REF \ 39090075Sobrien || (GET_CODE (X) == CONST_INT \ 39190075Sobrien && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ 39290075Sobrien || (!TARGET_NO_FP_IN_TOC \ 39390075Sobrien && !TARGET_RELOCATABLE \ 39490075Sobrien && GET_CODE (X) == CONST_DOUBLE \ 395169689Skan && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \ 39690075Sobrien && BITS_PER_WORD == HOST_BITS_PER_INT))) 39790075Sobrien 39890075Sobrien/* These macros generate the special .type and .size directives which 39990075Sobrien are used to set the corresponding fields of the linker symbol table 40090075Sobrien entries in an ELF object file under SVR4. These macros also output 40190075Sobrien the starting labels for the relevant functions/objects. */ 40290075Sobrien 40390075Sobrien/* Write the extra assembler code needed to declare a function properly. 40490075Sobrien Some svr4 assemblers need to also have something extra said about the 40590075Sobrien function's return value. We allow for that here. */ 40690075Sobrien 40790075Sobrienextern int rs6000_pic_labelno; 40890075Sobrien 40990075Sobrien/* Override elfos.h definition. */ 41090075Sobrien#undef ASM_DECLARE_FUNCTION_NAME 41190075Sobrien#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ 412132718Skan rs6000_elf_declare_function_name ((FILE), (NAME), (DECL)) 41390075Sobrien 41490075Sobrien/* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore 41590075Sobrien flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ 41690075Sobrien 41790075Sobrien#define LOCAL_LABEL_PREFIX "." 41890075Sobrien#define USER_LABEL_PREFIX "" 41990075Sobrien 420132718Skan/* svr4.h overrides (*targetm.asm_out.internal_label). */ 42190075Sobrien 42290075Sobrien#define ASM_OUTPUT_INTERNAL_LABEL_PREFIX(FILE,PREFIX) \ 42390075Sobrien asm_fprintf (FILE, "%L%s", PREFIX) 42490075Sobrien 425117395Skan/* Globalizing directive for a label. */ 426117395Skan#define GLOBAL_ASM_OP "\t.globl " 42790075Sobrien 42890075Sobrien/* This says how to output assembler code to declare an 42990075Sobrien uninitialized internal linkage data object. Under SVR4, 43090075Sobrien the linker seems to want the alignment of data objects 43190075Sobrien to depend on their types. We do exactly that here. */ 43290075Sobrien 43390075Sobrien#define LOCAL_ASM_OP "\t.local\t" 43490075Sobrien 43590075Sobrien#define LCOMM_ASM_OP "\t.lcomm\t" 43690075Sobrien 437169689Skan/* Describe how to emit uninitialized local items. */ 438169689Skan#define ASM_OUTPUT_ALIGNED_DECL_LOCAL(FILE, DECL, NAME, SIZE, ALIGN) \ 43990075Sobriendo { \ 440169689Skan if ((DECL) && rs6000_elf_in_small_data_p (DECL)) \ 44190075Sobrien { \ 442169689Skan switch_to_section (sbss_section); \ 44390075Sobrien ASM_OUTPUT_ALIGN (FILE, exact_log2 (ALIGN / BITS_PER_UNIT)); \ 44490075Sobrien ASM_OUTPUT_LABEL (FILE, NAME); \ 44590075Sobrien ASM_OUTPUT_SKIP (FILE, SIZE); \ 44690075Sobrien if (!flag_inhibit_size_directive && (SIZE) > 0) \ 447117395Skan ASM_OUTPUT_SIZE_DIRECTIVE (FILE, NAME, SIZE); \ 44890075Sobrien } \ 44990075Sobrien else \ 45090075Sobrien { \ 45190075Sobrien fprintf (FILE, "%s", LCOMM_ASM_OP); \ 45290075Sobrien assemble_name ((FILE), (NAME)); \ 453132718Skan fprintf ((FILE), ","HOST_WIDE_INT_PRINT_UNSIGNED",%u\n", \ 454132718Skan (SIZE), (ALIGN) / BITS_PER_UNIT); \ 45590075Sobrien } \ 456117395Skan ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "object"); \ 45790075Sobrien} while (0) 45890075Sobrien 45990075Sobrien/* Describe how to emit uninitialized external linkage items. */ 46090075Sobrien#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \ 46190075Sobriendo { \ 462169689Skan ASM_OUTPUT_ALIGNED_DECL_LOCAL (FILE, DECL, NAME, SIZE, ALIGN); \ 46390075Sobrien} while (0) 46490075Sobrien 465132718Skan#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 466132718Skan/* To support -falign-* switches we need to use .p2align so 467132718Skan that alignment directives in code sections will be padded 468132718Skan with no-op instructions, rather than zeroes. */ 469132718Skan#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE,LOG,MAX_SKIP) \ 470132718Skan if ((LOG) != 0) \ 471132718Skan { \ 472132718Skan if ((MAX_SKIP) == 0) \ 473132718Skan fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 474132718Skan else \ 475132718Skan fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 476132718Skan } 477132718Skan#endif 478132718Skan 479103445Skan/* This is how to output code to push a register on the stack. 480103445Skan It need not be very fast code. 481103445Skan 482103445Skan On the rs6000, we must keep the backchain up to date. In order 483103445Skan to simplify things, always allocate 16 bytes for a push (System V 484103445Skan wants to keep stack aligned to a 16 byte boundary). */ 485103445Skan 486103445Skan#define ASM_OUTPUT_REG_PUSH(FILE, REGNO) \ 487103445Skando { \ 488103445Skan if (DEFAULT_ABI == ABI_V4) \ 489103445Skan asm_fprintf (FILE, \ 490117395Skan "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,12(%s)\n", \ 491103445Skan reg_names[1], reg_names[1], reg_names[REGNO], \ 492103445Skan reg_names[1]); \ 493103445Skan} while (0) 494103445Skan 495103445Skan/* This is how to output an insn to pop a register from the stack. 496103445Skan It need not be very fast code. */ 497103445Skan 498103445Skan#define ASM_OUTPUT_REG_POP(FILE, REGNO) \ 499103445Skando { \ 500103445Skan if (DEFAULT_ABI == ABI_V4) \ 501103445Skan asm_fprintf (FILE, \ 502117395Skan "\t{l|lwz} %s,12(%s)\n\t{ai|addic} %s,%s,16\n", \ 503103445Skan reg_names[REGNO], reg_names[1], reg_names[1], \ 504103445Skan reg_names[1]); \ 505103445Skan} while (0) 506103445Skan 50790075Sobrien/* Switch Recognition by gcc.c. Add -G xx support. */ 50890075Sobrien 50990075Sobrien/* Override svr4.h definition. */ 51090075Sobrien#undef SWITCH_TAKES_ARG 51190075Sobrien#define SWITCH_TAKES_ARG(CHAR) \ 51290075Sobrien ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ 51390075Sobrien || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ 51490075Sobrien || (CHAR) == 'I' || (CHAR) == 'm' || (CHAR) == 'x' \ 51590075Sobrien || (CHAR) == 'L' || (CHAR) == 'A' || (CHAR) == 'V' \ 51690075Sobrien || (CHAR) == 'B' || (CHAR) == 'b' || (CHAR) == 'G') 51790075Sobrien 51890075Sobrienextern int fixuplabelno; 51990075Sobrien 52090075Sobrien/* Handle constructors specially for -mrelocatable. */ 52190075Sobrien#define TARGET_ASM_CONSTRUCTOR rs6000_elf_asm_out_constructor 52290075Sobrien#define TARGET_ASM_DESTRUCTOR rs6000_elf_asm_out_destructor 52390075Sobrien 52490075Sobrien/* This is the end of what might become sysv4.h. */ 52590075Sobrien 52690075Sobrien/* Use DWARF 2 debugging information by default. */ 527117395Skan#undef PREFERRED_DEBUGGING_TYPE 528117395Skan#define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG 52990075Sobrien 53090075Sobrien/* Historically we have also supported stabs debugging. */ 531117395Skan#define DBX_DEBUGGING_INFO 1 53290075Sobrien 533117395Skan#define TARGET_ENCODE_SECTION_INFO rs6000_elf_encode_section_info 534117395Skan#define TARGET_IN_SMALL_DATA_P rs6000_elf_in_small_data_p 53590075Sobrien 53690075Sobrien/* The ELF version doesn't encode [DS] or whatever at the end of symbols. */ 53790075Sobrien 53890075Sobrien#define RS6000_OUTPUT_BASENAME(FILE, NAME) \ 53990075Sobrien assemble_name (FILE, NAME) 54090075Sobrien 541132718Skan/* We have to output the stabs for the function name *first*, before 542132718Skan outputting its label. */ 54390075Sobrien 54490075Sobrien#define DBX_FUNCTION_FIRST 54590075Sobrien 54690075Sobrien/* This is the end of what might become sysv4dbx.h. */ 54790075Sobrien 54890075Sobrien#ifndef TARGET_VERSION 54990075Sobrien#define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)"); 55090075Sobrien#endif 55190075Sobrien 552169689Skan#define TARGET_OS_SYSV_CPP_BUILTINS() \ 553169689Skan do \ 554169689Skan { \ 555169689Skan if (target_flags_explicit \ 556169689Skan & MASK_RELOCATABLE) \ 557169689Skan builtin_define ("_RELOCATABLE"); \ 558169689Skan } \ 559132718Skan while (0) 560132718Skan 561117395Skan#ifndef TARGET_OS_CPP_BUILTINS 562169689Skan#define TARGET_OS_CPP_BUILTINS() \ 563169689Skan do \ 564169689Skan { \ 565169689Skan builtin_define_std ("PPC"); \ 566169689Skan builtin_define_std ("unix"); \ 567169689Skan builtin_define ("__svr4__"); \ 568169689Skan builtin_assert ("system=unix"); \ 569169689Skan builtin_assert ("system=svr4"); \ 570169689Skan builtin_assert ("cpu=powerpc"); \ 571169689Skan builtin_assert ("machine=powerpc"); \ 572169689Skan TARGET_OS_SYSV_CPP_BUILTINS (); \ 573169689Skan } \ 574117395Skan while (0) 57590075Sobrien#endif 57690075Sobrien 57790075Sobrien/* Pass various options to the assembler. */ 57890075Sobrien/* Override svr4.h definition. */ 57990075Sobrien#undef ASM_SPEC 58090075Sobrien#define ASM_SPEC "%(asm_cpu) \ 58190075Sobrien%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ 58290075Sobrien%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \ 583132718Skan%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \ 584132718Skan%{memb|msdata|msdata=eabi: -memb} \ 585132718Skan%{mlittle|mlittle-endian:-mlittle; \ 586132718Skan mbig|mbig-endian :-mbig; \ 587132718Skan mcall-aixdesc | \ 588132718Skan mcall-freebsd | \ 589132718Skan mcall-netbsd | \ 590132718Skan mcall-openbsd | \ 591132718Skan mcall-linux | \ 592132718Skan mcall-gnu :-mbig; \ 593132718Skan mcall-i960-old :-mlittle}" 59490075Sobrien 59590075Sobrien#define CC1_ENDIAN_BIG_SPEC "" 59690075Sobrien 59790075Sobrien#define CC1_ENDIAN_LITTLE_SPEC "\ 59890075Sobrien%{!mstrict-align: %{!mno-strict-align: \ 59990075Sobrien %{!mcall-i960-old: \ 60090075Sobrien -mstrict-align \ 60190075Sobrien } \ 60290075Sobrien}}" 60390075Sobrien 60496263Sobrien#define CC1_ENDIAN_DEFAULT_SPEC "%(cc1_endian_big)" 60590075Sobrien 606169689Skan#ifndef CC1_SECURE_PLT_DEFAULT_SPEC 607169689Skan#define CC1_SECURE_PLT_DEFAULT_SPEC "" 608169689Skan#endif 609169689Skan 61090075Sobrien/* Pass -G xxx to the compiler and set correct endian mode. */ 61190075Sobrien#define CC1_SPEC "%{G*} \ 612132718Skan%{mlittle|mlittle-endian: %(cc1_endian_little); \ 613132718Skan mbig |mbig-endian : %(cc1_endian_big); \ 614132718Skan mcall-aixdesc | \ 615132718Skan mcall-freebsd | \ 616132718Skan mcall-netbsd | \ 617132718Skan mcall-openbsd | \ 618132718Skan mcall-linux | \ 619132718Skan mcall-gnu : -mbig %(cc1_endian_big); \ 620132718Skan mcall-i960-old : -mlittle %(cc1_endian_little); \ 621132718Skan : %(cc1_endian_default)} \ 62290075Sobrien%{meabi: %{!mcall-*: -mcall-sysv }} \ 62390075Sobrien%{!meabi: %{!mno-eabi: \ 62490075Sobrien %{mrelocatable: -meabi } \ 62590075Sobrien %{mcall-freebsd: -mno-eabi } \ 62690075Sobrien %{mcall-i960-old: -meabi } \ 62790075Sobrien %{mcall-linux: -mno-eabi } \ 62896263Sobrien %{mcall-gnu: -mno-eabi } \ 629132718Skan %{mcall-netbsd: -mno-eabi } \ 630132718Skan %{mcall-openbsd: -mno-eabi }}} \ 63190075Sobrien%{msdata: -msdata=default} \ 63290075Sobrien%{mno-sdata: -msdata=none} \ 633169689Skan%{!mbss-plt: %{!msecure-plt: %(cc1_secure_plt_default)}} \ 63490075Sobrien%{profile: -p}" 63590075Sobrien 63690075Sobrien/* Don't put -Y P,<path> for cross compilers. */ 637259563Spfg#ifndef CROSS_DIRECTORY_STRUCTURE 63890075Sobrien#define LINK_PATH_SPEC "\ 63990075Sobrien%{!R*:%{L*:-R %*}} \ 64090075Sobrien%{!nostdlib: %{!YP,*: \ 64190075Sobrien %{compat-bsd: \ 64290075Sobrien %{p:-Y P,/usr/ucblib:/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ 64390075Sobrien %{!p:-Y P,/usr/ucblib:/usr/ccs/lib:/usr/lib}} \ 64490075Sobrien %{!R*: %{!L*: -R /usr/ucblib}} \ 64590075Sobrien %{!compat-bsd: \ 64690075Sobrien %{p:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \ 64790075Sobrien %{!p:-Y P,/usr/ccs/lib:/usr/lib}}}}" 64890075Sobrien 64990075Sobrien#else 65090075Sobrien#define LINK_PATH_SPEC "" 65190075Sobrien#endif 65290075Sobrien 65390075Sobrien/* Default starting address if specified. */ 65490075Sobrien#define LINK_START_SPEC "\ 655132718Skan%{mads : %(link_start_ads) ; \ 656132718Skan myellowknife : %(link_start_yellowknife) ; \ 657132718Skan mmvme : %(link_start_mvme) ; \ 658132718Skan msim : %(link_start_sim) ; \ 659132718Skan mwindiss : %(link_start_windiss) ; \ 660132718Skan mcall-freebsd: %(link_start_freebsd) ; \ 661132718Skan mcall-linux : %(link_start_linux) ; \ 662132718Skan mcall-gnu : %(link_start_gnu) ; \ 663132718Skan mcall-netbsd : %(link_start_netbsd) ; \ 664132718Skan mcall-openbsd: %(link_start_openbsd) ; \ 665132718Skan : %(link_start_default) }" 66690075Sobrien 66790075Sobrien#define LINK_START_DEFAULT_SPEC "" 66890075Sobrien 66990075Sobrien/* Override svr4.h definition. */ 67090075Sobrien#undef LINK_SPEC 67190075Sobrien#define LINK_SPEC "\ 67290075Sobrien%{h*} %{v:-V} %{!msdata=none:%{G*}} %{msdata=none:-G0} \ 67390075Sobrien%{YP,*} %{R*} \ 67490075Sobrien%{Qy:} %{!Qn:-Qy} \ 67590075Sobrien%(link_shlib) \ 67690075Sobrien%{!Wl,-T*: %{!T*: %(link_start) }} \ 67790075Sobrien%(link_target) \ 67890075Sobrien%(link_os)" 67990075Sobrien 68090075Sobrien/* For now, turn off shared libraries by default. */ 68190075Sobrien#ifndef SHARED_LIB_SUPPORT 68290075Sobrien#define NO_SHARED_LIB_SUPPORT 68390075Sobrien#endif 68490075Sobrien 68590075Sobrien#ifndef NO_SHARED_LIB_SUPPORT 68690075Sobrien/* Shared libraries are default. */ 68790075Sobrien#define LINK_SHLIB_SPEC "\ 68890075Sobrien%{!static: %(link_path) %{!R*:%{L*:-R %*}}} \ 68990075Sobrien%{mshlib: } \ 69090075Sobrien%{static:-dn -Bstatic} \ 69190075Sobrien%{shared:-G -dy -z text} \ 69290075Sobrien%{symbolic:-Bsymbolic -G -dy -z text}" 69390075Sobrien 69490075Sobrien#else 69590075Sobrien/* Shared libraries are not default. */ 69690075Sobrien#define LINK_SHLIB_SPEC "\ 69790075Sobrien%{mshlib: %(link_path) } \ 69890075Sobrien%{!mshlib: %{!shared: %{!symbolic: -dn -Bstatic}}} \ 69990075Sobrien%{static: } \ 70090075Sobrien%{shared:-G -dy -z text %(link_path) } \ 70190075Sobrien%{symbolic:-Bsymbolic -G -dy -z text %(link_path) }" 70290075Sobrien#endif 70390075Sobrien 70490075Sobrien/* Override the default target of the linker. */ 70590075Sobrien#define LINK_TARGET_SPEC "\ 70690075Sobrien%{mlittle: --oformat elf32-powerpcle } %{mlittle-endian: --oformat elf32-powerpcle } \ 70790075Sobrien%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ 70890075Sobrien %{mcall-i960-old: --oformat elf32-powerpcle} \ 70990075Sobrien }}}}" 71090075Sobrien 71190075Sobrien/* Any specific OS flags. */ 71290075Sobrien#define LINK_OS_SPEC "\ 713132718Skan%{mads : %(link_os_ads) ; \ 714132718Skan myellowknife : %(link_os_yellowknife) ; \ 715132718Skan mmvme : %(link_os_mvme) ; \ 716132718Skan msim : %(link_os_sim) ; \ 717132718Skan mwindiss : %(link_os_windiss) ; \ 718132718Skan mcall-freebsd: %(link_os_freebsd) ; \ 719132718Skan mcall-linux : %(link_os_linux) ; \ 720132718Skan mcall-gnu : %(link_os_gnu) ; \ 721132718Skan mcall-netbsd : %(link_os_netbsd) ; \ 722132718Skan mcall-openbsd: %(link_os_openbsd) ; \ 723132718Skan : %(link_os_default) }" 72490075Sobrien 72590075Sobrien#define LINK_OS_DEFAULT_SPEC "" 72690075Sobrien 72790075Sobrien/* Override rs6000.h definition. */ 72890075Sobrien#undef CPP_SPEC 729132718Skan#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \ 730132718Skan%{mads : %(cpp_os_ads) ; \ 731132718Skan myellowknife : %(cpp_os_yellowknife) ; \ 732132718Skan mmvme : %(cpp_os_mvme) ; \ 733132718Skan msim : %(cpp_os_sim) ; \ 734132718Skan mwindiss : %(cpp_os_windiss) ; \ 735132718Skan mcall-freebsd: %(cpp_os_freebsd) ; \ 736132718Skan mcall-linux : %(cpp_os_linux) ; \ 737132718Skan mcall-gnu : %(cpp_os_gnu) ; \ 738132718Skan mcall-netbsd : %(cpp_os_netbsd) ; \ 739132718Skan mcall-openbsd: %(cpp_os_openbsd) ; \ 740132718Skan : %(cpp_os_default) }" 74190075Sobrien 74290075Sobrien#define CPP_OS_DEFAULT_SPEC "" 74390075Sobrien 74490075Sobrien/* Override svr4.h definition. */ 74590075Sobrien#undef STARTFILE_SPEC 74690075Sobrien#define STARTFILE_SPEC "\ 747132718Skan%{mads : %(startfile_ads) ; \ 748132718Skan myellowknife : %(startfile_yellowknife) ; \ 749132718Skan mmvme : %(startfile_mvme) ; \ 750132718Skan msim : %(startfile_sim) ; \ 751132718Skan mwindiss : %(startfile_windiss) ; \ 752132718Skan mcall-freebsd: %(startfile_freebsd) ; \ 753132718Skan mcall-linux : %(startfile_linux) ; \ 754132718Skan mcall-gnu : %(startfile_gnu) ; \ 755132718Skan mcall-netbsd : %(startfile_netbsd) ; \ 756132718Skan mcall-openbsd: %(startfile_openbsd) ; \ 757132718Skan : %(startfile_default) }" 75890075Sobrien 75990075Sobrien#define STARTFILE_DEFAULT_SPEC "" 76090075Sobrien 76190075Sobrien/* Override svr4.h definition. */ 76290075Sobrien#undef LIB_SPEC 76390075Sobrien#define LIB_SPEC "\ 764132718Skan%{mads : %(lib_ads) ; \ 765132718Skan myellowknife : %(lib_yellowknife) ; \ 766132718Skan mmvme : %(lib_mvme) ; \ 767132718Skan msim : %(lib_sim) ; \ 768132718Skan mwindiss : %(lib_windiss) ; \ 769132718Skan mcall-freebsd: %(lib_freebsd) ; \ 770132718Skan mcall-linux : %(lib_linux) ; \ 771132718Skan mcall-gnu : %(lib_gnu) ; \ 772132718Skan mcall-netbsd : %(lib_netbsd) ; \ 773132718Skan mcall-openbsd: %(lib_openbsd) ; \ 774132718Skan : %(lib_default) }" 77590075Sobrien 77690075Sobrien#define LIB_DEFAULT_SPEC "" 77790075Sobrien 77890075Sobrien/* Override svr4.h definition. */ 77990075Sobrien#undef ENDFILE_SPEC 780117395Skan#define ENDFILE_SPEC "\ 781132718Skan%{mads : crtsavres.o%s %(endfile_ads) ; \ 782132718Skan myellowknife : crtsavres.o%s %(endfile_yellowknife) ; \ 783132718Skan mmvme : crtsavres.o%s %(endfile_mvme) ; \ 784132718Skan msim : crtsavres.o%s %(endfile_sim) ; \ 785132718Skan mwindiss : %(endfile_windiss) ; \ 786132718Skan mcall-freebsd: crtsavres.o%s %(endfile_freebsd) ; \ 787132718Skan mcall-linux : crtsavres.o%s %(endfile_linux) ; \ 788132718Skan mcall-gnu : crtsavres.o%s %(endfile_gnu) ; \ 789132718Skan mcall-netbsd : crtsavres.o%s %(endfile_netbsd) ; \ 790132718Skan mcall-openbsd: crtsavres.o%s %(endfile_openbsd) ; \ 791132718Skan : %(crtsavres_default) %(endfile_default) }" 79290075Sobrien 793117395Skan#define CRTSAVRES_DEFAULT_SPEC "crtsavres.o%s" 794117395Skan 79590075Sobrien#define ENDFILE_DEFAULT_SPEC "" 79690075Sobrien 79790075Sobrien/* Motorola ADS support. */ 79890075Sobrien#define LIB_ADS_SPEC "--start-group -lads -lc --end-group" 79990075Sobrien 80090075Sobrien#define STARTFILE_ADS_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" 80190075Sobrien 80290075Sobrien#define ENDFILE_ADS_SPEC "crtend.o%s ecrtn.o%s" 80390075Sobrien 80490075Sobrien#define LINK_START_ADS_SPEC "-T ads.ld%s" 80590075Sobrien 80690075Sobrien#define LINK_OS_ADS_SPEC "" 80790075Sobrien 80890075Sobrien#define CPP_OS_ADS_SPEC "" 80990075Sobrien 81090075Sobrien/* Motorola Yellowknife support. */ 81190075Sobrien#define LIB_YELLOWKNIFE_SPEC "--start-group -lyk -lc --end-group" 81290075Sobrien 81390075Sobrien#define STARTFILE_YELLOWKNIFE_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" 81490075Sobrien 81590075Sobrien#define ENDFILE_YELLOWKNIFE_SPEC "crtend.o%s ecrtn.o%s" 81690075Sobrien 81790075Sobrien#define LINK_START_YELLOWKNIFE_SPEC "-T yellowknife.ld%s" 81890075Sobrien 81990075Sobrien#define LINK_OS_YELLOWKNIFE_SPEC "" 82090075Sobrien 82190075Sobrien#define CPP_OS_YELLOWKNIFE_SPEC "" 82290075Sobrien 82390075Sobrien/* Motorola MVME support. */ 82490075Sobrien#define LIB_MVME_SPEC "--start-group -lmvme -lc --end-group" 82590075Sobrien 82690075Sobrien#define STARTFILE_MVME_SPEC "ecrti.o%s crt0.o%s crtbegin.o%s" 82790075Sobrien 82890075Sobrien#define ENDFILE_MVME_SPEC "crtend.o%s ecrtn.o%s" 82990075Sobrien 83090075Sobrien#define LINK_START_MVME_SPEC "-Ttext 0x40000" 83190075Sobrien 83290075Sobrien#define LINK_OS_MVME_SPEC "" 83390075Sobrien 83490075Sobrien#define CPP_OS_MVME_SPEC "" 83590075Sobrien 83690075Sobrien/* PowerPC simulator based on netbsd system calls support. */ 83790075Sobrien#define LIB_SIM_SPEC "--start-group -lsim -lc --end-group" 83890075Sobrien 83990075Sobrien#define STARTFILE_SIM_SPEC "ecrti.o%s sim-crt0.o%s crtbegin.o%s" 84090075Sobrien 84190075Sobrien#define ENDFILE_SIM_SPEC "crtend.o%s ecrtn.o%s" 84290075Sobrien 84390075Sobrien#define LINK_START_SIM_SPEC "" 84490075Sobrien 84590075Sobrien#define LINK_OS_SIM_SPEC "-m elf32ppcsim" 84690075Sobrien 84790075Sobrien#define CPP_OS_SIM_SPEC "" 84890075Sobrien 84990075Sobrien/* FreeBSD support. */ 85090075Sobrien 85190075Sobrien#define CPP_OS_FREEBSD_SPEC "\ 852132718Skan -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \ 85390075Sobrien -Acpu=powerpc -Amachine=powerpc" 85490075Sobrien 85590075Sobrien#define STARTFILE_FREEBSD_SPEC FBSD_STARTFILE_SPEC 85690075Sobrien#define ENDFILE_FREEBSD_SPEC FBSD_ENDFILE_SPEC 85790075Sobrien#define LIB_FREEBSD_SPEC FBSD_LIB_SPEC 85890075Sobrien#define LINK_START_FREEBSD_SPEC "" 85990075Sobrien 86090075Sobrien#define LINK_OS_FREEBSD_SPEC "\ 861146895Skan %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \ 862132718Skan %{v:-V} \ 863132718Skan %{assert*} %{R*} %{rpath*} %{defsym*} \ 864132718Skan %{shared:-Bshareable %{h*} %{soname*}} \ 865132718Skan %{!shared: \ 866132718Skan %{!static: \ 867132718Skan %{rdynamic: -export-dynamic} \ 868132718Skan %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \ 869132718Skan %{static:-Bstatic}} \ 870132718Skan %{symbolic:-Bsymbolic}" 87190075Sobrien 87290075Sobrien/* GNU/Linux support. */ 87390075Sobrien#define LIB_LINUX_SPEC "%{mnewlib: --start-group -llinux -lc --end-group } \ 874132718Skan%{!mnewlib: %{pthread:-lpthread} %{shared:-lc} \ 875132718Skan%{!shared: %{profile:-lc_p} %{!profile:-lc}}}" 87690075Sobrien 877132718Skan#ifdef HAVE_LD_PIE 87890075Sobrien#define STARTFILE_LINUX_SPEC "\ 879169689Skan%{!shared: %{pg|p|profile:gcrt1.o%s;pie:Scrt1.o%s;:crt1.o%s}} \ 880132718Skan%{mnewlib:ecrti.o%s;:crti.o%s} \ 881132718Skan%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 88296263Sobrien#else 88396263Sobrien#define STARTFILE_LINUX_SPEC "\ 884169689Skan%{!shared: %{pg|p|profile:gcrt1.o%s;:crt1.o%s}} \ 885132718Skan%{mnewlib:ecrti.o%s;:crti.o%s} \ 886132718Skan%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 88796263Sobrien#endif 88890075Sobrien 889146895Skan#define ENDFILE_LINUX_SPEC "\ 890146895Skan%{shared|pie:crtendS.o%s;:crtend.o%s} \ 891146895Skan%{mnewlib:ecrtn.o%s;:crtn.o%s}" 89290075Sobrien 89390075Sobrien#define LINK_START_LINUX_SPEC "" 89490075Sobrien 895169689Skan#define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1" 896169689Skan#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" 897169689Skan#if UCLIBC_DEFAULT 898169689Skan#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:%{muclibc:%e-mglibc and -muclibc used together}" G ";:" U "}" 899169689Skan#else 900169689Skan#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:%{mglibc:%e-mglibc and -muclibc used together}" U ";:" G "}" 901169689Skan#endif 902169689Skan#define LINUX_DYNAMIC_LINKER \ 903169689Skan CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) 904169689Skan 90590075Sobrien#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \ 90690075Sobrien %{rdynamic:-export-dynamic} \ 907169689Skan %{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}" 90890075Sobrien 909132718Skan#if defined(HAVE_LD_EH_FRAME_HDR) 91096263Sobrien# define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 91196263Sobrien#endif 91296263Sobrien 91396263Sobrien#define CPP_OS_LINUX_SPEC "-D__unix__ -D__gnu_linux__ -D__linux__ \ 91496263Sobrien%{!undef: \ 91596263Sobrien %{!ansi: \ 91696263Sobrien %{!std=*:-Dunix -D__unix -Dlinux -D__linux} \ 91796263Sobrien %{std=gnu*:-Dunix -D__unix -Dlinux -D__linux}}} \ 918132718Skan-Asystem=linux -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" 91990075Sobrien 92096263Sobrien/* GNU/Hurd support. */ 92196263Sobrien#define LIB_GNU_SPEC "%{mnewlib: --start-group -lgnu -lc --end-group } \ 92296263Sobrien%{!mnewlib: %{shared:-lc} %{!shared: %{pthread:-lpthread } \ 92396263Sobrien%{profile:-lc_p} %{!profile:-lc}}}" 92496263Sobrien 92596263Sobrien#define STARTFILE_GNU_SPEC "\ 92696263Sobrien%{!shared: %{!static: %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}} \ 92796263Sobrien%{static: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \ 92896263Sobrien%{mnewlib: ecrti.o%s} %{!mnewlib: crti.o%s} \ 92996263Sobrien%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 93096263Sobrien 93196263Sobrien#define ENDFILE_GNU_SPEC "%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ 93296263Sobrien%{mnewlib: ecrtn.o%s} %{!mnewlib: crtn.o%s}" 93396263Sobrien 93496263Sobrien#define LINK_START_GNU_SPEC "" 93596263Sobrien 93696263Sobrien#define LINK_OS_GNU_SPEC "-m elf32ppclinux %{!shared: %{!static: \ 93796263Sobrien %{rdynamic:-export-dynamic} \ 93896263Sobrien %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" 93996263Sobrien 94096263Sobrien#define CPP_OS_GNU_SPEC "-D__unix__ -D__gnu_hurd__ -D__GNU__ \ 94196263Sobrien%{!undef: \ 94296263Sobrien %{!ansi: -Dunix -D__unix}} \ 94396263Sobrien-Asystem=gnu -Asystem=unix -Asystem=posix %{pthread:-D_REENTRANT}" 94496263Sobrien 94590075Sobrien/* NetBSD support. */ 94690075Sobrien#define LIB_NETBSD_SPEC "\ 94790075Sobrien%{profile:-lgmon -lc_p} %{!profile:-lc}" 94890075Sobrien 94990075Sobrien#define STARTFILE_NETBSD_SPEC "\ 95090075Sobrienncrti.o%s crt0.o%s \ 95190075Sobrien%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 95290075Sobrien 95390075Sobrien#define ENDFILE_NETBSD_SPEC "\ 95490075Sobrien%{!shared:crtend.o%s} %{shared:crtendS.o%s} \ 95590075Sobrienncrtn.o%s" 95690075Sobrien 95790075Sobrien#define LINK_START_NETBSD_SPEC "\ 95890075Sobrien" 95990075Sobrien 96090075Sobrien#define LINK_OS_NETBSD_SPEC "\ 96190075Sobrien%{!shared: %{!static: \ 96290075Sobrien %{rdynamic:-export-dynamic} \ 96390075Sobrien %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.elf_so}}}" 96490075Sobrien 96590075Sobrien#define CPP_OS_NETBSD_SPEC "\ 966132718Skan-D__powerpc__ -D__NetBSD__ -D__KPRINTF_ATTRIBUTE__" 96790075Sobrien 968132718Skan/* OpenBSD support. */ 969132718Skan#ifndef LIB_OPENBSD_SPEC 970132718Skan#define LIB_OPENBSD_SPEC "%{!shared:%{pthread:-lpthread%{p:_p}%{!p:%{pg:_p}}}} %{!shared:-lc%{p:_p}%{!p:%{pg:_p}}}" 971132718Skan#endif 972110611Skan 973132718Skan#ifndef STARTFILE_OPENBSD_SPEC 974132718Skan#define STARTFILE_OPENBSD_SPEC "\ 975132718Skan%{!shared: %{pg:gcrt0.o%s} %{!pg:%{p:gcrt0.o%s} %{!p:crt0.o%s}}} \ 976132718Skan%{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 977132718Skan#endif 978110611Skan 979132718Skan#ifndef ENDFILE_OPENBSD_SPEC 980132718Skan#define ENDFILE_OPENBSD_SPEC "\ 981132718Skan%{!shared:crtend.o%s} %{shared:crtendS.o%s}" 982132718Skan#endif 98390075Sobrien 984132718Skan#ifndef LINK_START_OPENBSD_SPEC 985132718Skan#define LINK_START_OPENBSD_SPEC "-Ttext 0x400074" 986132718Skan#endif 98790075Sobrien 988132718Skan#ifndef LINK_OS_OPENBSD_SPEC 989132718Skan#define LINK_OS_OPENBSD_SPEC "" 990132718Skan#endif 99190075Sobrien 992132718Skan#ifndef CPP_OS_OPENBSD_SPEC 993132718Skan#define CPP_OS_OPENBSD_SPEC "%{posix:-D_POSIX_SOURCE} %{pthread:-D_POSIX_THREADS}" 994132718Skan#endif 99590075Sobrien 996117395Skan/* WindISS support. */ 997117395Skan 998117395Skan#define LIB_WINDISS_SPEC "--start-group -li -lcfp -lwindiss -lram -limpl -limpfp --end-group" 999117395Skan 1000117395Skan#define CPP_OS_WINDISS_SPEC "\ 1001117395Skan-D__rtasim \ 1002117395Skan-D__EABI__ \ 1003117395Skan-D__ppc \ 1004117395Skan%{!msoft-float: -D__hardfp} \ 1005117395Skan" 1006117395Skan 1007117395Skan#define STARTFILE_WINDISS_SPEC "crt0.o%s crtbegin.o%s" 1008117395Skan 1009117395Skan#define ENDFILE_WINDISS_SPEC "crtend.o%s" 1010117395Skan 1011117395Skan#define LINK_START_WINDISS_SPEC "" 1012117395Skan 1013117395Skan#define LINK_OS_WINDISS_SPEC "" 1014117395Skan 101590075Sobrien/* Define any extra SPECS that the compiler needs to generate. */ 101690075Sobrien/* Override rs6000.h definition. */ 101790075Sobrien#undef SUBTARGET_EXTRA_SPECS 101890075Sobrien#define SUBTARGET_EXTRA_SPECS \ 1019169689Skan { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \ 102090075Sobrien { "lib_ads", LIB_ADS_SPEC }, \ 102190075Sobrien { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \ 102290075Sobrien { "lib_mvme", LIB_MVME_SPEC }, \ 102390075Sobrien { "lib_sim", LIB_SIM_SPEC }, \ 102490075Sobrien { "lib_freebsd", LIB_FREEBSD_SPEC }, \ 102596263Sobrien { "lib_gnu", LIB_GNU_SPEC }, \ 102690075Sobrien { "lib_linux", LIB_LINUX_SPEC }, \ 102790075Sobrien { "lib_netbsd", LIB_NETBSD_SPEC }, \ 1028132718Skan { "lib_openbsd", LIB_OPENBSD_SPEC }, \ 1029169689Skan { "lib_windiss", LIB_WINDISS_SPEC }, \ 103090075Sobrien { "lib_default", LIB_DEFAULT_SPEC }, \ 103190075Sobrien { "startfile_ads", STARTFILE_ADS_SPEC }, \ 103290075Sobrien { "startfile_yellowknife", STARTFILE_YELLOWKNIFE_SPEC }, \ 103390075Sobrien { "startfile_mvme", STARTFILE_MVME_SPEC }, \ 103490075Sobrien { "startfile_sim", STARTFILE_SIM_SPEC }, \ 103590075Sobrien { "startfile_freebsd", STARTFILE_FREEBSD_SPEC }, \ 103696263Sobrien { "startfile_gnu", STARTFILE_GNU_SPEC }, \ 103790075Sobrien { "startfile_linux", STARTFILE_LINUX_SPEC }, \ 103890075Sobrien { "startfile_netbsd", STARTFILE_NETBSD_SPEC }, \ 1039132718Skan { "startfile_openbsd", STARTFILE_OPENBSD_SPEC }, \ 1040169689Skan { "startfile_windiss", STARTFILE_WINDISS_SPEC }, \ 104190075Sobrien { "startfile_default", STARTFILE_DEFAULT_SPEC }, \ 104290075Sobrien { "endfile_ads", ENDFILE_ADS_SPEC }, \ 104390075Sobrien { "endfile_yellowknife", ENDFILE_YELLOWKNIFE_SPEC }, \ 104490075Sobrien { "endfile_mvme", ENDFILE_MVME_SPEC }, \ 104590075Sobrien { "endfile_sim", ENDFILE_SIM_SPEC }, \ 104690075Sobrien { "endfile_freebsd", ENDFILE_FREEBSD_SPEC }, \ 104796263Sobrien { "endfile_gnu", ENDFILE_GNU_SPEC }, \ 104890075Sobrien { "endfile_linux", ENDFILE_LINUX_SPEC }, \ 104990075Sobrien { "endfile_netbsd", ENDFILE_NETBSD_SPEC }, \ 1050132718Skan { "endfile_openbsd", ENDFILE_OPENBSD_SPEC }, \ 1051169689Skan { "endfile_windiss", ENDFILE_WINDISS_SPEC }, \ 105290075Sobrien { "endfile_default", ENDFILE_DEFAULT_SPEC }, \ 105390075Sobrien { "link_path", LINK_PATH_SPEC }, \ 105490075Sobrien { "link_shlib", LINK_SHLIB_SPEC }, \ 105590075Sobrien { "link_target", LINK_TARGET_SPEC }, \ 105690075Sobrien { "link_start", LINK_START_SPEC }, \ 105790075Sobrien { "link_start_ads", LINK_START_ADS_SPEC }, \ 105890075Sobrien { "link_start_yellowknife", LINK_START_YELLOWKNIFE_SPEC }, \ 105990075Sobrien { "link_start_mvme", LINK_START_MVME_SPEC }, \ 106090075Sobrien { "link_start_sim", LINK_START_SIM_SPEC }, \ 106190075Sobrien { "link_start_freebsd", LINK_START_FREEBSD_SPEC }, \ 106296263Sobrien { "link_start_gnu", LINK_START_GNU_SPEC }, \ 106390075Sobrien { "link_start_linux", LINK_START_LINUX_SPEC }, \ 106490075Sobrien { "link_start_netbsd", LINK_START_NETBSD_SPEC }, \ 1065132718Skan { "link_start_openbsd", LINK_START_OPENBSD_SPEC }, \ 1066117395Skan { "link_start_windiss", LINK_START_WINDISS_SPEC }, \ 106790075Sobrien { "link_start_default", LINK_START_DEFAULT_SPEC }, \ 106890075Sobrien { "link_os", LINK_OS_SPEC }, \ 106990075Sobrien { "link_os_ads", LINK_OS_ADS_SPEC }, \ 107090075Sobrien { "link_os_yellowknife", LINK_OS_YELLOWKNIFE_SPEC }, \ 107190075Sobrien { "link_os_mvme", LINK_OS_MVME_SPEC }, \ 107290075Sobrien { "link_os_sim", LINK_OS_SIM_SPEC }, \ 107390075Sobrien { "link_os_freebsd", LINK_OS_FREEBSD_SPEC }, \ 107490075Sobrien { "link_os_linux", LINK_OS_LINUX_SPEC }, \ 107596263Sobrien { "link_os_gnu", LINK_OS_GNU_SPEC }, \ 107690075Sobrien { "link_os_netbsd", LINK_OS_NETBSD_SPEC }, \ 1077132718Skan { "link_os_openbsd", LINK_OS_OPENBSD_SPEC }, \ 1078117395Skan { "link_os_windiss", LINK_OS_WINDISS_SPEC }, \ 107990075Sobrien { "link_os_default", LINK_OS_DEFAULT_SPEC }, \ 108090075Sobrien { "cc1_endian_big", CC1_ENDIAN_BIG_SPEC }, \ 108190075Sobrien { "cc1_endian_little", CC1_ENDIAN_LITTLE_SPEC }, \ 108290075Sobrien { "cc1_endian_default", CC1_ENDIAN_DEFAULT_SPEC }, \ 1083169689Skan { "cc1_secure_plt_default", CC1_SECURE_PLT_DEFAULT_SPEC }, \ 108490075Sobrien { "cpp_os_ads", CPP_OS_ADS_SPEC }, \ 108590075Sobrien { "cpp_os_yellowknife", CPP_OS_YELLOWKNIFE_SPEC }, \ 108690075Sobrien { "cpp_os_mvme", CPP_OS_MVME_SPEC }, \ 108790075Sobrien { "cpp_os_sim", CPP_OS_SIM_SPEC }, \ 108890075Sobrien { "cpp_os_freebsd", CPP_OS_FREEBSD_SPEC }, \ 108996263Sobrien { "cpp_os_gnu", CPP_OS_GNU_SPEC }, \ 109090075Sobrien { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \ 109190075Sobrien { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ 1092132718Skan { "cpp_os_openbsd", CPP_OS_OPENBSD_SPEC }, \ 1093169689Skan { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \ 1094132718Skan { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \ 1095132718Skan { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }, \ 1096132718Skan SUBSUBTARGET_EXTRA_SPECS 109790075Sobrien 1098132718Skan#define SUBSUBTARGET_EXTRA_SPECS 1099132718Skan 110090075Sobrien/* Define this macro as a C expression for the initializer of an 110190075Sobrien array of string to tell the driver program which options are 110290075Sobrien defaults for this target and thus do not need to be handled 110390075Sobrien specially when using `MULTILIB_OPTIONS'. 110490075Sobrien 110590075Sobrien Do not define this macro if `MULTILIB_OPTIONS' is not defined in 110690075Sobrien the target makefile fragment or if none of the options listed in 110790075Sobrien `MULTILIB_OPTIONS' are set by default. *Note Target Fragment::. */ 110890075Sobrien 110990075Sobrien#define MULTILIB_DEFAULTS { "mbig", "mcall-sysv" } 111090075Sobrien 111190075Sobrien/* Define this macro if the code for function profiling should come 111290075Sobrien before the function prologue. Normally, the profiling code comes 111390075Sobrien after. */ 111490075Sobrien#define PROFILE_BEFORE_PROLOGUE 1 111590075Sobrien 111690075Sobrien/* Function name to call to do profiling. */ 111790075Sobrien#define RS6000_MCOUNT "_mcount" 111890075Sobrien 111990075Sobrien/* Define this macro (to a value of 1) if you want to support the 112090075Sobrien Win32 style pragmas #pragma pack(push,<n>)' and #pragma 112190075Sobrien pack(pop)'. The pack(push,<n>) pragma specifies the maximum 112290075Sobrien alignment (in bytes) of fields within a structure, in much the 112390075Sobrien same way as the __aligned__' and __packed__' __attribute__'s 1124117395Skan do. A pack value of zero resets the behavior to the default. 112590075Sobrien Successive invocations of this pragma cause the previous values to 112690075Sobrien be stacked, so that invocations of #pragma pack(pop)' will return 112790075Sobrien to the previous value. */ 112890075Sobrien 112990075Sobrien#define HANDLE_PRAGMA_PACK_PUSH_POP 1 113090075Sobrien 113190075Sobrien/* Select a format to encode pointers in exception handling data. CODE 113290075Sobrien is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is 113390075Sobrien true if the symbol may be affected by dynamic relocations. */ 113490075Sobrien#define ASM_PREFERRED_EH_DATA_FORMAT(CODE,GLOBAL) \ 113590075Sobrien ((flag_pic || TARGET_RELOCATABLE) \ 113690075Sobrien ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_sdata4) \ 113790075Sobrien : DW_EH_PE_absptr) 113890075Sobrien 113990075Sobrien#define DOUBLE_INT_ASM_OP "\t.quad\t" 114090075Sobrien 114190075Sobrien/* Generate entries in .fixup for relocatable addresses. */ 1142146895Skan#define RELOCATABLE_NEEDS_FIXUP 1 1143169689Skan 1144169689Skan/* This target uses the sysv4.opt file. */ 1145169689Skan#define TARGET_USES_SYSV4_OPT 1 1146