On 21/01/17 01:46, Segher Boessenkool wrote:
On Fri, Jan 20, 2017 at 08:35:14AM +0100, Sebastian Huber wrote:
so you seem to have 64-bit ABI_V4? I wonder how well tested that is,
you are likely to run into more problems. Either stack_restore_tie or
the above code will need a tweak.
thanks for your help. I would had a hard time to figure this out myself.
I am flexible in terms of the ABI choice for the 64-bit PowerPC. I guess
the ABI_ELFv2 is the way to go?
It certainly is the most modern ABI. It makes some requirements to what
Power ISA features are required, which may or may not be a problem for
your platform. If you want to use BE, that should work with ELFv2 fine
(and it did in the past at least), but it doesn't get serious testing.
I use now the attached patch and get the following error types (for
several multilibs):
/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/
-isystem
/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/powerpc-rtems4.12/bin/
-B/opt/rtems-4.12/powerpc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/powerpc-rtems4.12/include -isystem
/opt/rtems-4.12/powerpc-rtems4.12/sys-include -g -O2 -mcpu=8540 -O2
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../newlib/libc/sys/rtems/include
-g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I.
-I../../.././gcc -I/home/EB/sebastian_h/archive/gcc-git/libgcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/.
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../gcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../include -DHAVE_CC_TLS
-o ibm-ldouble.o -MT ibm-ldouble.o -MD -MP -MF ibm-ldouble.dep -c
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c
-fvisibility=hidden -DHIDE_EXPORTS
# the right startup files when linking shared libgcc.
/bin/sh /home/EB/sebastian_h/archive/gcc-git/libgcc/../mkinstalldirs
../../.././gcc/m8540
parts="crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o
ecrtn.o ncrti.o ncrtn.o"; \
for file in $parts; do \
rm -f ../../.././gcc/m8540/$file; \
/usr/bin/install -c -m 644 $file ../../.././gcc/m8540/; \
case $file in \
*.a) \
/opt/rtems-4.12/powerpc-rtems4.12/bin/ranlib
../../.././gcc/m8540/$file ;; \
esac; \
done
In file included from
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:374:0:
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/quad.h:72:1: error:
unable to emulate 'TF'
typedef float TFtype __attribute__ ((mode (TF)));
^~~~~~~
config.status: creating auto-target.h
config.status: auto-target.h is unchanged
config.status: executing default commands
In file included from
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/soft-fp.h:321:0,
from
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:372:
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:
In function 'fmsub':
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/op-common.h:900:10:
warning: this statement may fall through [-Wimplicit-fallthrough=]
R##_s = X##_s; \
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/quad.h:182:29: note:
in expansion of macro '_FP_MUL'
# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
^~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:417:5:
note: in expansion of macro 'FP_MUL_Q'
FP_MUL_Q(U,X,Y);
^~~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/op-common.h:902:2:
note: here
case _FP_CLS_COMBINE (FP_CLS_INF, FP_CLS_INF): \
^
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/quad.h:182:29: note:
in expansion of macro '_FP_MUL'
# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
^~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:417:5:
note: in expansion of macro 'FP_MUL_Q'
FP_MUL_Q(U,X,Y);
^~~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/op-common.h:913:10:
warning: this statement may fall through [-Wimplicit-fallthrough=]
R##_s = Y##_s; \
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/quad.h:182:29: note:
in expansion of macro '_FP_MUL'
# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
^~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:417:5:
note: in expansion of macro 'FP_MUL_Q'
FP_MUL_Q(U,X,Y);
^~~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/op-common.h:915:2:
note: here
case _FP_CLS_COMBINE (FP_CLS_NORMAL, FP_CLS_INF): \
^
/home/EB/sebastian_h/archive/gcc-git/libgcc/soft-fp/quad.h:182:29: note:
in expansion of macro '_FP_MUL'
# define FP_MUL_Q(R, X, Y) _FP_MUL (Q, 4, R, X, Y)
^~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/rs6000/ibm-ldouble.c:417:5:
note: in expansion of macro 'FP_MUL_Q'
FP_MUL_Q(U,X,Y);
^~~~~~~~
/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/
-isystem
/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/powerpc-rtems4.12/bin/
-B/opt/rtems-4.12/powerpc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/powerpc-rtems4.12/include -isystem
/opt/rtems-4.12/powerpc-rtems4.12/sys-include -g -O2 -mcpu=e6500 -m64
-msoft-float -mno-altivec -O2
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../newlib/libc/sys/rtems/include
-g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I.
-I../../../../../.././gcc -I/home/EB/sebastian_h/archive/gcc-git/libgcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/.
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../gcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../include -o
unwind-dw2-fde.o -MT unwind-dw2-fde.o -MD -MP -MF unwind-dw2-fde.dep
-fexceptions -c
/home/EB/sebastian_h/archive/gcc-git/libgcc/unwind-dw2-fde.c
-fvisibility=hidden -DHIDE_EXPORTS
/home/EB/sebastian_h/archive/gcc-git/libgcc/unwind-dw2-fde.c: In
function 'search_object':
/home/EB/sebastian_h/archive/gcc-git/libgcc/unwind-dw2-fde.c:588:25:
internal compiler error: in emit_move_insn, at expr.c:3698
v1->array[i1+i2] = v1->array[i1-1];
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
0x6c49bb emit_move_insn(rtx_def*, rtx_def*)
/home/EB/sebastian_h/archive/gcc-git/gcc/expr.c:3697
0x6a5c2b force_reg
/home/EB/sebastian_h/archive/gcc-git/gcc/explow.c:648
0xd61994 rs6000_legitimize_address
/home/EB/sebastian_h/archive/gcc-git/gcc/config/rs6000/rs6000.c:8873
0x6a6a21 memory_address_addr_space(machine_mode, rtx_def*, unsigned char)
/home/EB/sebastian_h/archive/gcc-git/gcc/explow.c:432
0x6bfa0a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/EB/sebastian_h/archive/gcc-git/gcc/expr.c:10040
0x6cdb8c expand_expr
/home/EB/sebastian_h/archive/gcc-git/gcc/expr.h:276
0x6cdb8c expand_assignment(tree_node*, tree_node*, bool)
/home/EB/sebastian_h/archive/gcc-git/gcc/expr.c:5257
0x5b325c expand_gimple_stmt_1
/home/EB/sebastian_h/archive/gcc-git/gcc/cfgexpand.c:3641
0x5b325c expand_gimple_stmt
/home/EB/sebastian_h/archive/gcc-git/gcc/cfgexpand.c:3737
0x5b50b9 expand_gimple_basic_block
/home/EB/sebastian_h/archive/gcc-git/gcc/cfgexpand.c:5744
0x5bab16 execute
/home/EB/sebastian_h/archive/gcc-git/gcc/cfgexpand.c:6357
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/
-isystem
/build/git-build/b-gcc-git-powerpc-rtems4.12/powerpc-rtems4.12/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/powerpc-rtems4.12/bin/
-B/opt/rtems-4.12/powerpc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/powerpc-rtems4.12/include -isystem
/opt/rtems-4.12/powerpc-rtems4.12/sys-include -g -O2 -mcpu=e6500 -m64
-O2
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../newlib/libc/sys/rtems/include
-g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I.
-I../../../.././gcc -I/home/EB/sebastian_h/archive/gcc-git/libgcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/.
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../gcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../include -o emutls.o
-MT emutls.o -MD -MP -MF emutls.dep -fexceptions -c
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c -fvisibility=hidden
-DHIDE_EXPORTS
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c: In function
'__emutls_get_address':
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:159:13: warning:
implicit declaration of function 'calloc' [-Wimplicit-function-declaration]
arr = calloc (size + 1, sizeof (void *));
^~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:159:13: warning:
incompatible implicit declaration of built-in function 'calloc'
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:159:13: note:
include '<stdlib.h>' or provide a declaration of 'calloc'
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:171:13: warning:
implicit declaration of function 'realloc' [-Wimplicit-function-declaration]
arr = realloc (arr, (size + 1) * sizeof (void *));
^~~~~~~
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:171:13: warning:
incompatible implicit declaration of built-in function 'realloc'
/home/EB/sebastian_h/archive/gcc-git/libgcc/emutls.c:171:13: note:
include '<stdlib.h>' or provide a declaration of 'realloc'
/tmp/ccoZ1J0W.s: Assembler messages:
/tmp/ccoZ1J0W.s:125: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccoZ1J0W.s:125: Error: expression too complex
/tmp/ccoZ1J0W.s:133: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
--
/tmp/ccUIJR3G.s:531: Error: expression too complex
/tmp/ccUIJR3G.s:3339: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:3339: Error: expression too complex
/tmp/ccUIJR3G.s:3550: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:3550: Error: expression too complex
/tmp/ccUIJR3G.s:4147: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:4147: Error: expression too complex
/tmp/ccUIJR3G.s:4249: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:4249: Error: expression too complex
/tmp/ccUIJR3G.s:4342: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:4342: Error: expression too complex
/tmp/ccUIJR3G.s:4385: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:4385: Error: expression too complex
/tmp/ccUIJR3G.s:4556: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:4556: Error: expression too complex
/tmp/ccUIJR3G.s:5415: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5415: Error: expression too complex
/tmp/ccUIJR3G.s:5437: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5437: Error: expression too complex
/tmp/ccUIJR3G.s:5656: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5656: Error: expression too complex
/tmp/ccUIJR3G.s:5797: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5797: Error: expression too complex
/tmp/ccUIJR3G.s:5859: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5859: Error: expression too complex
/tmp/ccUIJR3G.s:5918: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:5918: Error: expression too complex
/tmp/ccUIJR3G.s:6041: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6041: Error: expression too complex
/tmp/ccUIJR3G.s:6042: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6042: Error: expression too complex
/tmp/ccUIJR3G.s:6050: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6050: Error: expression too complex
/tmp/ccUIJR3G.s:6363: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6363: Error: expression too complex
/tmp/ccUIJR3G.s:6912: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6912: Error: expression too complex
/tmp/ccUIJR3G.s:6957: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:6957: Error: expression too complex
/tmp/ccUIJR3G.s:7030: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:7030: Error: expression too complex
/tmp/ccUIJR3G.s:7127: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:7127: Error: expression too complex
/tmp/ccUIJR3G.s:7254: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:7254: Error: expression too complex
/tmp/ccUIJR3G.s:7371: Error: can't resolve `.got' {.got section} -
`.LCTOC1' {*UND* section}
/tmp/ccUIJR3G.s:7371: Error: expression too complex
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>From dd242e2ec42d23c87c1f50859f12b63b508bd596 Mon Sep 17 00:00:00 2001
From: Sebastian Huber <sebastian.hu...@embedded-brains.de>
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