From dd242e2ec42d23c87c1f50859f12b63b508bd596 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 20 Jan 2017 10:05:52 +0100 Subject: [PATCH] 64-bit powerpc for RTEMS --- gcc/config.gcc | 2 +- gcc/config/rs6000/rtems.h | 64 +++++++++++++++++++++++++++++++++++++++-------- gcc/config/rs6000/sysv4.h | 2 +- gcc/config/rs6000/t-rtems | 5 ++++ 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index 90308cd..228f941 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2381,7 +2381,7 @@ powerpc-*-eabi*) use_gcc_stdint=wrap ;; powerpc-*-rtems*) - tm_file="${tm_file} dbxelf.h elfos.h freebsd-spec.h newlib-stdint.h rs6000/sysv4.h rs6000/eabi.h rs6000/e500.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/eabi.h rs6000/e500.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 54a36de..1278737 100644 --- a/gcc/config/rs6000/rtems.h +++ b/gcc/config/rs6000/rtems.h @@ -21,17 +21,29 @@ /* Specify predefined symbols in preprocessor. */ #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) #undef TARGET_LIBGCC_SDATA_SECTION @@ -58,3 +70,33 @@ #undef SUBSUBTARGET_EXTRA_SPECS #define SUBSUBTARGET_EXTRA_SPECS \ { "cpp_os_rtems", CPP_OS_RTEMS_SPEC } + +#define INVALID_64BIT "-m%s not supported in this configuration" + +#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; \ + rs6000_isa_flags &= ~OPTION_MASK_EABI; \ + if (rs6000_isa_flags & OPTION_MASK_RELOCATABLE) \ + { \ + rs6000_isa_flags &= ~OPTION_MASK_RELOCATABLE; \ + error (INVALID_64BIT, "relocatable"); \ + } \ + 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) diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index a5abeee..fccb1f0 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -533,7 +533,7 @@ extern int fixuplabelno; #define DEFAULT_ASM_ENDIAN " -mbig" #undef ASM_SPEC -#define ASM_SPEC "%(asm_cpu) \ +#define ASM_SPEC "%{!m64:-a32}%{m64:-a64} %(asm_cpu) \ %{,assembler|,assembler-with-cpp: %{mregnames} %{mno-regnames}} \ %{mrelocatable} %{mrelocatable-lib} %{" FPIE_OR_FPIC_SPEC ":-K PIC} \ %{memb|msdata=eabi: -memb}" \ diff --git a/gcc/config/rs6000/t-rtems b/gcc/config/rs6000/t-rtems index 7c7637d..8ff0656 100644 --- a/gcc/config/rs6000/t-rtems +++ b/gcc/config/rs6000/t-rtems @@ -30,6 +30,9 @@ MULTILIB_DIRNAMES += m403 m505 m603e m604 m860 m7400 m8540 me6500 MULTILIB_OPTIONS += m32 MULTILIB_DIRNAMES += m32 +MULTILIB_OPTIONS += m64 +MULTILIB_DIRNAMES += m64 + MULTILIB_OPTIONS += msoft-float/mfloat-gprs=double MULTILIB_DIRNAMES += nof gprsdouble @@ -77,3 +80,5 @@ MULTILIB_REQUIRED += mcpu=8540/mfloat-gprs=double 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 -- 1.8.4.5