summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsh <sh@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-28 07:17:10 +0000
committersh <sh@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-28 07:17:10 +0000
commitf16062f7ed7766a21212f3713b0b46e978b12d0b (patch)
treeb86d7338eca60abf956b9f82f201e11e4777c654
parent3f1099866138431bb973e37fb27a9866ca5082f6 (diff)
downloadgcc-f16062f7ed7766a21212f3713b0b46e978b12d0b.tar.gz
[PowerPC/RTEMS] Add 64-bit support using ELFv2 ABI
Add 64-bit support for RTEMS using the ELFv2 ABI with 64-bit long double. gcc/ * config.gcc (powerpc-*-rtems*): Remove rs6000/eabi.h. Add rs6000/biarch64.h. * config/rs6000/rtems.h (ASM_DECLARE_FUNCTION_SIZE): New macro. (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Likewise. (CRT_CALL_STATIC_FUNCTION): Likewise. (ASM_DEFAULT_SPEC): New define. (ASM_SPEC32): Likewise. (ASM_SPEC64): Likewise. (ASM_SPEC_COMMON): Likewise. (ASM_SPEC): Likewise. (INVALID_64BIT): Likewise. (LINK_OS_DEFAULT_SPEC): Likewise. (LINK_OS_SPEC32): Likewise. (LINK_OS_SPEC64): Likewise. (POWERPC_LINUX): Likewise. (PTRDIFF_TYPE): Likewise. (RESTORE_FP_PREFIX): Likewise. (RESTORE_FP_SUFFIX): Likewise. (SAVE_FP_PREFIX): Likewise. (SAVE_FP_SUFFIX): Likewise. (SIZE_TYPE): Likewise. (SUBSUBTARGET_OVERRIDE_OPTIONS): Likewise. (TARGET_64BIT): Likewise. (TARGET_64BIT): Likewise. (TARGET_AIX): Likewise. (WCHAR_TYPE_SIZE): Likewise. (WCHAR_TYPE): Undefine. (TARGET_OS_CPP_BUILTINS): Add 64-bit PowerPC defines. (CPP_OS_DEFAULT_SPEC): Use previous CPP_OS_RTEMS_SPEC. (CPP_OS_RTEMS_SPEC): Delete. (SUBSUBTARGET_EXTRA_SPECS): Remove cpp_os_rtems. Add asm_spec_common, asm_spec32, asm_spec64, link_os_spec32, and link_os_spec64. * config/rs6000/t-rtems: Add mcpu=e6500/m64 multilibs. libgcc/ * config/rs6000/ibm-ldouble.c: Disable if defined __rtems__. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@250652 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog37
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config/rs6000/rtems.h197
-rw-r--r--gcc/config/rs6000/t-rtems6
-rw-r--r--libgcc/ChangeLog4
-rw-r--r--libgcc/config/rs6000/ibm-ldouble.c3
6 files changed, 229 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b2aec1afa54..6b9a588ec43 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,40 @@
+2017-07-28 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.gcc (powerpc-*-rtems*): Remove rs6000/eabi.h. Add
+ rs6000/biarch64.h.
+ * config/rs6000/rtems.h (ASM_DECLARE_FUNCTION_SIZE): New macro.
+ (ASM_OUTPUT_SPECIAL_POOL_ENTRY_P): Likewise.
+ (CRT_CALL_STATIC_FUNCTION): Likewise.
+ (ASM_DEFAULT_SPEC): New define.
+ (ASM_SPEC32): Likewise.
+ (ASM_SPEC64): Likewise.
+ (ASM_SPEC_COMMON): Likewise.
+ (ASM_SPEC): Likewise.
+ (INVALID_64BIT): Likewise.
+ (LINK_OS_DEFAULT_SPEC): Likewise.
+ (LINK_OS_SPEC32): Likewise.
+ (LINK_OS_SPEC64): Likewise.
+ (POWERPC_LINUX): Likewise.
+ (PTRDIFF_TYPE): Likewise.
+ (RESTORE_FP_PREFIX): Likewise.
+ (RESTORE_FP_SUFFIX): Likewise.
+ (SAVE_FP_PREFIX): Likewise.
+ (SAVE_FP_SUFFIX): Likewise.
+ (SIZE_TYPE): Likewise.
+ (SUBSUBTARGET_OVERRIDE_OPTIONS): Likewise.
+ (TARGET_64BIT): Likewise.
+ (TARGET_64BIT): Likewise.
+ (TARGET_AIX): Likewise.
+ (WCHAR_TYPE_SIZE): Likewise.
+ (WCHAR_TYPE): Undefine.
+ (TARGET_OS_CPP_BUILTINS): Add 64-bit PowerPC defines.
+ (CPP_OS_DEFAULT_SPEC): Use previous CPP_OS_RTEMS_SPEC.
+ (CPP_OS_RTEMS_SPEC): Delete.
+ (SUBSUBTARGET_EXTRA_SPECS): Remove cpp_os_rtems. Add
+ asm_spec_common, asm_spec32, asm_spec64, link_os_spec32, and
+ link_os_spec64.
+ * config/rs6000/t-rtems: Add mcpu=e6500/m64 multilibs.
+
2017-07-28 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/81578
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 0224339cfb5..f28164646c3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -2429,7 +2429,7 @@ powerpc-*-rtems*spe*)
tmake_file="${tmake_file} powerpcspe/t-fprules powerpcspe/t-rtems powerpcspe/t-ppccomm"
;;
powerpc-*-rtems*)
- tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/rtems.h rtems.h"
+ tm_file="rs6000/biarch64.h ${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/rtems.h rtems.h"
extra_options="${extra_options} rs6000/sysv4.opt"
tmake_file="${tmake_file} rs6000/t-fprules rs6000/t-rtems rs6000/t-ppccomm"
;;
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index 1ab4e313fdb..8a62fdcbaf3 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -23,29 +23,163 @@
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
-/* Specify predefined symbols in preprocessor. */
+/* Copy and paste from linux64.h and freebsd64.h */
+#ifdef IN_LIBGCC2
+#undef TARGET_64BIT
+#ifdef __powerpc64__
+#define TARGET_64BIT 1
+#else
+#define TARGET_64BIT 0
+#endif
+#endif
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef TARGET_AIX
+#define TARGET_AIX TARGET_64BIT
#undef TARGET_OS_CPP_BUILTINS
-#define TARGET_OS_CPP_BUILTINS() \
- do \
- { \
- builtin_define_std ("PPC"); \
- builtin_define ("__rtems__"); \
- builtin_define ("__USE_INIT_FINI__"); \
- builtin_assert ("system=rtems"); \
- builtin_assert ("cpu=powerpc"); \
- builtin_assert ("machine=powerpc"); \
- TARGET_OS_SYSV_CPP_BUILTINS (); \
- } \
+#define TARGET_OS_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__rtems__"); \
+ builtin_define ("__USE_INIT_FINI__"); \
+ builtin_assert ("system=rtems"); \
+ if (TARGET_64BIT) \
+ { \
+ builtin_define ("__PPC__"); \
+ builtin_define ("__PPC64__"); \
+ builtin_define ("__powerpc64__"); \
+ 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)
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#define INVALID_64BIT "-m%s not supported in this configuration"
+
+/* A lot of copy and paste from linux64.h and freebsd64.h */
+#undef SUBSUBTARGET_OVERRIDE_OPTIONS
+#define SUBSUBTARGET_OVERRIDE_OPTIONS \
+ do \
+ { \
+ if (rs6000_isa_flags & OPTION_MASK_64BIT) \
+ { \
+ rs6000_elf_abi = 2; \
+ rs6000_current_abi = ABI_ELFv2; \
+ if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \
+ { \
+ rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \
+ error (INVALID_64BIT, "relocatable"); \
+ } \
+ if (rs6000_isa_flags & OPTION_MASK_EABI) \
+ { \
+ rs6000_isa_flags &= ~OPTION_MASK_EABI; \
+ error (INVALID_64BIT, "eabi"); \
+ } \
+ if (TARGET_PROTOTYPE) \
+ { \
+ target_prototype = 0; \
+ error (INVALID_64BIT, "prototype"); \
+ } \
+ if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) == 0) \
+ { \
+ rs6000_isa_flags |= OPTION_MASK_POWERPC64; \
+ error ("-m64 requires a PowerPC64 cpu"); \
+ } \
+ } \
+ } \
while (0)
#undef TARGET_LIBGCC_SDATA_SECTION
#define TARGET_LIBGCC_SDATA_SECTION ".sdata"
-#undef CPP_OS_DEFAULT_SPEC
-#define CPP_OS_DEFAULT_SPEC "%(cpp_os_rtems)"
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef SIZE_TYPE
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
+
+/* Copy and paste from freebsd64.h */
+#undef WCHAR_TYPE
+
+/* Copy and paste from freebsd64.h */
+#undef WCHAR_TYPE_SIZE
+#define WCHAR_TYPE_SIZE 32
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#ifdef __powerpc64__
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n" \
+" bl " #FUNC "\n" \
+" nop\n" \
+" .previous");
+#endif
+
+/* This could be also POWERPC_FREEBSD. It is related to the save/restore
+ defines below. */
+#define POWERPC_LINUX
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef SAVE_FP_PREFIX
+#define SAVE_FP_PREFIX (TARGET_64BIT ? "._savef" : "_savefpr_")
+#undef SAVE_FP_SUFFIX
+#define SAVE_FP_SUFFIX ""
+#undef RESTORE_FP_PREFIX
+#define RESTORE_FP_PREFIX (TARGET_64BIT ? "._restf" : "_restfpr_")
+#undef RESTORE_FP_SUFFIX
+#define RESTORE_FP_SUFFIX ""
-#define CPP_OS_RTEMS_SPEC "\
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef ASM_DECLARE_FUNCTION_SIZE
+#define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \
+ do \
+ { \
+ if (!flag_inhibit_size_directive) \
+ { \
+ fputs ("\t.size\t", (FILE)); \
+ if (TARGET_64BIT && DOT_SYMBOLS) \
+ putc ('.', (FILE)); \
+ assemble_name ((FILE), (FNAME)); \
+ fputs (",.-", (FILE)); \
+ rs6000_output_function_entry (FILE, FNAME); \
+ putc ('\n', (FILE)); \
+ } \
+ } \
+ while (0)
+
+/* Copy and paste from linux64.h and freebsd64.h */
+#undef ASM_OUTPUT_SPECIAL_POOL_ENTRY_P
+#define ASM_OUTPUT_SPECIAL_POOL_ENTRY_P(X, MODE) \
+ (TARGET_TOC \
+ && (GET_CODE (X) == SYMBOL_REF \
+ || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS \
+ && GET_CODE (XEXP (XEXP (X, 0), 0)) == SYMBOL_REF) \
+ || GET_CODE (X) == LABEL_REF \
+ || (GET_CODE (X) == CONST_INT \
+ && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode)) \
+ || (GET_CODE (X) == CONST_DOUBLE \
+ && ((TARGET_64BIT \
+ && (TARGET_MINIMAL_TOC \
+ || (SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
+ && ! TARGET_NO_FP_IN_TOC))) \
+ || (!TARGET_64BIT \
+ && !TARGET_NO_FP_IN_TOC \
+ && SCALAR_FLOAT_MODE_P (GET_MODE (X)) \
+ && BITS_PER_WORD == HOST_BITS_PER_INT)))))
+
+#undef CPP_OS_DEFAULT_SPEC
+#define CPP_OS_DEFAULT_SPEC "\
%{!mcpu*: %{!Dppc*: %{!Dmpc*: -Dmpc750} } }\
%{mcpu=403: %{!Dppc*: %{!Dmpc*: -Dppc403} } } \
%{mcpu=505: %{!Dppc*: %{!Dmpc*: -Dmpc505} } } \
@@ -60,6 +194,37 @@
%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540} } } \
%{mcpu=e6500: -D__PPC_CPU_E6500__}"
+#undef ASM_DEFAULT_SPEC
+#define ASM_DEFAULT_SPEC "-mppc%{m64:64}"
+
+#undef ASM_SPEC
+#define ASM_SPEC "%{!m64:%(asm_spec32)}%{m64:%(asm_spec64)} %(asm_spec_common)"
+
+#define ASM_SPEC32 "-a32 \
+%{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \
+%{memb|msdata=eabi: -memb}"
+
+#define ASM_SPEC64 "-a64"
+
+#define ASM_SPEC_COMMON "%(asm_cpu) \
+%{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}}" \
+ ENDIAN_SELECT(" -mbig", " -mlittle", DEFAULT_ASM_ENDIAN)
+
+#undef LINK_OS_DEFAULT_SPEC
+#define LINK_OS_DEFAULT_SPEC \
+"%{!m64:%(link_os_spec32)}%{m64:%(link_os_spec64)}"
+
+#define LINK_OS_SPEC32 ENDIAN_SELECT(" -m elf32ppc", \
+ " -m elf32lppc", \
+ " -m elf32ppc")
+#define LINK_OS_SPEC64 ENDIAN_SELECT(" -m elf64ppc", \
+ " -m elf64lppc", \
+ " -m elf64ppc")
+
#undef SUBSUBTARGET_EXTRA_SPECS
#define SUBSUBTARGET_EXTRA_SPECS \
- { "cpp_os_rtems", CPP_OS_RTEMS_SPEC }
+ { "asm_spec_common", ASM_SPEC_COMMON }, \
+ { "asm_spec32", ASM_SPEC32 }, \
+ { "asm_spec64", ASM_SPEC64 }, \
+ { "link_os_spec32", LINK_OS_SPEC32 }, \
+ { "link_os_spec64", LINK_OS_SPEC64 },
diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems
index 8290f5c5bdd..0e39c6320c8 100644
--- a/gcc/config/rs6000/t-rtems
+++ b/gcc/config/rs6000/t-rtems
@@ -27,8 +27,8 @@ MULTILIB_REQUIRED =
MULTILIB_OPTIONS += mcpu=403/mcpu=505/mcpu=603e/mcpu=604/mcpu=860/mcpu=7400/mcpu=8540/mcpu=e6500
MULTILIB_DIRNAMES += m403 m505 m603e m604 m860 m7400 m8540 me6500
-MULTILIB_OPTIONS += m32
-MULTILIB_DIRNAMES += m32
+MULTILIB_OPTIONS += m32/m64
+MULTILIB_DIRNAMES += m32 m64
MULTILIB_OPTIONS += msoft-float
MULTILIB_DIRNAMES += nof
@@ -72,3 +72,5 @@ MULTILIB_REQUIRED += mcpu=8540/msoft-float
MULTILIB_REQUIRED += mcpu=860
MULTILIB_REQUIRED += mcpu=e6500/m32
MULTILIB_REQUIRED += mcpu=e6500/m32/msoft-float/mno-altivec
+MULTILIB_REQUIRED += mcpu=e6500/m64
+MULTILIB_REQUIRED += mcpu=e6500/m64/msoft-float/mno-altivec
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index cb25039b1a7..fc7b878d95c 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,7 @@
+2017-07-28 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config/rs6000/ibm-ldouble.c: Disable if defined __rtems__.
+
2017-07-24 Daniel Santos <daniel.santos@pobox.com>
PR testsuite/80759
diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
index 949b50c98ca..e99652e523f 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -45,7 +45,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
This code currently assumes the most significant double is in
the lower numbered register or lower addressed memory. */
-#if defined (__MACH__) || defined (__powerpc__) || defined (_AIX)
+#if (defined (__MACH__) || defined (__powerpc__) || defined (_AIX)) \
+ && !defined (__rtems__)
#define fabs(x) __builtin_fabs(x)
#define isless(x, y) __builtin_isless (x, y)