aix.h revision 90075
190075Sobrien/* Definitions of target machine for GNU compiler, 290075Sobrien for IBM RS/6000 POWER running AIX. 390075Sobrien Copyright (C) 2000, 2001 Free Software Foundation, Inc. 490075Sobrien 590075SobrienThis file is part of GNU CC. 690075Sobrien 790075SobrienGNU CC is free software; you can redistribute it and/or modify 890075Sobrienit under the terms of the GNU General Public License as published by 990075Sobrienthe Free Software Foundation; either version 2, or (at your option) 1090075Sobrienany later version. 1190075Sobrien 1290075SobrienGNU CC is distributed in the hope that it will be useful, 1390075Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1490075SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1590075SobrienGNU General Public License for more details. 1690075Sobrien 1790075SobrienYou should have received a copy of the GNU General Public License 1890075Sobrienalong with GNU CC; see the file COPYING. If not, write to 1990075Sobrienthe Free Software Foundation, 59 Temple Place - Suite 330, 2090075SobrienBoston, MA 02111-1307, USA. */ 2190075Sobrien 2290075Sobrien/* Yes! We are AIX! */ 2390075Sobrien#define DEFAULT_ABI ABI_AIX 2490075Sobrien#undef TARGET_AIX 2590075Sobrien#define TARGET_AIX 1 2690075Sobrien/* The AIX linker will discard static constructors in object files before 2790075Sobrien collect has a chance to see them, so scan the object files directly. */ 2890075Sobrien#define COLLECT_EXPORT_LIST 2990075Sobrien 3090075Sobrien/* This is the only version of nm that collect2 can work with. */ 3190075Sobrien#define REAL_NM_FILE_NAME "/usr/ucb/nm" 3290075Sobrien 3390075Sobrien#define USER_LABEL_PREFIX "" 3490075Sobrien/* Don't turn -B into -L if the argument specifies a relative file name. */ 3590075Sobrien#define RELATIVE_PREFIX_NOT_LINKDIR 3690075Sobrien 3790075Sobrien/* Because of the above, we must have gcc search itself to find libgcc.a. */ 3890075Sobrien#define LINK_LIBGCC_SPECIAL_1 3990075Sobrien 4090075Sobrien/* Names to predefine in the preprocessor for this target machine. */ 4190075Sobrien#define CPP_PREDEFINES "-D_IBMR2 -D_POWER -D_AIX -D_AIX32 -D_LONG_LONG \ 4290075Sobrien-Asystem=unix -Asystem=aix -Acpu=rs6000 -Amachine=rs6000" 4390075Sobrien 4490075Sobrien/* Define appropriate architecture macros for preprocessor depending on 4590075Sobrien target switches. */ 4690075Sobrien 4790075Sobrien#define CPP_SPEC "%{posix: -D_POSIX_SOURCE}\ 4890075Sobrien %{ansi: -D_ANSI_C_SOURCE}\ 4990075Sobrien %(cpp_cpu)" 5090075Sobrien 5190075Sobrien#undef CPP_DEFAULT_SPEC 5290075Sobrien#define CPP_DEFAULT_SPEC "-D_ARCH_PWR" 5390075Sobrien 5490075Sobrien#undef ASM_DEFAULT_SPEC 5590075Sobrien#define ASM_DEFAULT_SPEC "" 5690075Sobrien 5790075Sobrien/* Tell the assembler to assume that all undefined names are external. 5890075Sobrien 5990075Sobrien Don't do this until the fixed IBM assembler is more generally available. 6090075Sobrien When this becomes permanently defined, the ASM_OUTPUT_EXTERNAL, 6190075Sobrien ASM_OUTPUT_EXTERNAL_LIBCALL, and RS6000_OUTPUT_BASENAME macros will no 6290075Sobrien longer be needed. Also, the extern declaration of mcount in ASM_FILE_START 6390075Sobrien will no longer be needed. */ 6490075Sobrien 6590075Sobrien/* #define ASM_SPEC "-u %(asm_cpu)" */ 6690075Sobrien 6790075Sobrien/* Default location of syscalls.exp under AIX */ 6890075Sobrien#ifndef CROSS_COMPILE 6990075Sobrien#define LINK_SYSCALLS_SPEC "-bI:/lib/syscalls.exp" 7090075Sobrien#else 7190075Sobrien#define LINK_SYSCALLS_SPEC "" 7290075Sobrien#endif 7390075Sobrien 7490075Sobrien/* Default location of libg.exp under AIX */ 7590075Sobrien#ifndef CROSS_COMPILE 7690075Sobrien#define LINK_LIBG_SPEC "-bexport:/usr/lib/libg.exp" 7790075Sobrien#else 7890075Sobrien#define LINK_LIBG_SPEC "" 7990075Sobrien#endif 8090075Sobrien 8190075Sobrien/* Define the options for the binder: Start text at 512, align all segments 8290075Sobrien to 512 bytes, and warn if there is text relocation. 8390075Sobrien 8490075Sobrien The -bhalt:4 option supposedly changes the level at which ld will abort, 8590075Sobrien but it also suppresses warnings about multiply defined symbols and is 8690075Sobrien used by the AIX cc command. So we use it here. 8790075Sobrien 8890075Sobrien -bnodelcsect undoes a poor choice of default relating to multiply-defined 8990075Sobrien csects. See AIX documentation for more information about this. 9090075Sobrien 9190075Sobrien -bM:SRE tells the linker that the output file is Shared REusable. Note 9290075Sobrien that to actually build a shared library you will also need to specify an 9390075Sobrien export list with the -Wl,-bE option. */ 9490075Sobrien 9590075Sobrien#define LINK_SPEC "-T512 -H512 %{!r:-btextro} -bhalt:4 -bnodelcsect\ 9690075Sobrien%{static:-bnso %(link_syscalls) } \ 9790075Sobrien%{!shared:%{g*: %(link_libg) }} %{shared:-bM:SRE}" 9890075Sobrien 9990075Sobrien/* Profiled library versions are used by linking with special directories. */ 10090075Sobrien#define LIB_SPEC "%{pg:-L/lib/profiled -L/usr/lib/profiled}\ 10190075Sobrien%{p:-L/lib/profiled -L/usr/lib/profiled} %{!shared:%{g*:-lg}} -lc" 10290075Sobrien 10390075Sobrien/* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ 10490075Sobrien#define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ 10590075Sobrien (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ 10690075Sobrien ? get_inner_array_type (FIELD) \ 10790075Sobrien : TREE_TYPE (FIELD)) == DFmode \ 10890075Sobrien ? MIN ((COMPUTED), 32) : (COMPUTED)) 10990075Sobrien 11090075Sobrien/* AIX increases natural record alignment to doubleword if the first 11190075Sobrien field is an FP double while the FP fields remain word aligned. */ 11290075Sobrien#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ 11390075Sobrien ((TREE_CODE (STRUCT) == RECORD_TYPE \ 11490075Sobrien || TREE_CODE (STRUCT) == UNION_TYPE \ 11590075Sobrien || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ 11690075Sobrien && TYPE_FIELDS (STRUCT) != 0 \ 11790075Sobrien && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ 11890075Sobrien ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ 11990075Sobrien : MAX ((COMPUTED), (SPECIFIED))) 12090075Sobrien 12190075Sobrien 12290075Sobrien 12390075Sobrien/* Indicate that jump tables go in the text section. */ 12490075Sobrien 12590075Sobrien#define JUMP_TABLES_IN_TEXT_SECTION 1 12690075Sobrien 12790075Sobrien/* Enable AIX XL compiler calling convention breakage compatibility. */ 12890075Sobrien#undef TARGET_XL_CALL 12990075Sobrien#define MASK_XL_CALL 0x40000000 13090075Sobrien#define TARGET_XL_CALL (target_flags & MASK_XL_CALL) 13190075Sobrien#undef SUBTARGET_SWITCHES 13290075Sobrien#define SUBTARGET_SWITCHES \ 13390075Sobrien {"xl-call", MASK_XL_CALL, \ 13490075Sobrien N_("Always pass floating-point arguments in memory") }, \ 13590075Sobrien {"no-xl-call", - MASK_XL_CALL, \ 13690075Sobrien N_("Don't always pass floating-point arguments in memory") }, \ 13790075Sobrien SUBSUBTARGET_SWITCHES 13890075Sobrien#define SUBSUBTARGET_SWITCHES 13990075Sobrien 14090075Sobrien/* Define any extra SPECS that the compiler needs to generate. */ 14190075Sobrien#undef SUBTARGET_EXTRA_SPECS 14290075Sobrien#define SUBTARGET_EXTRA_SPECS \ 14390075Sobrien { "link_syscalls", LINK_SYSCALLS_SPEC }, \ 14490075Sobrien { "link_libg", LINK_LIBG_SPEC } 14590075Sobrien 14690075Sobrien/* Define cutoff for using external functions to save floating point. */ 14790075Sobrien#define FP_SAVE_INLINE(FIRST_REG) ((FIRST_REG) == 62 || (FIRST_REG) == 63) 14890075Sobrien 14990075Sobrien/* Optabs entries for the int->float routines and quad FP operations 15090075Sobrien using the standard AIX names. */ 15190075Sobrien#define ADDTF3_LIBCALL "_xlqadd" 15290075Sobrien#define DIVTF3_LIBCALL "_xlqdiv" 15390075Sobrien#define MULTF3_LIBCALL "_xlqmul" 15490075Sobrien#define SUBTF3_LIBCALL "_xlqsub" 15590075Sobrien 15690075Sobrien#define INIT_TARGET_OPTABS \ 15790075Sobrien do { \ 15890075Sobrien if (! TARGET_POWER2 && ! TARGET_POWERPC && TARGET_HARD_FLOAT) \ 15990075Sobrien { \ 16090075Sobrien fixdfsi_libfunc = init_one_libfunc (RS6000_ITRUNC); \ 16190075Sobrien fixunsdfsi_libfunc = init_one_libfunc (RS6000_UITRUNC); \ 16290075Sobrien } \ 16390075Sobrien if (TARGET_HARD_FLOAT) \ 16490075Sobrien { \ 16590075Sobrien add_optab->handlers[(int) TFmode].libfunc \ 16690075Sobrien = init_one_libfunc (ADDTF3_LIBCALL); \ 16790075Sobrien sub_optab->handlers[(int) TFmode].libfunc \ 16890075Sobrien = init_one_libfunc (SUBTF3_LIBCALL); \ 16990075Sobrien smul_optab->handlers[(int) TFmode].libfunc \ 17090075Sobrien = init_one_libfunc (MULTF3_LIBCALL); \ 17190075Sobrien sdiv_optab->handlers[(int) TFmode].libfunc \ 17290075Sobrien = init_one_libfunc (DIVTF3_LIBCALL); \ 17390075Sobrien } \ 17490075Sobrien } while (0) 17590075Sobrien 17690075Sobrien/* AIX always has a TOC. */ 17790075Sobrien#define TARGET_NO_TOC 0 17890075Sobrien#define TARGET_TOC 1 17990075Sobrien 18090075Sobrien#define FIXED_R2 1 18190075Sobrien/* AIX allows r13 to be used. */ 18290075Sobrien#define FIXED_R13 0 18390075Sobrien 18490075Sobrien/* __throw will restore its own return address to be the same as the 18590075Sobrien return address of the function that the throw is being made to. 18690075Sobrien This is unfortunate, because we want to check the original 18790075Sobrien return address to see if we need to restore the TOC. 18890075Sobrien So we have to squirrel it away with this. */ 18990075Sobrien#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init () 19090075Sobrien 19190075Sobrien#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) 19290075Sobrien 19390075Sobrien/* Print subsidiary information on the compiler version in use. */ 19490075Sobrien#define TARGET_VERSION ; 195