diff options
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/darwin.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/freebsd.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/linux.h | 2 | ||||
-rw-r--r-- | gcc/config/i386/netbsd-elf.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/biarch64.h | 22 | ||||
-rw-r--r-- | gcc/config/rs6000/default64.h | 24 | ||||
-rw-r--r-- | gcc/config/rs6000/eabi-ci.asm | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/eabi-cn.asm | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/linux.h | 8 | ||||
-rw-r--r-- | gcc/config/rs6000/linux64.h | 571 | ||||
-rw-r--r-- | gcc/config/rs6000/ppc-asm.h | 35 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 114 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.md | 5 | ||||
-rw-r--r-- | gcc/config/rs6000/sol-ci.asm | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/sol-cn.asm | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/sysv4.h | 97 | ||||
-rw-r--r-- | gcc/config/rs6000/t-linux64 | 41 | ||||
-rw-r--r-- | gcc/config/rs6000/tramp.asm | 2 | ||||
-rw-r--r-- | gcc/config/rs6000/x-linux64 | 2 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.h | 2 |
21 files changed, 662 insertions, 279 deletions
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index d3f09da..72c1eeb 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -310,7 +310,7 @@ do { text_section (); \ /* Our profiling scheme doesn't LP labels and counter words. */ -#define NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 #undef INIT_SECTION_ASM_OP #define INIT_SECTION_ASM_OP diff --git a/gcc/config/i386/freebsd.h b/gcc/config/i386/freebsd.h index 7e9af2e..64b152f 100644 --- a/gcc/config/i386/freebsd.h +++ b/gcc/config/i386/freebsd.h @@ -43,7 +43,7 @@ Boston, MA 02111-1307, USA. */ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) #undef NO_PROFILE_COUNTERS -#define NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 /* Tell final.c that we don't need a label passed to mcount. */ diff --git a/gcc/config/i386/linux.h b/gcc/config/i386/linux.h index 1573393..90dcd1d 100644 --- a/gcc/config/i386/linux.h +++ b/gcc/config/i386/linux.h @@ -51,7 +51,7 @@ Boston, MA 02111-1307, USA. */ To the best of my knowledge, no Linux libc has required the label argument to mcount. */ -#define NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 #undef MCOUNT_NAME #define MCOUNT_NAME "mcount" diff --git a/gcc/config/i386/netbsd-elf.h b/gcc/config/i386/netbsd-elf.h index 4f49bd3..3d77949 100644 --- a/gcc/config/i386/netbsd-elf.h +++ b/gcc/config/i386/netbsd-elf.h @@ -76,7 +76,7 @@ Boston, MA 02111-1307, USA. */ /* Output assembler code to FILE to call the profiler. */ #undef NO_PROFILE_COUNTERS -#define NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 #undef FUNCTION_PROFILER #define FUNCTION_PROFILER(FILE, LABELNO) \ diff --git a/gcc/config/rs6000/biarch64.h b/gcc/config/rs6000/biarch64.h new file mode 100644 index 0000000..4fe076e --- /dev/null +++ b/gcc/config/rs6000/biarch64.h @@ -0,0 +1,22 @@ +/* Definitions of target machine for GNU compiler, for 32/64 bit powerpc. + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +/* Specify this in a cover file to provide bi-architecture (32/64) support. */ +#define RS6000_BI_ARCH 1 diff --git a/gcc/config/rs6000/default64.h b/gcc/config/rs6000/default64.h new file mode 100644 index 0000000..13ccd2d --- /dev/null +++ b/gcc/config/rs6000/default64.h @@ -0,0 +1,24 @@ +/* Definitions of target machine for GNU compiler, + for 64 bit powerpc linux defaulting to -m64. + Copyright (C) 2003 Free Software Foundation, Inc. + +This file is part of GNU CC. + +GNU CC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU CC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU CC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef TARGET_DEFAULT +#define TARGET_DEFAULT \ + (MASK_POWERPC | MASK_POWERPC64 | MASK_64BIT | MASK_NEW_MNEMONICS) diff --git a/gcc/config/rs6000/eabi-ci.asm b/gcc/config/rs6000/eabi-ci.asm index 64ffbfc..447b4e2 100644 --- a/gcc/config/rs6000/eabi-ci.asm +++ b/gcc/config/rs6000/eabi-ci.asm @@ -41,6 +41,7 @@ Boston, MA 02111-1307, USA. #include <ppc-asm.h> +#ifndef __powerpc64__ .section ".got","aw" .globl __GOT_START__ .type __GOT_START__,@object @@ -122,3 +123,4 @@ FUNC_START(__fini) stwu 1,-16(1) mflr 0 stw 0,20(1) +#endif diff --git a/gcc/config/rs6000/eabi-cn.asm b/gcc/config/rs6000/eabi-cn.asm index 4a01dc6..b2c6095 100644 --- a/gcc/config/rs6000/eabi-cn.asm +++ b/gcc/config/rs6000/eabi-cn.asm @@ -39,6 +39,7 @@ Boston, MA 02111-1307, USA. .file "crtn.s" .ident "GNU C crtn.s" +#ifndef __powerpc64__ .section ".got","aw" .globl __GOT_END__ .type __GOT_END__,@object @@ -113,3 +114,4 @@ __EH_FRAME_END__: mtlr 0 addi 1,1,16 blr +#endif diff --git a/gcc/config/rs6000/linux.h b/gcc/config/rs6000/linux.h index 98e85e4..0eaf5df 100644 --- a/gcc/config/rs6000/linux.h +++ b/gcc/config/rs6000/linux.h @@ -32,6 +32,7 @@ builtin_define_std ("powerpc"); \ builtin_assert ("cpu=powerpc"); \ builtin_assert ("machine=powerpc"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ } \ while (0) @@ -78,6 +79,13 @@ #undef DRAFT_V4_STRUCT_RET #define DRAFT_V4_STRUCT_RET 1 +/* We are 32-bit all the time, so optimize a little. */ +#undef TARGET_64BIT +#define TARGET_64BIT 0 + +/* We don't need to generate entries in .fixup. */ +#undef RELOCATABLE_NEEDS_FIXUP + /* Do code reading to identify a signal frame, and set the frame state data appropriately. See unwind-dw2.c for the structs. */ diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index 5a31366..f63b7d4 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -19,43 +19,163 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* Yes! We are AIX! Err. Wait. We're Linux!. No, wait, we're a - combo of both!*/ -#undef DEFAULT_ABI -#define DEFAULT_ABI ABI_AIX +#ifndef RS6000_BI_ARCH -#undef TARGET_AIX -#define TARGET_AIX 1 +#undef DEFAULT_ABI +#define DEFAULT_ABI ABI_AIX -#undef TARGET_DEFAULT -#define TARGET_DEFAULT \ - (MASK_POWERPC | MASK_POWERPC64 | MASK_64BIT | MASK_NEW_MNEMONICS) +#undef TARGET_64BIT +#define TARGET_64BIT 1 + +#define DEFAULT_ARCH64_P 1 +#define RS6000_BI_ARCH_P 0 + +#else + +#define DEFAULT_ARCH64_P (TARGET_DEFAULT & MASK_64BIT) +#define RS6000_BI_ARCH_P 1 + +#endif + +#ifdef IN_LIBGCC2 +#undef TARGET_64BIT +#ifdef __powerpc64__ +#define TARGET_64BIT 1 +#else +#define TARGET_64BIT 0 +#endif +#endif + +#undef TARGET_AIX +#define TARGET_AIX TARGET_64BIT -#undef PROCESSOR_DEFAULT -#define PROCESSOR_DEFAULT PROCESSOR_PPC630 -#undef PROCESSOR_DEFAULT64 +#undef PROCESSOR_DEFAULT64 #define PROCESSOR_DEFAULT64 PROCESSOR_PPC630 -#undef ASM_DEFAULT_SPEC -#define ASM_DEFAULT_SPEC "-mppc64" +#undef TARGET_RELOCATABLE +#define TARGET_RELOCATABLE (!TARGET_64BIT && (target_flags & MASK_RELOCATABLE)) + +#undef RS6000_ABI_NAME +#define RS6000_ABI_NAME (TARGET_64BIT ? "aixdesc" : "sysv") + +#define INVALID_64BIT "-m%s not supported in this configuration" +#define INVALID_32BIT INVALID_64BIT + +#undef SUBSUBTARGET_OVERRIDE_OPTIONS +#define SUBSUBTARGET_OVERRIDE_OPTIONS \ + do \ + { \ + if (TARGET_64BIT) \ + { \ + if (DEFAULT_ABI != ABI_AIX) \ + { \ + DEFAULT_ABI = ABI_AIX; \ + error (INVALID_64BIT, "call"); \ + } \ + if (TARGET_RELOCATABLE) \ + { \ + target_flags &= ~MASK_RELOCATABLE; \ + error (INVALID_64BIT, "relocatable"); \ + } \ + if (TARGET_EABI) \ + { \ + target_flags &= ~MASK_EABI; \ + error (INVALID_64BIT, "eabi"); \ + } \ + if (TARGET_PROTOTYPE) \ + { \ + target_flags &= ~MASK_PROTOTYPE; \ + error (INVALID_64BIT, "prototype"); \ + } \ + } \ + else \ + { \ + if (!RS6000_BI_ARCH_P) \ + error (INVALID_32BIT, "32"); \ + } \ + } \ + while (0) + +#ifdef RS6000_BI_ARCH + +#undef OVERRIDE_OPTIONS +#define OVERRIDE_OPTIONS \ + rs6000_override_options (((TARGET_DEFAULT ^ target_flags) & MASK_64BIT) \ + ? (char *) 0 : TARGET_CPU_DEFAULT) + +#undef ASM_FILE_START +#define ASM_FILE_START(FILE) \ + do \ + { \ + output_file_directive ((FILE), main_input_filename); \ + rs6000_file_start (FILE, (((TARGET_DEFAULT ^ target_flags) \ + & MASK_64BIT) \ + ? (char *) 0 : TARGET_CPU_DEFAULT)); \ + } \ + while (0) + +#endif +#undef ASM_DEFAULT_SPEC #undef ASM_SPEC -#define ASM_SPEC "%{.s: %{mregnames} %{mno-regnames}} \ -%{.S: %{mregnames} %{mno-regnames}} \ -%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian} \ -%{v:-V} %{Qy:} %{!Qn:-Qy} -a64 %(asm_cpu) %{Wa,*:%*}" +#undef LINK_OS_LINUX_SPEC -/* This is always a 64 bit compiler. */ -#undef TARGET_64BIT -#define TARGET_64BIT 1 +#ifndef RS6000_BI_ARCH +#define ASM_DEFAULT_SPEC "-mppc64" +#define ASM_SPEC "%(asm_spec64) %(asm_spec_common)" +#define LINK_OS_LINUX_SPEC "%(link_os_linux_spec64)" +#else +#if DEFAULT_ARCH64_P +#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}" +#define ASM_SPEC "%{m32:%(asm_spec32)}%{!m32:%(asm_spec64)} %(asm_spec_common)" +#define LINK_OS_LINUX_SPEC "%{m32:%(link_os_linux_spec32)}%{!m32:%(link_os_linux_spec64)}" +#else +#define ASM_DEFAULT_SPEC "-mppc%{m64:64}" +#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)" +#define LINK_OS_LINUX_SPEC "%{!m64:%(link_os_linux_spec32)}%{m64:%(link_os_linux_spec64)}" +#endif +#endif + +#define ASM_SPEC32 "-a32 %{n} %{T} %{Ym,*} %{Yd,*} \ +%{mrelocatable} %{mrelocatable-lib} %{fpic:-K PIC} %{fPIC:-K PIC} \ +%{memb} %{!memb: %{msdata: -memb} %{msdata=eabi: -memb}} \ +%{!mlittle: %{!mlittle-endian: %{!mbig: %{!mbig-endian: \ + %{mcall-freebsd: -mbig} \ + %{mcall-i960-old: -mlittle} \ + %{mcall-linux: -mbig} \ + %{mcall-gnu: -mbig} \ + %{mcall-netbsd: -mbig} \ +}}}}" + +#define ASM_SPEC64 "-a64" + +#define ASM_SPEC_COMMON "%(asm_cpu) \ +%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \ +%{v:-V} %{Qy:} %{!Qn:-Qy} %{Wa,*:%*} \ +%{mlittle} %{mlittle-endian} %{mbig} %{mbig-endian}" + +#undef SUBSUBTARGET_EXTRA_SPECS +#define SUBSUBTARGET_EXTRA_SPECS \ + { "asm_spec_common", ASM_SPEC_COMMON }, \ + { "asm_spec32", ASM_SPEC32 }, \ + { "asm_spec64", ASM_SPEC64 }, \ + { "link_os_linux_spec32", LINK_OS_LINUX_SPEC32 }, \ + { "link_os_linux_spec64", LINK_OS_LINUX_SPEC64 }, + +#undef MULTILIB_DEFAULTS +#if DEFAULT_ARCH64_P +#define MULTILIB_DEFAULTS { "m64" } +#else +#define MULTILIB_DEFAULTS { "m32" } +#endif + +#ifndef RS6000_BI_ARCH /* 64-bit PowerPC Linux always has a TOC. */ -#undef TARGET_NO_TOC -#define TARGET_NO_TOC 0 #undef TARGET_TOC #define TARGET_TOC 1 -/* Some things from sysv4.h we don't do. */ +/* Some things from sysv4.h we don't do when 64 bit. */ #undef TARGET_RELOCATABLE #define TARGET_RELOCATABLE 0 #undef TARGET_EABI @@ -63,8 +183,9 @@ #undef TARGET_PROTOTYPE #define TARGET_PROTOTYPE 0 -/* Reuse sysv4 mask bits we made available above. */ -#define MASK_PROFILE_KERNEL 0x08000000 +#endif + +#define MASK_PROFILE_KERNEL 0x00080000 /* Non-standard profiling for kernels, which just saves LR then calls _mcount without worrying about arg saves. The idea is to change @@ -73,88 +194,62 @@ #define TARGET_PROFILE_KERNEL (target_flags & MASK_PROFILE_KERNEL) /* Override sysv4.h. */ -#undef SUBTARGET_SWITCHES -#define SUBTARGET_SWITCHES \ - {"bit-align", -MASK_NO_BITFIELD_TYPE, \ - N_("Align to the base type of the bit-field") }, \ - {"no-bit-align", MASK_NO_BITFIELD_TYPE, \ - N_("Don't align to the base type of the bit-field") }, \ - {"strict-align", MASK_STRICT_ALIGN, \ - N_("Don't assume that unaligned accesses are handled by the system") }, \ - {"no-strict-align", -MASK_STRICT_ALIGN, \ - N_("Assume that unaligned accesses are handled by the system") }, \ - {"little-endian", MASK_LITTLE_ENDIAN, \ - N_("Produce little endian code") }, \ - {"little", MASK_LITTLE_ENDIAN, \ - N_("Produce little endian code") }, \ - {"big-endian", -MASK_LITTLE_ENDIAN, \ - N_("Produce big endian code") }, \ - {"big", -MASK_LITTLE_ENDIAN, \ - N_("Produce big endian code") }, \ - {"bit-word", -MASK_NO_BITFIELD_WORD, \ - N_("Allow bit-fields to cross word boundaries") }, \ - {"no-bit-word", MASK_NO_BITFIELD_WORD, \ - N_("Do not allow bit-fields to cross word boundaries") }, \ - {"regnames", MASK_REGNAMES, \ - N_("Use alternate register names") }, \ - {"no-regnames", -MASK_REGNAMES, \ - N_("Don't use alternate register names") }, \ +#undef EXTRA_SUBTARGET_SWITCHES +#define EXTRA_SUBTARGET_SWITCHES \ {"profile-kernel", MASK_PROFILE_KERNEL, \ N_("Call mcount for profiling before a function prologue") }, \ {"no-profile-kernel", -MASK_PROFILE_KERNEL, \ N_("Call mcount for profiling after a function prologue") }, -#undef SUBTARGET_OPTIONS -#define SUBTARGET_OPTIONS - -#undef SUBTARGET_OVERRIDE_OPTIONS -#define SUBTARGET_OVERRIDE_OPTIONS {} - /* We use glibc _mcount for profiling. */ -#define NO_PROFILE_COUNTERS 1 -#define PROFILE_HOOK(LABEL) output_profile_hook (LABEL) +#define NO_PROFILE_COUNTERS TARGET_64BIT +#define PROFILE_HOOK(LABEL) \ + do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0) /* We don't need to generate entries in .fixup. */ #undef RELOCATABLE_NEEDS_FIXUP -#define USER_LABEL_PREFIX "" - /* This now supports a natural alignment mode. */ /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, COMPUTED) \ - (TARGET_ALIGN_NATURAL ? (COMPUTED) : \ - (TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ - ? get_inner_array_type (FIELD) \ - : TREE_TYPE (FIELD)) == DFmode \ - ? MIN ((COMPUTED), 32) : (COMPUTED))) + ((TARGET_ALTIVEC && TREE_CODE (TREE_TYPE (FIELD)) == VECTOR_TYPE) \ + ? 128 \ + : (TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (TREE_CODE (TREE_TYPE (FIELD)) == ARRAY_TYPE \ + ? get_inner_array_type (FIELD) \ + : TREE_TYPE (FIELD)) == DFmode) \ + ? MIN ((COMPUTED), 32) \ + : (COMPUTED)) /* AIX increases natural record alignment to doubleword if the first field is an FP double while the FP fields remain word aligned. */ #undef ROUND_TYPE_ALIGN -#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ - ((TREE_CODE (STRUCT) == RECORD_TYPE \ - || TREE_CODE (STRUCT) == UNION_TYPE \ - || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ - && TYPE_FIELDS (STRUCT) != 0 \ - && TARGET_ALIGN_NATURAL == 0 \ - && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode \ - ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ +#define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED) \ + ((TARGET_ALTIVEC && TREE_CODE (STRUCT) == VECTOR_TYPE) \ + ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128) \ + : (TARGET_64BIT \ + && (TREE_CODE (STRUCT) == RECORD_TYPE \ + || TREE_CODE (STRUCT) == UNION_TYPE \ + || TREE_CODE (STRUCT) == QUAL_UNION_TYPE) \ + && TYPE_FIELDS (STRUCT) != 0 \ + && TARGET_ALIGN_NATURAL == 0 \ + && DECL_MODE (TYPE_FIELDS (STRUCT)) == DFmode) \ + ? MAX (MAX ((COMPUTED), (SPECIFIED)), 64) \ : MAX ((COMPUTED), (SPECIFIED))) /* Indicate that jump tables go in the text section. */ #undef JUMP_TABLES_IN_TEXT_SECTION -#define JUMP_TABLES_IN_TEXT_SECTION 1 - -/* 64-bit PowerPC Linux always has GPR13 fixed. */ -#define FIXED_R13 1 +#define JUMP_TABLES_IN_TEXT_SECTION TARGET_64BIT /* __throw will restore its own return address to be the same as the return address of the function that the throw is being made to. This is unfortunate, because we want to check the original return address to see if we need to restore the TOC. So we have to squirrel it away with this. */ -#define SETUP_FRAME_ADDRESSES() rs6000_aix_emit_builtin_unwind_init () +#define SETUP_FRAME_ADDRESSES() \ + do { if (TARGET_64BIT) rs6000_aix_emit_builtin_unwind_init (); } while (0) /* Override svr4.h */ #undef MD_EXEC_PREFIX @@ -165,17 +260,28 @@ #define CPP_SYSV_SPEC "" #undef TARGET_OS_CPP_BUILTINS -#define TARGET_OS_CPP_BUILTINS() \ - do \ - { \ - builtin_define ("__PPC__"); \ - builtin_define ("__PPC64__"); \ - builtin_define ("__powerpc__"); \ - builtin_define ("__powerpc64__"); \ - builtin_define ("__PIC__"); \ - builtin_assert ("cpu=powerpc64"); \ - builtin_assert ("machine=powerpc64"); \ - } \ +#define TARGET_OS_CPP_BUILTINS() \ + do \ + { \ + if (TARGET_64BIT) \ + { \ + builtin_define ("__PPC__"); \ + builtin_define ("__PPC64__"); \ + builtin_define ("__powerpc__"); \ + builtin_define ("__powerpc64__"); \ + builtin_define ("__PIC__"); \ + builtin_assert ("cpu=powerpc64"); \ + builtin_assert ("machine=powerpc64"); \ + } \ + else \ + { \ + builtin_define_std ("PPC"); \ + builtin_define_std ("powerpc"); \ + builtin_assert ("cpu=powerpc"); \ + builtin_assert ("machine=powerpc"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ + } \ + } \ while (0) #undef CPP_OS_DEFAULT_SPEC @@ -205,48 +311,40 @@ #undef LINK_OS_DEFAULT_SPEC #define LINK_OS_DEFAULT_SPEC "%(link_os_linux)" -#undef LINK_OS_LINUX_SPEC -#define LINK_OS_LINUX_SPEC "-m elf64ppc %{!shared: %{!static: \ +#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \ %{rdynamic:-export-dynamic} \ - %{!dynamic-linker:-dynamic-linker /lib64/ld64.so.1}}}" - -#ifdef NATIVE_CROSS -#define STARTFILE_PREFIX_SPEC "/usr/local/lib64/ /lib64/ /usr/lib64/" -#endif + %{!dynamic-linker:-dynamic-linker /lib/ld.so.1}}}" -#undef STARTFILE_LINUX_SPEC -#ifdef HAVE_LD_PIE -#define STARTFILE_LINUX_SPEC "\ -%{!shared: %{pg|p:gcrt1.o%s;pie:Scrt1.o%s;:crt1.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:gcrt1.o%s;:crt1.o%s}} crti.o%s \ -%{static:crtbeginT.o%s;shared|pie:crtbeginS.o%s;:crtbegin.o%s}" -#endif - -#undef ENDFILE_LINUX_SPEC -#define ENDFILE_LINUX_SPEC "\ -%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" +#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \ + %{rdynamic:-export-dynamic} \ + %{!dynamic-linker:-dynamic-linker /lib64/ld64.so.1}}}" #undef TOC_SECTION_ASM_OP -#define TOC_SECTION_ASM_OP "\t.section\t\".toc\",\"aw\"" +#define TOC_SECTION_ASM_OP \ + (TARGET_64BIT \ + ? "\t.section\t\".toc\",\"aw\"" \ + : "\t.section\t\".got\",\"aw\"") #undef MINIMAL_TOC_SECTION_ASM_OP -#define MINIMAL_TOC_SECTION_ASM_OP "\t.section\t\".toc1\",\"aw\"" +#define MINIMAL_TOC_SECTION_ASM_OP \ + (TARGET_64BIT \ + ? "\t.section\t\".toc1\",\"aw\"" \ + : ((TARGET_RELOCATABLE || flag_pic) \ + ? "\t.section\t\".got2\",\"aw\"" \ + : "\t.section\t\".got1\",\"aw\"")) #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (PowerPC64 GNU/Linux)"); /* Must be at least as big as our pointer type. */ -#undef SIZE_TYPE -#define SIZE_TYPE "long unsigned int" +#undef SIZE_TYPE +#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") -#undef PTRDIFF_TYPE -#define PTRDIFF_TYPE "long int" +#undef PTRDIFF_TYPE +#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") -#undef WCHAR_TYPE -#define WCHAR_TYPE "int" +#undef WCHAR_TYPE +#define WCHAR_TYPE (TARGET_64BIT ? "int" : "long int") #undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE 32 @@ -260,51 +358,25 @@ /* PowerPC no-op instruction. */ #undef RS6000_CALL_GLUE -#define RS6000_CALL_GLUE "nop" +#define RS6000_CALL_GLUE (TARGET_64BIT ? "nop" : "cror 31,31,31") #undef RS6000_MCOUNT #define RS6000_MCOUNT "_mcount" /* FP save and restore routines. */ #undef SAVE_FP_PREFIX -#define SAVE_FP_PREFIX "._savef" +#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_") #undef SAVE_FP_SUFFIX -#define SAVE_FP_SUFFIX "" +#define SAVE_FP_SUFFIX (TARGET_64BIT ? "" : "_l") #undef RESTORE_FP_PREFIX -#define RESTORE_FP_PREFIX "._restf" +#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_") #undef RESTORE_FP_SUFFIX -#define RESTORE_FP_SUFFIX "" +#define RESTORE_FP_SUFFIX (TARGET_64BIT ? "" : "_l") /* Dwarf2 debugging. */ #undef PREFERRED_DEBUGGING_TYPE #define PREFERRED_DEBUGGING_TYPE DWARF2_DEBUG -#undef ASM_DECLARE_FUNCTION_NAME -#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do \ - { \ - fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", (FILE)); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - fputs (DOUBLE_INT_ASM_OP, (FILE)); \ - putc ('.', (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fputs (",.TOC.@tocbase,0\n\t.previous\n\t.size\t", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fputs (",24\n\t.type\t.", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - fputs (",@function\n", (FILE)); \ - if (TREE_PUBLIC (DECL) && ! DECL_WEAK (DECL)) \ - { \ - fputs ("\t.globl\t.", (FILE)); \ - assemble_name ((FILE), (NAME)); \ - putc ('\n', (FILE)); \ - } \ - ASM_DECLARE_RESULT ((FILE), DECL_RESULT (DECL)); \ - putc ('.', (FILE)); \ - ASM_OUTPUT_LABEL ((FILE), (NAME)); \ - } \ - while (0) - /* This is how to declare the size of a function. */ #undef ASM_DECLARE_FUNCTION_SIZE #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ @@ -312,9 +384,13 @@ { \ if (!flag_inhibit_size_directive) \ { \ - fputs ("\t.size\t.", (FILE)); \ + fputs ("\t.size\t", (FILE)); \ + if (TARGET_64BIT) \ + putc ('.', (FILE)); \ assemble_name ((FILE), (FNAME)); \ - fputs (",.-.", (FILE)); \ + fputs (",.-", (FILE)); \ + if (TARGET_64BIT) \ + putc ('.', (FILE)); \ assemble_name ((FILE), (FNAME)); \ putc ('\n', (FILE)); \ } \ @@ -341,10 +417,16 @@ || (GET_CODE (X) == CONST_INT \ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \ || (GET_CODE (X) == CONST_DOUBLE \ - && (TARGET_POWERPC64 \ - || TARGET_MINIMAL_TOC \ - || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ - && ! TARGET_NO_FP_IN_TOC))))) + && ((TARGET_64BIT \ + && (TARGET_POWERPC64 \ + || TARGET_MINIMAL_TOC \ + || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ + && ! TARGET_NO_FP_IN_TOC))) \ + || (!TARGET_64BIT \ + && !TARGET_NO_FP_IN_TOC \ + && !TARGET_RELOCATABLE \ + && GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT \ + && BITS_PER_WORD == HOST_BITS_PER_INT))))) /* This is the same as the dbxelf.h version, except that we need to use the function code label, not the function descriptor. */ @@ -357,7 +439,9 @@ do \ ASM_GENERATE_INTERNAL_LABEL (temp, "LM", sym_lineno); \ fprintf (FILE, "\t.stabn 68,0,%d,", LINE); \ assemble_name (FILE, temp); \ - fputs ("-.", FILE); \ + putc ('-', FILE); \ + if (TARGET_64BIT) \ + putc ('.', FILE); \ assemble_name (FILE, \ XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));\ putc ('\n', FILE); \ @@ -378,7 +462,8 @@ while (0) flab = IDENTIFIER_POINTER (current_function_func_begin_label); \ else \ { \ - putc ('.', FILE); \ + if (TARGET_64BIT) \ + putc ('.', FILE); \ flab = XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0); \ } \ assemble_name (FILE, flab); \ @@ -395,19 +480,175 @@ while (0) { \ fprintf (FILE, "%s\"\",%d,0,0,", ASM_STABS_OP, N_FUN); \ assemble_name (FILE, LSCOPE); \ - fputs ("-.", FILE); \ + putc ('-', FILE); \ + if (TARGET_64BIT) \ + putc ('.', FILE); \ assemble_name (FILE, XSTR (XEXP (DECL_RTL (DECL), 0), 0)); \ putc ('\n', FILE); \ } \ while (0) -/* Override sysv4.h as these are ABI_V4 only. */ -#undef ASM_OUTPUT_REG_PUSH -#undef ASM_OUTPUT_REG_POP - /* 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. */ #undef ASM_PREFERRED_EH_DATA_FORMAT #define ASM_PREFERRED_EH_DATA_FORMAT(CODE, GLOBAL) \ - (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | DW_EH_PE_udata8) + ((TARGET_64BIT || flag_pic || TARGET_RELOCATABLE) \ + ? (((GLOBAL) ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel \ + | (TARGET_64BIT ? DW_EH_PE_udata8 : DW_EH_PE_sdata4)) \ + : DW_EH_PE_absptr) + +/* For backward compatibility, we must continue to use the AIX + structure return convention. */ +#undef DRAFT_V4_STRUCT_RET +#define DRAFT_V4_STRUCT_RET (!TARGET_64BIT) + +/* Do code reading to identify a signal frame, and set the frame + state data appropriately. See unwind-dw2.c for the structs. */ + +#ifdef IN_LIBGCC2 +#include <signal.h> +#include <sys/ucontext.h> + +#ifdef __powerpc64__ +enum { SIGNAL_FRAMESIZE = 128 }; +#else +enum { SIGNAL_FRAMESIZE = 64 }; +#endif +#endif + +#ifdef __powerpc64__ + +#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ + do { \ + unsigned char *pc_ = (CONTEXT)->ra; \ + struct sigcontext *sc_; \ + long new_cfa_; \ + int i_; \ + \ + /* addi r1, r1, 128; li r0, 0x0077; sc (sigreturn) */ \ + /* addi r1, r1, 128; li r0, 0x00AC; sc (rt_sigreturn) */ \ + if (*(unsigned int *) (pc_+0) != 0x38210000 + SIGNAL_FRAMESIZE \ + || *(unsigned int *) (pc_+8) != 0x44000002) \ + break; \ + if (*(unsigned int *) (pc_+4) == 0x38000077) \ + { \ + struct sigframe { \ + char gap[SIGNAL_FRAMESIZE]; \ + struct sigcontext sigctx; \ + } *rt_ = (CONTEXT)->cfa; \ + sc_ = &rt_->sigctx; \ + } \ + else if (*(unsigned int *) (pc_+4) == 0x380000AC) \ + { \ + struct rt_sigframe { \ + int tramp[6]; \ + struct siginfo *pinfo; \ + struct ucontext *puc; \ + } *rt_ = (struct rt_sigframe *) pc_; \ + sc_ = &rt_->puc->uc_mcontext; \ + } \ + else \ + break; \ + \ + new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \ + (FS)->cfa_how = CFA_REG_OFFSET; \ + (FS)->cfa_reg = STACK_POINTER_REGNUM; \ + (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ + \ + for (i_ = 0; i_ < 32; i_++) \ + if (i_ != STACK_POINTER_REGNUM) \ + { \ + (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[i_].loc.offset \ + = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \ + } \ + \ + (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ + = (long)&(sc_->regs->link) - new_cfa_; \ + \ + /* The unwinder expects the IP to point to the following insn, \ + whereas the kernel returns the address of the actual \ + faulting insn. We store NIP+4 in an unused register slot to \ + get the same result for multiple evaluation of the same signal \ + frame. */ \ + sc_->regs->gpr[47] = sc_->regs->nip + 4; \ + (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[CR0_REGNO].loc.offset \ + = (long)&(sc_->regs->gpr[47]) - new_cfa_; \ + (FS)->retaddr_column = CR0_REGNO; \ + goto SUCCESS; \ + } while (0) + +#else + +#define MD_FALLBACK_FRAME_STATE_FOR(CONTEXT, FS, SUCCESS) \ + do { \ + unsigned char *pc_ = (CONTEXT)->ra; \ + struct sigcontext *sc_; \ + long new_cfa_; \ + int i_; \ + \ + /* li r0, 0x7777; sc (sigreturn old) */ \ + /* li r0, 0x0077; sc (sigreturn new) */ \ + /* li r0, 0x6666; sc (rt_sigreturn old) */ \ + /* li r0, 0x00AC; sc (rt_sigreturn new) */ \ + if (*(unsigned int *) (pc_+4) != 0x44000002) \ + break; \ + if (*(unsigned int *) (pc_+0) == 0x38007777 \ + || *(unsigned int *) (pc_+0) == 0x38000077) \ + { \ + struct sigframe { \ + char gap[SIGNAL_FRAMESIZE]; \ + struct sigcontext sigctx; \ + } *rt_ = (CONTEXT)->cfa; \ + sc_ = &rt_->sigctx; \ + } \ + else if (*(unsigned int *) (pc_+0) == 0x38006666 \ + || *(unsigned int *) (pc_+0) == 0x380000AC) \ + { \ + struct rt_sigframe { \ + char gap[SIGNAL_FRAMESIZE]; \ + unsigned long _unused[2]; \ + struct siginfo *pinfo; \ + void *puc; \ + struct siginfo info; \ + struct ucontext uc; \ + } *rt_ = (CONTEXT)->cfa; \ + sc_ = &rt_->uc.uc_mcontext; \ + } \ + else \ + break; \ + \ + new_cfa_ = sc_->regs->gpr[STACK_POINTER_REGNUM]; \ + (FS)->cfa_how = CFA_REG_OFFSET; \ + (FS)->cfa_reg = STACK_POINTER_REGNUM; \ + (FS)->cfa_offset = new_cfa_ - (long) (CONTEXT)->cfa; \ + \ + for (i_ = 0; i_ < 32; i_++) \ + if (i_ != STACK_POINTER_REGNUM) \ + { \ + (FS)->regs.reg[i_].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[i_].loc.offset \ + = (long)&(sc_->regs->gpr[i_]) - new_cfa_; \ + } \ + \ + (FS)->regs.reg[LINK_REGISTER_REGNUM].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[LINK_REGISTER_REGNUM].loc.offset \ + = (long)&(sc_->regs->link) - new_cfa_; \ + \ + /* The unwinder expects the IP to point to the following insn, \ + whereas the kernel returns the address of the actual \ + faulting insn. We store NIP+4 in an unused register slot to \ + get the same result for multiple evaluation of the same signal \ + frame. */ \ + sc_->regs->gpr[47] = sc_->regs->nip + 4; \ + (FS)->regs.reg[CR0_REGNO].how = REG_SAVED_OFFSET; \ + (FS)->regs.reg[CR0_REGNO].loc.offset \ + = (long)&(sc_->regs->gpr[47]) - new_cfa_; \ + (FS)->retaddr_column = CR0_REGNO; \ + goto SUCCESS; \ + } while (0) + +#endif diff --git a/gcc/config/rs6000/ppc-asm.h b/gcc/config/rs6000/ppc-asm.h index 2822e18..0553283 100644 --- a/gcc/config/rs6000/ppc-asm.h +++ b/gcc/config/rs6000/ppc-asm.h @@ -95,21 +95,15 @@ * the real function with one or two leading periods respectively. */ -#ifdef _RELOCATABLE -#define DESC_SECTION ".got2" -#else -#define DESC_SECTION ".got1" -#endif - -#if defined(_CALL_AIXDESC) +#if defined (__powerpc64__) #define FUNC_NAME(name) GLUE(.,name) #define JUMP_TARGET(name) FUNC_NAME(name) #define FUNC_START(name) \ - .section DESC_SECTION,"aw"; \ + .section ".opd","aw"; \ name: \ - .long GLUE(.,name); \ - .long _GLOBAL_OFFSET_TABLE_; \ - .long 0; \ + .quad GLUE(.,name); \ + .quad .TOC.@tocbase; \ + .quad 0; \ .previous; \ .type GLUE(.,name),@function; \ .globl name; \ @@ -120,15 +114,22 @@ GLUE(.,name): GLUE(.L,name): \ .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name) -#elif defined (__powerpc64__) +#elif defined(_CALL_AIXDESC) + +#ifdef _RELOCATABLE +#define DESC_SECTION ".got2" +#else +#define DESC_SECTION ".got1" +#endif + #define FUNC_NAME(name) GLUE(.,name) #define JUMP_TARGET(name) FUNC_NAME(name) #define FUNC_START(name) \ - .section ".opd","aw"; \ + .section DESC_SECTION,"aw"; \ name: \ - .quad GLUE(.,name); \ - .quad .TOC.@tocbase; \ - .quad 0; \ + .long GLUE(.,name); \ + .long _GLOBAL_OFFSET_TABLE_; \ + .long 0; \ .previous; \ .type GLUE(.,name),@function; \ .globl name; \ @@ -140,6 +141,7 @@ GLUE(.L,name): \ .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name) #else + #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) #if defined __PIC__ || defined __pic__ #define JUMP_TARGET(name) FUNC_NAME(name@plt) @@ -155,4 +157,3 @@ FUNC_NAME(name): GLUE(.L,name): \ .size FUNC_NAME(name),GLUE(.L,name)-FUNC_NAME(name) #endif - diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index f088a04..75f7d90 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -156,6 +156,8 @@ extern rtx rs6000_function_value (tree, tree); extern rtx rs6000_libcall_value (enum machine_mode); extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree)); extern int function_ok_for_sibcall PARAMS ((tree)); +extern void rs6000_elf_declare_function_name + PARAMS ((FILE *, const char *, tree)); #ifdef ARGS_SIZE_RTX /* expr.h defines ARGS_SIZE_RTX and `enum direction' */ extern enum direction function_arg_padding PARAMS ((enum machine_mode, tree)); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 2b9a761..d37014f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -124,7 +124,7 @@ int rs6000_pic_labelno; #ifdef USING_ELFOS_H /* Which abi to adhere to */ -const char *rs6000_abi_name = RS6000_ABI_NAME; +const char *rs6000_abi_name; /* Semantics of the small data area */ enum rs6000_sdata_type rs6000_sdata = SDATA_DATA; @@ -8661,11 +8661,10 @@ print_operand (file, x, code) break; } } -#if TARGET_AIX - RS6000_OUTPUT_BASENAME (file, XSTR (x, 0)); -#else - assemble_name (file, XSTR (x, 0)); -#endif + if (TARGET_AIX) + RS6000_OUTPUT_BASENAME (file, XSTR (x, 0)); + else + assemble_name (file, XSTR (x, 0)); return; case 'Z': @@ -10566,7 +10565,6 @@ create_TOC_reference (symbol) gen_rtx_SYMBOL_REF (Pmode, toc_label_name)))); } -#if TARGET_AIX /* __throw will restore its own return address to be the same as the return address of the function that the throw is being made to. This is unfortunate, because we want to check the original @@ -10694,7 +10692,6 @@ rs6000_emit_eh_toc_restore (stacksize) emit_note (NULL, NOTE_INSN_LOOP_END); emit_label (loop_exit); } -#endif /* TARGET_AIX */ /* This ties together stack memory (MEM with an alias set of rs6000_sr_alias_set) and the change to the stack pointer. */ @@ -12885,20 +12882,24 @@ output_profile_hook (labelno) if (DEFAULT_ABI == ABI_AIX) { -#ifdef NO_PROFILE_COUNTERS - emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 0); -#else - char buf[30]; - const char *label_name; - rtx fun; +#ifndef NO_PROFILE_COUNTERS +# define NO_PROFILE_COUNTERS 0 +#endif + if (NO_PROFILE_COUNTERS) + emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 0); + else + { + char buf[30]; + const char *label_name; + rtx fun; - ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno); - label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf)); - fun = gen_rtx_SYMBOL_REF (Pmode, label_name); + ASM_GENERATE_INTERNAL_LABEL (buf, "LP", labelno); + label_name = (*targetm.strip_name_encoding) (ggc_strdup (buf)); + fun = gen_rtx_SYMBOL_REF (Pmode, label_name); - emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1, - fun, Pmode); -#endif + emit_library_call (init_one_libfunc (RS6000_MCOUNT), 0, VOIDmode, 1, + fun, Pmode); + } } else if (DEFAULT_ABI == ABI_DARWIN) { @@ -13934,6 +13935,79 @@ rs6000_elf_asm_out_destructor (symbol, priority) else assemble_integer (symbol, POINTER_SIZE / BITS_PER_UNIT, POINTER_SIZE, 1); } + +void +rs6000_elf_declare_function_name (file, name, decl) + FILE *file; + const char *name; + tree decl; +{ + if (TARGET_64BIT) + { + fputs ("\t.section\t\".opd\",\"aw\"\n\t.align 3\n", file); + ASM_OUTPUT_LABEL (file, name); + fputs (DOUBLE_INT_ASM_OP, file); + putc ('.', file); + assemble_name (file, name); + fputs (",.TOC.@tocbase,0\n\t.previous\n\t.size\t", file); + assemble_name (file, name); + fputs (",24\n\t.type\t.", file); + assemble_name (file, name); + fputs (",@function\n", file); + if (TREE_PUBLIC (decl) && ! DECL_WEAK (decl)) + { + fputs ("\t.globl\t.", file); + assemble_name (file, name); + putc ('\n', file); + } + ASM_DECLARE_RESULT (file, DECL_RESULT (decl)); + putc ('.', file); + ASM_OUTPUT_LABEL (file, name); + return; + } + + if (TARGET_RELOCATABLE + && (get_pool_size () != 0 || current_function_profile) + && uses_TOC()) + { + char buf[256]; + + (*targetm.asm_out.internal_label) (file, "LCL", rs6000_pic_labelno); + + ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); + fprintf (file, "\t.long "); + assemble_name (file, buf); + putc ('-', file); + ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); + assemble_name (file, buf); + putc ('\n', file); + } + + ASM_OUTPUT_TYPE_DIRECTIVE (file, name, "function"); + ASM_DECLARE_RESULT (file, DECL_RESULT (decl)); + + if (DEFAULT_ABI == ABI_AIX) + { + const char *desc_name, *orig_name; + + orig_name = (*targetm.strip_name_encoding) (name); + desc_name = orig_name; + while (*desc_name == '.') + desc_name++; + + if (TREE_PUBLIC (decl)) + fprintf (file, "\t.globl %s\n", desc_name); + + fprintf (file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); + fprintf (file, "%s:\n", desc_name); + fprintf (file, "\t.long %s\n", orig_name); + fputs ("\t.long _GLOBAL_OFFSET_TABLE_\n", file); + if (DEFAULT_ABI == ABI_AIX) + fputs ("\t.long 0\n", file); + fprintf (file, "\t.previous\n"); + } + ASM_OUTPUT_LABEL (file, name); +} #endif #if TARGET_XCOFF diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index eb259c7..fc4d2a7 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -14581,9 +14581,8 @@ "" " { -#if TARGET_AIX - rs6000_emit_eh_toc_restore (EH_RETURN_STACKADJ_RTX); -#endif + if (TARGET_AIX) + rs6000_emit_eh_toc_restore (EH_RETURN_STACKADJ_RTX); if (TARGET_32BIT) emit_insn (gen_eh_set_lr_si (operands[0])); else diff --git a/gcc/config/rs6000/sol-ci.asm b/gcc/config/rs6000/sol-ci.asm index b168960..cc97b0a 100644 --- a/gcc/config/rs6000/sol-ci.asm +++ b/gcc/config/rs6000/sol-ci.asm @@ -39,6 +39,7 @@ .file "scrti.s" .ident "GNU C scrti.s" +#ifndef __powerpc64__ # Start of .text .section ".text" .globl _ex_text0 @@ -102,3 +103,4 @@ _fini: stwu %r1,-16(%r1) .space 4 .weak environ .set environ,_environ +#endif diff --git a/gcc/config/rs6000/sol-cn.asm b/gcc/config/rs6000/sol-cn.asm index b1da7d7..673540f 100644 --- a/gcc/config/rs6000/sol-cn.asm +++ b/gcc/config/rs6000/sol-cn.asm @@ -39,6 +39,7 @@ .file "scrtn.s" .ident "GNU C scrtn.s" +#ifndef __powerpc64__ # Default versions of exception handling register/deregister .weak _ex_register .weak _ex_deregister @@ -80,3 +81,4 @@ _ex_range1: mtlr %r0 addi %r1,%r1,16 blr +#endif diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index d91dd3d..57b26e3 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -149,6 +149,10 @@ extern const char *rs6000_tls_size_string; /* For -mtls-size= */ N_("Set the PPC_EMB bit in the ELF flags header") }, \ { "windiss", 0, N_("Use the WindISS simulator") }, \ { "shlib", 0, N_("no description yet") }, \ + { "64", MASK_64BIT | MASK_POWERPC64 | MASK_POWERPC, \ + N_("Generate 64-bit code") }, \ + { "32", - (MASK_64BIT | MASK_POWERPC64), \ + N_("Generate 32-bit code") }, \ EXTRA_SUBTARGET_SWITCHES \ { "newlib", 0, N_("no description yet") }, @@ -172,6 +176,9 @@ do { \ if (!g_switch_set) \ g_switch_value = SDATA_DEFAULT_SIZE; \ \ + if (rs6000_abi_name == NULL) \ + rs6000_abi_name = RS6000_ABI_NAME; \ + \ if (!strcmp (rs6000_abi_name, "sysv")) \ rs6000_current_abi = ABI_V4; \ else if (!strcmp (rs6000_abi_name, "sysv-noeabi")) \ @@ -274,7 +281,7 @@ do { \ rs6000_abi_name); \ } \ \ - if (flag_pic > 1 && rs6000_current_abi == ABI_AIX) \ + if (!TARGET_64BIT && flag_pic > 1 && rs6000_current_abi == ABI_AIX) \ { \ flag_pic = 0; \ error ("-fPIC and -mcall-%s are incompatible", \ @@ -293,9 +300,16 @@ do { \ \ else if (TARGET_RELOCATABLE) \ flag_pic = 2; \ - \ } 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"); \ +} while (0) +#endif /* Override rs6000.h definition. */ #undef TARGET_DEFAULT @@ -590,51 +604,7 @@ extern int rs6000_pic_labelno; /* Override elfos.h definition. */ #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ - do { \ - const char *const init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \ - \ - if (TARGET_RELOCATABLE \ - && (get_pool_size () != 0 || current_function_profile) \ - && uses_TOC()) \ - { \ - char buf[256]; \ - \ - (*targetm.asm_out.internal_label) (FILE, "LCL", rs6000_pic_labelno); \ - \ - ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \ - fprintf (FILE, "\t%s ", init_ptr); \ - assemble_name (FILE, buf); \ - putc ('-', FILE); \ - ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \ - assemble_name (FILE, buf); \ - putc ('\n', FILE); \ - } \ - \ - ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ - ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ - \ - if (DEFAULT_ABI == ABI_AIX) \ - { \ - const char *desc_name, *orig_name; \ - \ - orig_name = (*targetm.strip_name_encoding) (NAME); \ - desc_name = orig_name; \ - while (*desc_name == '.') \ - desc_name++; \ - \ - if (TREE_PUBLIC (DECL)) \ - fprintf (FILE, "\t.globl %s\n", desc_name); \ - \ - fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \ - fprintf (FILE, "%s:\n", desc_name); \ - fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \ - fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \ - if (DEFAULT_ABI == ABI_AIX) \ - fprintf (FILE, "\t%s 0\n", init_ptr); \ - fprintf (FILE, "\t.previous\n"); \ - } \ - ASM_OUTPUT_LABEL (FILE, NAME); \ - } while (0) + rs6000_elf_declare_function_name ((FILE), (NAME), (DECL)) /* The USER_LABEL_PREFIX stuff is affected by the -fleading-underscore flag. The LOCAL_LABEL_PREFIX variable is used by dbxelf.h. */ @@ -789,6 +759,25 @@ extern int fixuplabelno; #define TARGET_VERSION fprintf (stderr, " (PowerPC System V.4)"); #endif +#define TARGET_OS_SYSV_CPP_BUILTINS() \ + do \ + { \ + if (flag_pic == 1) \ + { \ + builtin_define ("__pic__=1"); \ + builtin_define ("__PIC__=1"); \ + } \ + else if (flag_pic == 2) \ + { \ + builtin_define ("__pic__=2"); \ + builtin_define ("__PIC__=2"); \ + } \ + if (target_flags_explicit \ + & MASK_RELOCATABLE) \ + builtin_define ("_RELOCATABLE"); \ + } \ + while (0) + #ifndef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() \ do \ @@ -800,6 +789,7 @@ extern int fixuplabelno; builtin_assert ("system=svr4"); \ builtin_assert ("cpu=powerpc"); \ builtin_assert ("machine=powerpc"); \ + TARGET_OS_SYSV_CPP_BUILTINS (); \ } \ while (0) #endif @@ -945,14 +935,9 @@ extern int fixuplabelno; #define LINK_OS_DEFAULT_SPEC "" -#define CPP_SYSV_SPEC \ -"%{mrelocatable*: -D_RELOCATABLE} \ -%{fpic|fpie: -D__PIC__=1 -D__pic__=1} \ -%{!fpic: %{fPIC|fPIE: -D__PIC__=2 -D__pic__=2}}" - /* Override rs6000.h definition. */ #undef CPP_SPEC -#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} %(cpp_sysv) \ +#define CPP_SPEC "%{posix: -D_POSIX_SOURCE} \ %{mads : %(cpp_os_ads) ; \ myellowknife : %(cpp_os_yellowknife) ; \ mmvme : %(cpp_os_mvme) ; \ @@ -1219,7 +1204,6 @@ ncrtn.o%s" /* Override rs6000.h definition. */ #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ - { "cpp_sysv", CPP_SYSV_SPEC }, \ { "crtsavres_default", CRTSAVRES_DEFAULT_SPEC }, \ { "lib_ads", LIB_ADS_SPEC }, \ { "lib_yellowknife", LIB_YELLOWKNIFE_SPEC }, \ @@ -1288,7 +1272,10 @@ ncrtn.o%s" { "cpp_os_linux", CPP_OS_LINUX_SPEC }, \ { "cpp_os_netbsd", CPP_OS_NETBSD_SPEC }, \ { "cpp_os_windiss", CPP_OS_WINDISS_SPEC }, \ - { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, + { "cpp_os_default", CPP_OS_DEFAULT_SPEC }, \ + SUBSUBTARGET_EXTRA_SPECS + +#define SUBSUBTARGET_EXTRA_SPECS /* Define this macro as a C expression for the initializer of an array of string to tell the driver program which options are diff --git a/gcc/config/rs6000/t-linux64 b/gcc/config/rs6000/t-linux64 index af7b44b..b94975e 100644 --- a/gcc/config/rs6000/t-linux64 +++ b/gcc/config/rs6000/t-linux64 @@ -1,19 +1,32 @@ -# Override t-linux. We don't want -fPIC. -CRTSTUFF_T_CFLAGS_S = -TARGET_LIBGCC2_CFLAGS = +# These functions are needed for soft-float on powerpc64-linux. +LIB2FUNCS_EXTRA = tramp.S $(srcdir)/config/rs6000/ppc64-fp.c -EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o \ - crtsavres.o +# Modify the shared lib version file +SHLIB_MKMAP_OPTS = -v dotsyms=1 -# These functions are needed for soft-float on powerpc64-linux. -LIB2FUNCS_EXTRA = $(srcdir)/config/rs6000/ppc64-fp.c +MULTILIB_OPTIONS = m64/m32 msoft-float +MULTILIB_DIRNAMES = 64 32 nof +MULTILIB_EXTRA_OPTS = fPIC mstrict-align +MULTILIB_EXCEPTIONS = m64/msoft-float +MULTILIB_EXCLUSIONS = m64/!m32/msoft-float +MULTILIB_OSDIRNAMES = ../lib64 ../lib nof +MULTILIB_MATCHES = $(MULTILIB_MATCHES_FLOAT) -# ld provides these functions as needed. -crtsavres.S: - echo >crtsavres.S +TARGET_LIBGCC2_CFLAGS = -mno-minimal-toc -fPIC -$(T)crtsavres.o: crtsavres.S - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -c crtsavres.S -o $(T)crtsavres.o +# We want fine grained libraries, so use the new code to build the +# floating point emulation libraries. +# fp-bit is only to be used by 32-bit multilibs +FPBIT = fp-bit32.c +DPBIT = dp-bit32.c -# Modify the shared lib version file -SHLIB_MKMAP_OPTS = -v dotsyms=1 +dp-bit32.c: $(srcdir)/config/fp-bit.c + ( echo '#ifndef __powerpc64__'; \ + cat $(srcdir)/config/fp-bit.c; \ + echo '#endif' ) > dp-bit32.c + +fp-bit32.c: $(srcdir)/config/fp-bit.c + ( echo '#ifndef __powerpc64__'; \ + echo '#define FLOAT'; \ + cat $(srcdir)/config/fp-bit.c; \ + echo '#endif' ) > fp-bit32.c diff --git a/gcc/config/rs6000/tramp.asm b/gcc/config/rs6000/tramp.asm index c2a38d1..284f938 100644 --- a/gcc/config/rs6000/tramp.asm +++ b/gcc/config/rs6000/tramp.asm @@ -39,6 +39,7 @@ .section ".text" #include "ppc-asm.h" +#ifndef __powerpc64__ .type trampoline_initial,@object .align 2 trampoline_initial: @@ -107,3 +108,4 @@ FUNC_START(__trampoline_setup) bl JUMP_TARGET(abort) FUNC_END(__trampoline_setup) +#endif diff --git a/gcc/config/rs6000/x-linux64 b/gcc/config/rs6000/x-linux64 new file mode 100644 index 0000000..4371ca3 --- /dev/null +++ b/gcc/config/rs6000/x-linux64 @@ -0,0 +1,2 @@ +# parts of gcc need more than a 64k TOC. +X_CFLAGS = -mminimal-toc diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 0322109..858dcd8 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -942,7 +942,7 @@ typedef struct xtensa_args { _mcount uses a window size of 8 to make sure that it doesn't clobber any incoming argument values. */ -#define NO_PROFILE_COUNTERS +#define NO_PROFILE_COUNTERS 1 #define FUNCTION_PROFILER(FILE, LABELNO) \ do { \ |