summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--contrib/binutils/bfd/elf64-ppc.c14
-rw-r--r--contrib/binutils/ld/lexsup.c3
-rw-r--r--contrib/gcc/config/rs6000/freebsd.h182
-rw-r--r--contrib/gdb/gdb/ppcfbsd-tdep.c19
-rw-r--r--contrib/gdb/gdb/solib-svr4.c1
-rw-r--r--gnu/lib/csu/Makefile2
-rw-r--r--gnu/lib/libgcc/Makefile5
-rw-r--r--gnu/usr.bin/binutils/as/Makefile2
-rw-r--r--gnu/usr.bin/binutils/as/powerpc64-freebsd/itbl-cpu.h6
-rw-r--r--gnu/usr.bin/binutils/as/powerpc64-freebsd/targ-cpu.h3
-rw-r--r--gnu/usr.bin/binutils/gdb/Makefile2
-rw-r--r--gnu/usr.bin/binutils/gdb/Makefile.powerpc645
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.powerpc6429
-rw-r--r--gnu/usr.bin/binutils/libbfd/Makefile2
-rw-r--r--gnu/usr.bin/binutils/libbfd/Makefile.powerpc6427
-rw-r--r--gnu/usr.bin/binutils/libopcodes/Makefile.powerpc644
-rw-r--r--gnu/usr.bin/cc/Makefile.tgt6
-rw-r--r--gnu/usr.bin/cc/cc_tools/Makefile18
-rw-r--r--gnu/usr.bin/cc/include/Makefile2
-rw-r--r--gnu/usr.bin/gdb/arch/powerpc64/Makefile14
-rw-r--r--gnu/usr.bin/gdb/arch/powerpc64/config.h553
-rw-r--r--gnu/usr.bin/gdb/arch/powerpc64/init.c230
-rw-r--r--gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c192
23 files changed, 1298 insertions, 23 deletions
diff --git a/contrib/binutils/bfd/elf64-ppc.c b/contrib/binutils/bfd/elf64-ppc.c
index a0d81d0..bc9e0a7 100644
--- a/contrib/binutils/bfd/elf64-ppc.c
+++ b/contrib/binutils/bfd/elf64-ppc.c
@@ -3268,13 +3268,13 @@ create_got_section (bfd *abfd, struct bfd_link_info *info)
flags = (SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS | SEC_IN_MEMORY
| SEC_LINKER_CREATED);
- got = bfd_make_section (abfd, ".got");
+ got = bfd_make_section_anyway (abfd, ".got");
if (!got
|| !bfd_set_section_flags (abfd, got, flags)
|| !bfd_set_section_alignment (abfd, got, 3))
return FALSE;
- relgot = bfd_make_section (abfd, ".rela.got");
+ relgot = bfd_make_section_anyway (abfd, ".rela.got");
if (!relgot
|| ! bfd_set_section_flags (abfd, relgot, flags | SEC_READONLY)
|| ! bfd_set_section_alignment (abfd, relgot, 3))
@@ -6033,6 +6033,10 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
{
+ /* Skip this BFD if it is not ELF */
+ if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
+ continue;
+
s = ppc64_elf_tdata (ibfd)->got;
if (s != NULL && s != htab->got)
{
@@ -7206,7 +7210,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_stub_syms,
stub_sec->_cooked_size = 0;
}
- if (htab->plt != NULL)
+ if (htab->glink != NULL && htab->glink->contents != NULL)
{
unsigned int indx;
bfd_vma plt0;
@@ -9000,6 +9004,10 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
while ((dynobj = dynobj->link_next) != NULL)
{
asection *s;
+
+ if (bfd_get_flavour (dynobj) != bfd_target_elf_flavour)
+ continue;
+
s = ppc64_elf_tdata (dynobj)->got;
if (s != NULL
&& s->_raw_size != 0
diff --git a/contrib/binutils/ld/lexsup.c b/contrib/binutils/ld/lexsup.c
index b377bd4..ea3a558 100644
--- a/contrib/binutils/ld/lexsup.c
+++ b/contrib/binutils/ld/lexsup.c
@@ -1145,8 +1145,11 @@ parse_args (unsigned argc, char **argv)
whole_archive = TRUE;
break;
case OPTION_AS_NEEDED:
+/* XXX: --as-needed is broken on powerpc64 */
+#ifndef __powerpc64__
as_needed = TRUE;
break;
+#endif
case OPTION_NO_AS_NEEDED:
as_needed = FALSE;
break;
diff --git a/contrib/gcc/config/rs6000/freebsd.h b/contrib/gcc/config/rs6000/freebsd.h
index 1fb4b25..2ce115d 100644
--- a/contrib/gcc/config/rs6000/freebsd.h
+++ b/contrib/gcc/config/rs6000/freebsd.h
@@ -21,13 +21,86 @@
/* Override the defaults, which exist to force the proper definition. */
-#undef CPP_OS_DEFAULT_SPEC
-#define CPP_OS_DEFAULT_SPEC "%(cpp_os_freebsd)"
+#ifdef IN_LIBGCC2
+#undef TARGET_64BIT
+#ifdef __powerpc64__
+#define TARGET_64BIT 1
+#else
+#define TARGET_64BIT 0
+#endif
+#endif
+
+/* On 64-bit systems, use the AIX ABI like Linux and NetBSD */
+
+#undef DEFAULT_ABI
+#define DEFAULT_ABI (TARGET_64BIT ? ABI_AIX : ABI_V4)
+#undef TARGET_AIX
+#define TARGET_AIX TARGET_64BIT
+
+#undef FBSD_TARGET_CPU_CPP_BUILTINS
+#define FBSD_TARGET_CPU_CPP_BUILTINS() \
+ do \
+ { \
+ builtin_define ("__PPC__"); \
+ builtin_define ("__ppc__"); \
+ builtin_define ("__PowerPC__"); \
+ builtin_define ("__powerpc__"); \
+ if (TARGET_64BIT) \
+ { \
+ builtin_define ("__LP64__"); \
+ builtin_define ("__ppc64__"); \
+ builtin_define ("__powerpc64__"); \
+ builtin_define ("__arch64__"); \
+ builtin_assert ("cpu=powerpc64"); \
+ builtin_assert ("machine=powerpc64"); \
+ } else { \
+ builtin_assert ("cpu=powerpc"); \
+ builtin_assert ("machine=powerpc"); \
+ } \
+ } \
+ while (0)
+
+#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 (!rs6000_explicit_options.alignment) \
+ rs6000_alignment_flags = MASK_ALIGN_NATURAL; \
+ if (TARGET_64BIT) \
+ { \
+ if (DEFAULT_ABI != ABI_AIX) \
+ { \
+ rs6000_current_abi = ABI_AIX; \
+ error (INVALID_64BIT, "call"); \
+ } \
+ dot_symbols = !strcmp (rs6000_abi_name, "aixdesc"); \
+ if (target_flags & MASK_RELOCATABLE) \
+ { \
+ target_flags &= ~MASK_RELOCATABLE; \
+ error (INVALID_64BIT, "relocatable"); \
+ } \
+ if (target_flags & MASK_EABI) \
+ { \
+ target_flags &= ~MASK_EABI; \
+ error (INVALID_64BIT, "eabi"); \
+ } \
+ if (target_flags & MASK_PROTOTYPE) \
+ { \
+ target_flags &= ~MASK_PROTOTYPE; \
+ error (INVALID_64BIT, "prototype"); \
+ } \
+ if ((target_flags & MASK_POWERPC64) == 0) \
+ { \
+ target_flags |= MASK_POWERPC64; \
+ error ("64 bit CPU required"); \
+ } \
+ } \
+ } \
+ while (0)
-#undef CPP_OS_FREEBSD_SPEC
-#define CPP_OS_FREEBSD_SPEC "\
- -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
- -Acpu=powerpc -Amachine=powerpc "
#undef STARTFILE_DEFAULT_SPEC
#define STARTFILE_DEFAULT_SPEC "%(startfile_freebsd)"
@@ -57,7 +130,10 @@
c-common.c, and config/<arch>/<arch>.h. */
#undef SIZE_TYPE
-#define SIZE_TYPE "unsigned int"
+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
+
+#undef PTRDIFF_TYPE
+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
/* rs6000.h gets this wrong for FreeBSD. We use the GCC defaults instead. */
#undef WCHAR_TYPE
@@ -75,3 +151,95 @@
/* Override rs6000.h definition. */
#undef ASM_APP_OFF
#define ASM_APP_OFF "#NO_APP\n"
+
+/* Tell the assembler we want 32/64-bit binaries if -m32 or -m64 is passed */
+#if (TARGET_DEFAULT & MASK_64BIT)
+#define SVR4_ASM_SPEC "%(asm_cpu) \
+%{.s: %{mregnames} %{mno-regnames}} %{.S: %{mregnames} %{mno-regnames}} \
+%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*} \
+%{mrelocatable} %{mrelocatable-lib} %{fpic|fpie|fPIC|fPIE:-K PIC} \
+%{memb|msdata|msdata=eabi: -memb} \
+%{mlittle|mlittle-endian:-mlittle; \
+ mbig|mbig-endian :-mbig; \
+ mcall-aixdesc | \
+ mcall-freebsd | \
+ mcall-netbsd | \
+ mcall-openbsd | \
+ mcall-linux | \
+ mcall-gnu :-mbig; \
+ mcall-i960-old :-mlittle}"
+#define LINK_OS_FREEBSD_SPEC_DEF "\
+ %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
+ %{v:-V} \
+ %{assert*} %{R*} %{rpath*} %{defsym*} \
+ %{shared:-Bshareable %{h*} %{soname*}} \
+ %{!shared: \
+ %{!static: \
+ %{rdynamic: -export-dynamic} \
+ %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
+ %{static:-Bstatic}} \
+ %{symbolic:-Bsymbolic}"
+
+
+#undef ASM_DEFAULT_SPEC
+#undef ASM_SPEC
+#undef LINK_OS_FREEBSD_SPEC
+#define ASM_DEFAULT_SPEC "-mppc%{!m32:64}"
+#define ASM_SPEC "%{m32:-a32}%{!m32:-a64} " SVR4_ASM_SPEC
+#define LINK_OS_FREEBSD_SPEC "%{m32:-melf32ppc}%{!m32:-melf64ppc} " LINK_OS_FREEBSD_SPEC_DEF
+#endif
+
+/* _init and _fini functions are built from bits spread across many
+ object files, each potentially with a different TOC pointer. For
+ that reason, place a nop after the call so that the linker can
+ restore the TOC pointer if a TOC adjusting call stub is needed. */
+#ifdef __powerpc64__
+#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \
+ asm (SECTION_OP "\n" \
+" bl ." #FUNC "\n" \
+" nop\n" \
+" .previous");
+#endif
+
+/* __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() \
+ do { if (TARGET_64BIT) rs6000_aix_emit_builtin_unwind_init (); } while (0)
+
+/* 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) \
+ ((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)
+
+#define MD_FROB_UPDATE_CONTEXT(CTX, FS) \
+ if (TARGET_64BIT) { \
+ if ((FS)->regs.reg[2].how == REG_UNSAVED) \
+ { \
+ unsigned int *insn \
+ = (unsigned int *) \
+ _Unwind_GetGR ((CTX), LINK_REGISTER_REGNUM); \
+ if (*insn == 0xE8410028) \
+ _Unwind_SetGRPtr ((CTX), 2, (CTX)->cfa + 40); \
+ } \
+ }
+
+/* FreeBSD doesn't support saving and restoring 64-bit regs with a 32-bit
+ kernel. This is supported when running on a 64-bit kernel with
+ COMPAT_FREEBSD32, but tell GCC it isn't so that our 32-bit binaries
+ are compatible. */
+#define OS_MISSING_POWERPC64 !TARGET_64BIT
+
+/* Function profiling bits */
+#undef RS6000_MCOUNT
+#define RS6000_MCOUNT ((TARGET_64BIT) ? "._mcount" : "_mcount")
+#define PROFILE_HOOK(LABEL) \
+ do { if (TARGET_64BIT) output_profile_hook (LABEL); } while (0)
+
diff --git a/contrib/gdb/gdb/ppcfbsd-tdep.c b/contrib/gdb/gdb/ppcfbsd-tdep.c
index 296be18..3828e7f 100644
--- a/contrib/gdb/gdb/ppcfbsd-tdep.c
+++ b/contrib/gdb/gdb/ppcfbsd-tdep.c
@@ -35,13 +35,13 @@
#include "gdb_assert.h"
#include "solib-svr4.h"
-#define REG_FIXREG_OFFSET(x) ((x) * 4)
-#define REG_LR_OFFSET (32 * 4)
-#define REG_CR_OFFSET (33 * 4)
-#define REG_XER_OFFSET (34 * 4)
-#define REG_CTR_OFFSET (35 * 4)
-#define REG_PC_OFFSET (36 * 4)
-#define SIZEOF_STRUCT_REG (37 * 4)
+#define REG_FIXREG_OFFSET(x) ((x) * sizeof(register_t))
+#define REG_LR_OFFSET (32 * sizeof(register_t))
+#define REG_CR_OFFSET (33 * sizeof(register_t))
+#define REG_XER_OFFSET (34 * sizeof(register_t))
+#define REG_CTR_OFFSET (35 * sizeof(register_t))
+#define REG_PC_OFFSET (36 * sizeof(register_t))
+#define SIZEOF_STRUCT_REG (37 * sizeof(register_t))
#define FPREG_FPR_OFFSET(x) ((x) * 8)
#define FPREG_FPSCR_OFFSET (32 * 8)
@@ -274,8 +274,13 @@ ppcfbsd_init_abi (struct gdbarch_info info,
/* For NetBSD, this is an on again, off again thing. Some systems
do use the broken struct convention, and some don't. */
set_gdbarch_return_value (gdbarch, ppcfbsd_return_value);
+#ifdef __powerpc64__
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ svr4_lp64_fetch_link_map_offsets);
+#else
set_solib_svr4_fetch_link_map_offsets (gdbarch,
svr4_ilp32_fetch_link_map_offsets);
+#endif
}
void
diff --git a/contrib/gdb/gdb/solib-svr4.c b/contrib/gdb/gdb/solib-svr4.c
index 4f4664c..afea156 100644
--- a/contrib/gdb/gdb/solib-svr4.c
+++ b/contrib/gdb/gdb/solib-svr4.c
@@ -94,6 +94,7 @@ static char *solib_break_names[] =
into the data section (thus skipping the descriptor's symbol),
and eventually try this one, giving us the real entry point
address. */
+ ".r_debug_state",
"._dl_debug_state",
NULL
diff --git a/gnu/lib/csu/Makefile b/gnu/lib/csu/Makefile
index 306ced5..b7dcb60 100644
--- a/gnu/lib/csu/Makefile
+++ b/gnu/lib/csu/Makefile
@@ -31,7 +31,7 @@ CFLAGS+= -x assembler-with-cpp # Ugly hack
CFLAGS+= -include osreldate.h
.undef SRCS # hack for 'make depend'
.endif
-.if ${MACHINE_ARCH} == "powerpc"
+.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64"
TGTOBJS= crtsavres.o
SRCS+= crtsavres.asm
.endif
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile
index b54e0bd..b3480dc 100644
--- a/gnu/lib/libgcc/Makefile
+++ b/gnu/lib/libgcc/Makefile
@@ -143,6 +143,11 @@ LIB2FUNCS_EXTRA = tramp.asm
LIB2FUNCS_STATIC_EXTRA = eabi.asm
.endif
+.if ${TARGET_ARCH} == "powerpc64"
+# from config/rs6000/t-ppccomm
+LIB2FUNCS_EXTRA = tramp.asm
+.endif
+
.if ${TARGET_ARCH} == "sparc64"
# from config/sparc/t-elf
LIB1ASMSRC = lb1spc.asm
diff --git a/gnu/usr.bin/binutils/as/Makefile b/gnu/usr.bin/binutils/as/Makefile
index cd37311..72cbd53 100644
--- a/gnu/usr.bin/binutils/as/Makefile
+++ b/gnu/usr.bin/binutils/as/Makefile
@@ -26,7 +26,7 @@ SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l
.if ${TARGET_ARCH} == "amd64"
SRCS+= tc-i386.c
-.elif ${TARGET_ARCH} == "powerpc"
+.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
SRCS+= tc-ppc.c
.elif ${TARGET_ARCH} == "sparc64"
# change back to tc-sparc.c when new binutils is imported
diff --git a/gnu/usr.bin/binutils/as/powerpc64-freebsd/itbl-cpu.h b/gnu/usr.bin/binutils/as/powerpc64-freebsd/itbl-cpu.h
new file mode 100644
index 0000000..b55da9a
--- /dev/null
+++ b/gnu/usr.bin/binutils/as/powerpc64-freebsd/itbl-cpu.h
@@ -0,0 +1,6 @@
+/* $FreeBSD$ */
+
+/* Values for processors will be from 0 to NUMBER_OF_PROCESSORS-1 */
+#define NUMBER_OF_PROCESSORS 1
+
+#include "itbl-ppc.h"
diff --git a/gnu/usr.bin/binutils/as/powerpc64-freebsd/targ-cpu.h b/gnu/usr.bin/binutils/as/powerpc64-freebsd/targ-cpu.h
new file mode 100644
index 0000000..891bd6c
--- /dev/null
+++ b/gnu/usr.bin/binutils/as/powerpc64-freebsd/targ-cpu.h
@@ -0,0 +1,3 @@
+/* $FreeBSD$ */
+
+#include "tc-ppc.h"
diff --git a/gnu/usr.bin/binutils/gdb/Makefile b/gnu/usr.bin/binutils/gdb/Makefile
index ecf8cce..6e52616 100644
--- a/gnu/usr.bin/binutils/gdb/Makefile
+++ b/gnu/usr.bin/binutils/gdb/Makefile
@@ -12,6 +12,8 @@ GDBDIR= ${.CURDIR}/../../../../contrib/gdb
GDB_CPU= sparc
.elif ${TARGET_ARCH} == "amd64"
GDB_CPU= i386
+.elif ${TARGET_ARCH} == "powerpc64"
+GDB_CPU= powerpc
.else
GDB_CPU= ${TARGET_ARCH}
.endif
diff --git a/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 b/gnu/usr.bin/binutils/gdb/Makefile.powerpc64
new file mode 100644
index 0000000..4cea113
--- /dev/null
+++ b/gnu/usr.bin/binutils/gdb/Makefile.powerpc64
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+XSRCS+= ppcnbsd-nat.c ppc-tdep.c \
+ core-regset.c
+CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_powerpc_vec
diff --git a/gnu/usr.bin/binutils/ld/Makefile.powerpc64 b/gnu/usr.bin/binutils/ld/Makefile.powerpc64
new file mode 100644
index 0000000..3dd3bf9
--- /dev/null
+++ b/gnu/usr.bin/binutils/ld/Makefile.powerpc64
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+NATIVE_EMULATION= elf64ppc
+
+SRCS+= e${NATIVE_EMULATION}.c
+CLEANFILES+= e${NATIVE_EMULATION}.c
+e${NATIVE_EMULATION}.c: emulparams/${NATIVE_EMULATION}.sh emultempl/elf32.em \
+ scripttempl/elf.sc genscripts.sh stringify.sed
+ sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${LIBSERACHPATH} \
+ ${TOOLS_PREFIX}/usr \
+ ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
+ ${NATIVE_EMULATION} "" no ${NATIVE_EMULATION} ${TARGET_TUPLE}
+
+PPC32_EMULATION= elf32ppc
+_ppc32_path= \"${TOOLS_PREFIX}/usr/lib32\"
+EMS+= ${PPC32_EMULATION}
+.for ext in ${ELF_SCR_EXT}
+LDSCRIPTS+= ${PPC32_EMULATION}.${ext}
+.endfor
+
+SRCS+= e${PPC32_EMULATION}.c
+CLEANFILES+= e${PPC32_EMULATION}.c
+e${PPC32_EMULATION}.c: emulparams/${PPC32_EMULATION}.sh emultempl/elf32.em \
+ scripttempl/elf.sc genscripts.sh stringify.sed
+ sh ${.CURDIR}/genscripts.sh ${SRCDIR}/ld ${_ppc32_path} \
+ ${TOOLS_PREFIX}/usr \
+ ${HOST} ${TARGET_TUPLE} ${TARGET_TUPLE} \
+ ${PPC32_EMULATION} "" no ${PPC32_EMULATION} ${TARGET_TUPLE}
+
diff --git a/gnu/usr.bin/binutils/libbfd/Makefile b/gnu/usr.bin/binutils/libbfd/Makefile
index 3bd512c..8ace1e2 100644
--- a/gnu/usr.bin/binutils/libbfd/Makefile
+++ b/gnu/usr.bin/binutils/libbfd/Makefile
@@ -24,6 +24,8 @@ SELARCH=
SELARCH= &bfd_i386_arch
.elif ${TARGET_ARCH} == "sparc64"
SELARCH= &bfd_sparc_arch
+.elif ${TARGET_ARCH} == "powerpc64"
+SELARCH= &bfd_powerpc_arch,&bfd_rs6000_arch
.else
.for _a in ${ARCHS}
.if ${SELARCH} == ""
diff --git a/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64 b/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64
new file mode 100644
index 0000000..d65e3d1
--- /dev/null
+++ b/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+ARCHS+= rs6000
+
+DEFAULT_VECTOR= bfd_elf64_powerpc_vec
+
+SRCS+= cpu-powerpc.c \
+ cpu-rs6000.c \
+ elf32.c \
+ elf32-gen.c \
+ elf32-ppc.c \
+ elf32-target.h \
+ elflink.c \
+ elf64.c \
+ elf64-gen.c \
+ elf64-ppc.c \
+ elf64-target.h \
+ elflink.c \
+ ppcboot.c \
+ xcofflink.c
+
+VECS+= ${DEFAULT_VECTOR} \
+ bfd_elf64_powerpcle_vec \
+ bfd_elf32_powerpc_vec \
+ bfd_elf32_powerpcle_vec \
+ ppcboot_vec
+
diff --git a/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64 b/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64
new file mode 100644
index 0000000..cc010ec
--- /dev/null
+++ b/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+SRCS+= ppc-dis.c ppc-opc.c
+CFLAGS+= -DARCH_powerpc -DARCH_rs6000
diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt
index 3cb9678..5e036bc 100644
--- a/gnu/usr.bin/cc/Makefile.tgt
+++ b/gnu/usr.bin/cc/Makefile.tgt
@@ -4,7 +4,7 @@ TARGET_ARCH?= ${MACHINE_ARCH}
.if ${TARGET_ARCH} == "amd64"
GCC_CPU= i386
-.elif ${TARGET_ARCH} == "powerpc"
+.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
GCC_CPU= rs6000
.elif ${TARGET_ARCH} == "sparc64"
GCC_CPU= sparc
@@ -18,3 +18,7 @@ TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
.if ${TARGET_ARCH} == "sparc64"
TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
.endif
+.if ${TARGET_ARCH} == "powerpc64"
+TARGET_CPU_DEFAULT= \"powerpc64\"
+.endif
+
diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile
index f248313..87ad642 100644
--- a/gnu/usr.bin/cc/cc_tools/Makefile
+++ b/gnu/usr.bin/cc/cc_tools/Makefile
@@ -52,6 +52,10 @@ TARGET_INC+= ${GCC_CPU}/elf.h
.if ${TARGET_ARCH} == "arm"
TARGET_INC+= ${GCC_CPU}/aout.h
.endif
+.if ${TARGET_ARCH} == "powerpc64"
+TARGET_INC+= ${GCC_CPU}/biarch64.h
+TARGET_INC+= ${GCC_CPU}/default64.h
+.endif
TARGET_INC+= ${GCC_CPU}/freebsd.h
.if ${TARGET_ARCH} == "amd64"
TARGET_INC+= ${GCC_CPU}/freebsd64.h
@@ -171,7 +175,7 @@ OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt
.endif
-.if ${TARGET_ARCH} == "powerpc"
+.if ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
.endif
@@ -303,12 +307,22 @@ GENSRCS+= gcov-iov.h
# Multilib config file
multilib.h:
+.if ${TARGET_ARCH} == "powerpc64"
+ echo 'static const char *const multilib_raw[] = { \
+ ". !m64 !m32;", \
+ "64:../lib m64 !m32;", \
+ "32:../lib32 !m64 m32;", NULL };' > ${.TARGET}
+ echo 'static const char *multilib_options = "m64/m32";' >> ${.TARGET}
+ echo 'static const char *const multilib_matches_raw[] = { \
+ "m64 m64;", "m32 m32;", NULL };' >> ${.TARGET}
+.else
echo 'static const char *const multilib_raw[] = { \
". ;", NULL };' > ${.TARGET}
+ echo 'static const char *multilib_options = "";' >> ${.TARGET}
echo 'static const char *const multilib_matches_raw[] = { \
NULL };' >> ${.TARGET}
+.endif
echo 'static const char *multilib_extra = "";' >> ${.TARGET}
- echo 'static const char *multilib_options = "";' >> ${.TARGET}
echo 'static const char *const multilib_exclusions_raw[] = { \
NULL };' >> ${.TARGET}
diff --git a/gnu/usr.bin/cc/include/Makefile b/gnu/usr.bin/cc/include/Makefile
index 210218a..6b883c4 100644
--- a/gnu/usr.bin/cc/include/Makefile
+++ b/gnu/usr.bin/cc/include/Makefile
@@ -12,7 +12,7 @@ INCS= emmintrin.h mmintrin.h pmmintrin.h xmmintrin.h mm_malloc.h
INCS= ia64intrin.h
.elif ${TARGET_ARCH} == "arm"
INCS= mmintrin.h
-.elif ${TARGET_ARCH} == "powerpc"
+.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
INCS= ppc-asm.h altivec.h spe.h
.endif
diff --git a/gnu/usr.bin/gdb/arch/powerpc64/Makefile b/gnu/usr.bin/gdb/arch/powerpc64/Makefile
new file mode 100644
index 0000000..fa41a23
--- /dev/null
+++ b/gnu/usr.bin/gdb/arch/powerpc64/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.if !defined(GDB_CROSS_DEBUGGER)
+LIBSRCS+= fbsd-proc.c fbsd-threads.c gcore.c
+LIBSRCS+= ppcfbsd-nat.c
+.endif
+LIBSRCS+= solib.c solib-svr4.c
+LIBSRCS+= ppc-sysv-tdep.c ppcfbsd-tdep.c rs6000-tdep.c
+
+nm.h:
+ echo '#include "powerpc/nm-fbsd.h"' > ${.TARGET}
+
+tm.h:
+ echo '#include "powerpc/tm-ppc-eabi.h"' > ${.TARGET}
diff --git a/gnu/usr.bin/gdb/arch/powerpc64/config.h b/gnu/usr.bin/gdb/arch/powerpc64/config.h
new file mode 100644
index 0000000..d8b9b6d
--- /dev/null
+++ b/gnu/usr.bin/gdb/arch/powerpc64/config.h
@@ -0,0 +1,553 @@
+/* $FreeBSD$ */
+
+/* config.h. Generated automatically by configure. */
+/* config.in. Generated automatically from configure.in by autoheader. */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define if using alloca.c. */
+/* #undef C_ALLOCA */
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+/* #undef CRAY_STACKSEG_END */
+
+/* Define if you have alloca, as a function or macro. */
+#define HAVE_ALLOCA 1
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+/* #undef HAVE_ALLOCA_H */
+
+/* Define if the `long double' type works. */
+#define HAVE_LONG_DOUBLE 1
+
+/* Define if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define if you have <vfork.h>. */
+/* #undef HAVE_VFORK_H */
+
+/* Define as __inline if that's what the C compiler calls it. */
+/* #undef inline */
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+/* #undef pid_t */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define if the `setpgrp' function takes no argument. */
+/* #undef SETPGRP_VOID */
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+/* #undef STACK_DIRECTION */
+
+/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+/* #undef STAT_MACROS_BROKEN */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define vfork as fork if vfork does not work. */
+/* #undef vfork */
+
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+
+/* Define if your struct reg has r_fs. */
+/* #undef HAVE_STRUCT_REG_R_FS */
+
+/* Define if your struct stat has st_blocks. */
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+
+/* Define if your struct reg has r_gs. */
+/* #undef HAVE_STRUCT_REG_R_GS */
+
+/* Define if <link.h> exists and defines struct link_map which has
+ members with an ``l_'' prefix. (For Solaris, SVR4, and
+ SVR4-like systems.) */
+#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1
+
+/* Define if <link.h> exists and defines struct link_map which has
+ members with an ``lm_'' prefix. (For SunOS.) */
+/* #undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
+
+/* Define if <link.h> exists and defines a struct so_map which has
+ members with an ``som_'' prefix. (Found on older *BSD systems.) */
+/* #undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
+
+/* Define if <sys/link.h> has struct link_map32 */
+/* #undef HAVE_STRUCT_LINK_MAP32 */
+
+/* Define if <sys/link.h> has link_map32 (solaris sparc-64 target) */
+/* #undef _SYSCALL32 */
+
+/* Define if the prfpregset_t type is broken. */
+/* #undef PRFPREGSET_T_BROKEN */
+
+/* Define if you want to use new multi-fd /proc interface
+ (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
+/* #undef NEW_PROC_API */
+
+/* Define if ioctl argument PIOCSET is available. */
+/* #undef HAVE_PROCFS_PIOCSET */
+
+/* Define if the `long long' type works. */
+#define CC_HAS_LONG_LONG 1
+
+/* Define if the "ll" format works to print long long ints. */
+#define PRINTF_HAS_LONG_LONG 1
+
+/* Define if the "%Lg" format works to print long doubles. */
+#define PRINTF_HAS_LONG_DOUBLE 1
+
+/* Define if the "%Lg" format works to scan long doubles. */
+#define SCANF_HAS_LONG_DOUBLE 1
+
+/* Define if using Solaris thread debugging. */
+/* #undef HAVE_THREAD_DB_LIB */
+
+/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */
+/* #undef START_INFERIOR_TRAPS_EXPECTED */
+/* #undef sys_quotactl */
+
+/* Define if you have HPUX threads */
+/* #undef HAVE_HPUX_THREAD_SUPPORT */
+
+/* Define if <proc_service.h> on solaris uses int instead of
+ size_t, and assorted other type changes. */
+/* #undef PROC_SERVICE_IS_OLD */
+
+/* Define if the simulator is being linked in. */
+#define WITH_SIM 1
+
+/* Set to true if the save_state_t structure is present */
+/* #undef HAVE_STRUCT_SAVE_STATE_T */
+
+/* Set to true if the save_state_t structure has the ss_wide member */
+/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */
+
+/* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request. */
+/* #undef HAVE_PTRACE_GETREGS */
+
+/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request. */
+/* #undef HAVE_PTRACE_GETFPXREGS */
+
+/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request. */
+#define HAVE_PT_GETDBREGS 1
+
+/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */
+/* #undef HAVE_PT_GETXMMREGS */
+
+/* Define if libunwind library is being used. */
+/* #undef HAVE_LIBUNWIND */
+
+/* hostfile */
+/* #undef GDB_XM_FILE */
+
+/* targetfile */
+#define GDB_TM_FILE config/powerpc/tm-ppc-eabi.h
+
+/* nativefile */
+#ifndef CROSS_DEBUGGER
+#define GDB_NM_FILE config/ia64/nm-fbsd.h
+#endif
+
+/* Define to 1 so <sys/proc.h> gets a definition of anon_hdl. Works
+ around a <sys/proc.h> problem on IRIX 5. */
+#ifndef _KMEMUSER
+/* #undef _KMEMUSER */
+#endif
+
+/* Define if you have the __argz_count function. */
+/* #undef HAVE___ARGZ_COUNT */
+
+/* Define if you have the __argz_next function. */
+/* #undef HAVE___ARGZ_NEXT */
+
+/* Define if you have the __argz_stringify function. */
+/* #undef HAVE___ARGZ_STRINGIFY */
+
+/* Define if you have the _mcleanup function. */
+#define HAVE__MCLEANUP 1
+
+/* Define if you have the canonicalize_file_name function. */
+/* #undef HAVE_CANONICALIZE_FILE_NAME */
+
+/* Define if you have the dcgettext function. */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define if you have the getcwd function. */
+#define HAVE_GETCWD 1
+
+/* Define if you have the getpagesize function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define if you have the monstartup function. */
+#define HAVE_MONSTARTUP 1
+
+/* Define if you have the munmap function. */
+#define HAVE_MUNMAP 1
+
+/* Define if you have the poll function. */
+#define HAVE_POLL 1
+
+/* Define if you have the pread64 function. */
+/* #undef HAVE_PREAD64 */
+
+/* Define if you have the putenv function. */
+#define HAVE_PUTENV 1
+
+/* Define if you have the realpath function. */
+#define HAVE_REALPATH 1
+
+/* Define if you have the sbrk function. */
+#define HAVE_SBRK 1
+
+/* Define if you have the setenv function. */
+#define HAVE_SETENV 1
+
+/* Define if you have the setlocale function. */
+#define HAVE_SETLOCALE 1
+
+/* Define if you have the setpgid function. */
+#define HAVE_SETPGID 1
+
+/* Define if you have the setpgrp function. */
+#define HAVE_SETPGRP 1
+
+/* Define if you have the sigaction function. */
+#define HAVE_SIGACTION 1
+
+/* Define if you have the sigprocmask function. */
+#define HAVE_SIGPROCMASK 1
+
+/* Define if you have the sigsetmask function. */
+#define HAVE_SIGSETMASK 1
+
+/* Define if you have the socketpair function. */
+#define HAVE_SOCKETPAIR 1
+
+/* Define if you have the stpcpy function. */
+#define HAVE_STPCPY 1
+
+/* Define if you have the strcasecmp function. */
+#define HAVE_STRCASECMP 1
+
+/* Define if you have the strchr function. */
+#define HAVE_STRCHR 1
+
+/* Define if you have the syscall function. */
+#define HAVE_SYSCALL 1
+
+/* Define if you have the <argz.h> header file. */
+/* #undef HAVE_ARGZ_H */
+
+/* Define if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define if you have the <curses.h> header file. */
+#define HAVE_CURSES_H 1
+
+/* Define if you have the <dirent.h> header file. */
+#define HAVE_DIRENT_H 1
+
+/* Define if you have the <libunwind-ia64.h> header file. */
+/* #undef HAVE_LIBUNWIND_IA64_H */
+
+/* Define if you have the <libunwind.h> header file. */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <link.h> header file. */
+#define HAVE_LINK_H 1
+
+/* Define if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define if you have the <machine/reg.h> header file. */
+#define HAVE_MACHINE_REG_H 1
+
+/* Define if you have the <malloc.h> header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define if you have the <ncurses.h> header file. */
+#define HAVE_NCURSES_H 1
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <nl_types.h> header file. */
+#define HAVE_NL_TYPES_H 1
+
+/* Define if you have the <nlist.h> header file. */
+#define HAVE_NLIST_H 1
+
+/* Define if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define if you have the <proc_service.h> header file. */
+/* #undef HAVE_PROC_SERVICE_H */
+
+/* Define if you have the <ptrace.h> header file. */
+/* #undef HAVE_PTRACE_H */
+
+/* Define if you have the <sgtty.h> header file. */
+#define HAVE_SGTTY_H 1
+
+/* Define if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define if you have the <sys/debugreg.h> header file. */
+/* #undef HAVE_SYS_DEBUGREG_H */
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/fault.h> header file. */
+/* #undef HAVE_SYS_FAULT_H */
+
+/* Define if you have the <sys/file.h> header file. */
+#define HAVE_SYS_FILE_H 1
+
+/* Define if you have the <sys/filio.h> header file. */
+#define HAVE_SYS_FILIO_H 1
+
+/* Define if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define if you have the <sys/poll.h> header file. */
+#define HAVE_SYS_POLL_H 1
+
+/* Define if you have the <sys/proc.h> header file. */
+#define HAVE_SYS_PROC_H 1
+
+/* Define if you have the <sys/procfs.h> header file. */
+#define HAVE_SYS_PROCFS_H 1
+
+/* Define if you have the <sys/ptrace.h> header file. */
+#define HAVE_SYS_PTRACE_H 1
+
+/* Define if you have the <sys/reg.h> header file. */
+/* #undef HAVE_SYS_REG_H */
+
+/* Define if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define if you have the <sys/user.h> header file. */
+#define HAVE_SYS_USER_H 1
+
+/* Define if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define if you have the <term.h> header file. */
+#define HAVE_TERM_H 1
+
+/* Define if you have the <termio.h> header file. */
+/* #undef HAVE_TERMIO_H */
+
+/* Define if you have the <termios.h> header file. */
+#define HAVE_TERMIOS_H 1
+
+/* Define if you have the <thread_db.h> header file. */
+/* #undef HAVE_THREAD_DB_H */
+
+/* Define if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define if you have the <values.h> header file. */
+/* #undef HAVE_VALUES_H */
+
+/* Define if you have the <wait.h> header file. */
+/* #undef HAVE_WAIT_H */
+
+/* Define if you have the dl library (-ldl). */
+/* #undef HAVE_LIBDL */
+
+/* Define if you have the m library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define if you have the w library (-lw). */
+/* #undef HAVE_LIBW */
+
+/* Define if you have the stpcpy function */
+#define HAVE_STPCPY 1
+
+/* Define if your locale.h file contains LC_MESSAGES. */
+#define HAVE_LC_MESSAGES 1
+
+/* Define to 1 if NLS is requested */
+/* #undef ENABLE_NLS */
+
+/* Define as 1 if you have gettext and don't want to use GNU gettext. */
+/* #undef HAVE_GETTEXT */
+
+/* Name of this package. */
+#define PACKAGE "gdb"
+
+/* Global directory for separate debug files. */
+#define DEBUGDIR "/usr/local/lib/debug"
+
+/* Define to BFD's default architecture. */
+#define DEFAULT_BFD_ARCH bfd_rs6000_arch
+
+/* Define to BFD's default target vector. */
+#define DEFAULT_BFD_VEC bfd_elf64_powerpc_vec
+
+/* Define to 1 if your system has the _etext variable. */
+#define HAVE__ETEXT 1
+
+/* Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
+ Solaris 2.[78] when using GCC. */
+/* #undef _MSE_INT_H */
+
+/* Define to 1 if we found this declaration otherwise define to 0. */
+#define HAVE_DECL_GETOPT 0
+
+/* Define if sigsetjmp is available. */
+#define HAVE_SIGSETJMP 1
+
+/* Define to 1 if the regex included in libiberty should be used. */
+#define USE_INCLUDED_REGEX 1
+
+/* Define to 1 if your system has struct reg in <machine/reg.h>. */
+#define HAVE_STRUCT_REG 1
+
+/* Define if <stdint.h> provides the uintptr_t type. */
+#define HAVE_UINTPTR_T 1
+
+/* Define if malloc is not declared in system header files. */
+/* #undef NEED_DECLARATION_MALLOC */
+
+/* Define if realloc is not declared in system header files. */
+/* #undef NEED_DECLARATION_REALLOC */
+
+/* Define if free is not declared in system header files. */
+/* #undef NEED_DECLARATION_FREE */
+
+/* Define if strerror is not declared in system header files. */
+/* #undef NEED_DECLARATION_STRERROR */
+
+/* Define if strdup is not declared in system header files. */
+/* #undef NEED_DECLARATION_STRDUP */
+
+/* Define if strstr is not declared in system header files. */
+/* #undef NEED_DECLARATION_STRSTR */
+
+/* Define if canonicalize_file_name is not declared in system header files. */
+#define NEED_DECLARATION_CANONICALIZE_FILE_NAME 1
+
+/* Define if <sys/procfs.h> has pstatus_t. */
+/* #undef HAVE_PSTATUS_T */
+
+/* Define if <sys/procfs.h> has prrun_t. */
+/* #undef HAVE_PRRUN_T */
+
+/* Define if <sys/procfs.h> has gregset_t. */
+#define HAVE_GREGSET_T 1
+
+/* Define if <sys/procfs.h> has fpregset_t. */
+#define HAVE_FPREGSET_T 1
+
+/* Define if <sys/procfs.h> has prgregset_t. */
+#define HAVE_PRGREGSET_T 1
+
+/* Define if <sys/procfs.h> has prfpregset_t. */
+#define HAVE_PRFPREGSET_T 1
+
+/* Define if <sys/procfs.h> has prgregset32_t. */
+/* #undef HAVE_PRGREGSET32_T */
+
+/* Define if <sys/procfs.h> has prfpregset32_t. */
+/* #undef HAVE_PRFPREGSET32_T */
+
+/* Define if <sys/procfs.h> has lwpid_t. */
+#define HAVE_LWPID_T 1
+
+/* Define if <sys/procfs.h> has psaddr_t. */
+#define HAVE_PSADDR_T 1
+
+/* Define if <sys/procfs.h> has prsysent_t. */
+/* #undef HAVE_PRSYSENT_T */
+
+/* Define if <sys/procfs.h> has pr_sigset_t. */
+/* #undef HAVE_PR_SIGSET_T */
+
+/* Define if <sys/procfs.h> has pr_sigaction64_t. */
+/* #undef HAVE_PR_SIGACTION64_T */
+
+/* Define if <sys/procfs.h> has pr_siginfo64_t. */
+/* #undef HAVE_PR_SIGINFO64_T */
+
+/* Define if <thread_db.h> has the TD_NOTALLOC error code. */
+/* #undef THREAD_DB_HAS_TD_NOTALLOC */
+
+/* Define if we can use the tkill syscall. */
+/* #undef HAVE_TKILL_SYSCALL */
+
+/* Define to the default OS ABI for this configuration. */
+/* #undef GDB_OSABI_DEFAULT */
+
+/* Define to be a string naming the default host character set. */
+#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1"
+
+/* Define if you have the iconv() function. */
+/* #undef HAVE_ICONV */
+
+/* Define as const if the declaration of iconv() needs const. */
+/* #undef ICONV_CONST */
+
diff --git a/gnu/usr.bin/gdb/arch/powerpc64/init.c b/gnu/usr.bin/gdb/arch/powerpc64/init.c
new file mode 100644
index 0000000..5b96bd5
--- /dev/null
+++ b/gnu/usr.bin/gdb/arch/powerpc64/init.c
@@ -0,0 +1,230 @@
+/* $FreeBSD$ */
+
+/* Do not modify this file. */
+/* It is created automatically by the Makefile. */
+#include "defs.h" /* For initialize_file_ftype. */
+#include "call-cmds.h" /* For initialize_all_files. */
+extern initialize_file_ftype _initialize_gdbtypes;
+extern initialize_file_ftype _initialize_rs6000_tdep;
+extern initialize_file_ftype _initialize_ppcfbsd_tdep;
+extern initialize_file_ftype _initialize_corelow;
+extern initialize_file_ftype _initialize_solib;
+extern initialize_file_ftype _initialize_svr4_solib;
+extern initialize_file_ftype _initialize_ser_hardwire;
+extern initialize_file_ftype _initialize_ser_pipe;
+extern initialize_file_ftype _initialize_ser_tcp;
+extern initialize_file_ftype _initialize_fbsd_proc;
+extern initialize_file_ftype _initialize_gcore;
+extern initialize_file_ftype _initialize_kernel_u_addr;
+extern initialize_file_ftype _initialize_infptrace;
+extern initialize_file_ftype _initialize_inftarg;
+extern initialize_file_ftype _initialize_ppcfbsd_nat;
+extern initialize_file_ftype _initialize_thread_db;
+extern initialize_file_ftype _initialize_remote;
+extern initialize_file_ftype _initialize_dcache;
+extern initialize_file_ftype _initialize_sr_support;
+extern initialize_file_ftype _initialize_tracepoint;
+extern initialize_file_ftype _initialize_ax_gdb;
+extern initialize_file_ftype _initialize_annotate;
+extern initialize_file_ftype _initialize_auxv;
+extern initialize_file_ftype _initialize_breakpoint;
+extern initialize_file_ftype _initialize_regcache;
+extern initialize_file_ftype _initialize_charset;
+extern initialize_file_ftype _initialize_dummy_frame;
+extern initialize_file_ftype _initialize_source;
+extern initialize_file_ftype _initialize_values;
+extern initialize_file_ftype _initialize_valops;
+extern initialize_file_ftype _initialize_valarith;
+extern initialize_file_ftype _initialize_valprint;
+extern initialize_file_ftype _initialize_printcmd;
+extern initialize_file_ftype _initialize_symtab;
+extern initialize_file_ftype _initialize_symfile;
+extern initialize_file_ftype _initialize_symmisc;
+extern initialize_file_ftype _initialize_infcall;
+extern initialize_file_ftype _initialize_infcmd;
+extern initialize_file_ftype _initialize_infrun;
+extern initialize_file_ftype _initialize_stack;
+extern initialize_file_ftype _initialize_thread;
+extern initialize_file_ftype _initialize_interpreter;
+extern initialize_file_ftype _initialize_macrocmd;
+extern initialize_file_ftype _initialize_gdbarch;
+extern initialize_file_ftype _initialize_gdbarch_utils;
+extern initialize_file_ftype _initialize_gdb_osabi;
+extern initialize_file_ftype _initialize_copying;
+extern initialize_file_ftype _initialize_mem;
+extern initialize_file_ftype _initialize_parse;
+extern initialize_file_ftype _initialize_language;
+extern initialize_file_ftype _initialize_frame_reg;
+extern initialize_file_ftype _initialize_signals;
+extern initialize_file_ftype _initialize_kod;
+extern initialize_file_ftype _initialize_gdb_events;
+extern initialize_file_ftype _initialize_exec;
+extern initialize_file_ftype _initialize_maint_cmds;
+extern initialize_file_ftype _initialize_demangler;
+extern initialize_file_ftype _initialize_dbxread;
+extern initialize_file_ftype _initialize_coffread;
+extern initialize_file_ftype _initialize_elfread;
+extern initialize_file_ftype _initialize_mipsread;
+extern initialize_file_ftype _initialize_stabsread;
+extern initialize_file_ftype _initialize_core;
+extern initialize_file_ftype _initialize_dwarf2_frame;
+extern initialize_file_ftype _initialize_c_language;
+extern initialize_file_ftype _initialize_f_language;
+extern initialize_file_ftype _initialize_objc_language;
+extern initialize_file_ftype _initialize_ui_out;
+extern initialize_file_ftype _initialize_cli_out;
+extern initialize_file_ftype _initialize_varobj;
+extern initialize_file_ftype _initialize_java_language;
+extern initialize_file_ftype _initialize_m2_language;
+extern initialize_file_ftype _initialize_pascal_language;
+extern initialize_file_ftype _initialize_pascal_valprint;
+extern initialize_file_ftype _initialize_scheme_language;
+extern initialize_file_ftype _initialize_complaints;
+extern initialize_file_ftype _initialize_typeprint;
+extern initialize_file_ftype _initialize_cp_valprint;
+extern initialize_file_ftype _initialize_f_valprint;
+extern initialize_file_ftype _initialize_nlmread;
+extern initialize_file_ftype _initialize_serial;
+extern initialize_file_ftype _initialize_mdebugread;
+extern initialize_file_ftype _initialize_user_regs;
+extern initialize_file_ftype _initialize_frame;
+extern initialize_file_ftype _initialize_frame_unwind;
+extern initialize_file_ftype _initialize_frame_base;
+extern initialize_file_ftype _initialize_gnu_v2_abi;
+extern initialize_file_ftype _initialize_gnu_v3_abi;
+extern initialize_file_ftype _initialize_hpacc_abi;
+extern initialize_file_ftype _initialize_cp_abi;
+extern initialize_file_ftype _initialize_cp_support;
+extern initialize_file_ftype _initialize_cp_namespace;
+extern initialize_file_ftype _initialize_reggroup;
+extern initialize_file_ftype _initialize_inflow;
+extern initialize_file_ftype _initialize_cli_dump;
+extern initialize_file_ftype _initialize_cli_logging;
+extern initialize_file_ftype _initialize_cli_interp;
+extern initialize_file_ftype _initialize_mi_out;
+extern initialize_file_ftype _initialize_mi_cmds;
+extern initialize_file_ftype _initialize_mi_cmd_env;
+extern initialize_file_ftype _initialize_mi_interp;
+extern initialize_file_ftype _initialize_mi_main;
+extern initialize_file_ftype _initialize_tui_hooks;
+extern initialize_file_ftype _initialize_tui_interp;
+extern initialize_file_ftype _initialize_tui_layout;
+extern initialize_file_ftype _initialize_tui_out;
+extern initialize_file_ftype _initialize_tui_regs;
+extern initialize_file_ftype _initialize_tui_stack;
+extern initialize_file_ftype _initialize_tui_win;
+void
+initialize_all_files (void)
+{
+ _initialize_gdbtypes ();
+ _initialize_rs6000_tdep ();
+ _initialize_ppcfbsd_tdep ();
+ _initialize_corelow ();
+ _initialize_solib ();
+ _initialize_svr4_solib ();
+ _initialize_ser_hardwire ();
+ _initialize_ser_pipe ();
+ _initialize_ser_tcp ();
+#ifndef CROSS_DEBUGGER
+ _initialize_fbsd_proc ();
+ _initialize_gcore ();
+ _initialize_kernel_u_addr ();
+ _initialize_infptrace ();
+ _initialize_inftarg ();
+ _initialize_ppcfbsd_nat ();
+ _initialize_thread_db ();
+#endif
+ _initialize_remote ();
+ _initialize_dcache ();
+ _initialize_sr_support ();
+ _initialize_tracepoint ();
+ _initialize_ax_gdb ();
+ _initialize_annotate ();
+ _initialize_auxv ();
+ _initialize_breakpoint ();
+ _initialize_regcache ();
+ _initialize_charset ();
+ _initialize_dummy_frame ();
+ _initialize_source ();
+ _initialize_values ();
+ _initialize_valops ();
+ _initialize_valarith ();
+ _initialize_valprint ();
+ _initialize_printcmd ();
+ _initialize_symtab ();
+ _initialize_symfile ();
+ _initialize_symmisc ();
+ _initialize_infcall ();
+ _initialize_infcmd ();
+ _initialize_infrun ();
+ _initialize_stack ();
+ _initialize_thread ();
+ _initialize_interpreter ();
+ _initialize_macrocmd ();
+ _initialize_gdbarch ();
+ _initialize_gdbarch_utils ();
+ _initialize_gdb_osabi ();
+ _initialize_copying ();
+ _initialize_mem ();
+ _initialize_parse ();
+ _initialize_language ();
+ _initialize_frame_reg ();
+ _initialize_signals ();
+ _initialize_kod ();
+ _initialize_gdb_events ();
+ _initialize_exec ();
+ _initialize_maint_cmds ();
+ _initialize_demangler ();
+ _initialize_dbxread ();
+ _initialize_coffread ();
+ _initialize_elfread ();
+ _initialize_mipsread ();
+ _initialize_stabsread ();
+ _initialize_core ();
+ _initialize_dwarf2_frame ();
+ _initialize_c_language ();
+ _initialize_f_language ();
+ _initialize_objc_language ();
+ _initialize_ui_out ();
+ _initialize_cli_out ();
+ _initialize_varobj ();
+ _initialize_java_language ();
+ _initialize_m2_language ();
+ _initialize_pascal_language ();
+ _initialize_pascal_valprint ();
+ _initialize_scheme_language ();
+ _initialize_complaints ();
+ _initialize_typeprint ();
+ _initialize_cp_valprint ();
+ _initialize_f_valprint ();
+ _initialize_nlmread ();
+ _initialize_serial ();
+ _initialize_mdebugread ();
+ _initialize_user_regs ();
+ _initialize_frame ();
+ _initialize_frame_unwind ();
+ _initialize_frame_base ();
+ _initialize_gnu_v2_abi ();
+ _initialize_gnu_v3_abi ();
+ _initialize_hpacc_abi ();
+ _initialize_cp_abi ();
+ _initialize_cp_support ();
+ _initialize_cp_namespace ();
+ _initialize_reggroup ();
+ _initialize_inflow ();
+ _initialize_cli_dump ();
+ _initialize_cli_logging ();
+ _initialize_cli_interp ();
+ _initialize_mi_out ();
+ _initialize_mi_cmds ();
+ _initialize_mi_cmd_env ();
+ _initialize_mi_interp ();
+ _initialize_mi_main ();
+ _initialize_tui_hooks ();
+ _initialize_tui_interp ();
+ _initialize_tui_layout ();
+ _initialize_tui_out ();
+ _initialize_tui_regs ();
+ _initialize_tui_stack ();
+ _initialize_tui_win ();
+}
diff --git a/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c b/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
new file mode 100644
index 0000000..d20a4d6
--- /dev/null
+++ b/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
@@ -0,0 +1,192 @@
+/*-
+ * Copyright (c) 2006 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <ppc-tdep.h>
+
+#include "kgdb.h"
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+ struct kthr *kt;
+ struct pcb pcb;
+ struct gdbarch_tdep *tdep;
+ int i;
+
+ tdep = gdbarch_tdep (current_gdbarch);
+
+ kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+ if (kt == NULL)
+ return;
+ if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+ warnx("kvm_read: %s", kvm_geterr(kvm));
+ memset(&pcb, 0, sizeof(pcb));
+ }
+
+ /*
+ * r14-r31 are saved in the pcb
+ */
+ for (i = 14; i <= 31; i++) {
+ supply_register(tdep->ppc_gp0_regnum + i,
+ (char *)&pcb.pcb_context[i]);
+ }
+
+ /* r1 is saved in the sp field */
+ supply_register(tdep->ppc_gp0_regnum + 1, (char *)&pcb.pcb_sp);
+ /* r2 is saved in the toc field */
+ supply_register(tdep->ppc_gp0_regnum + 2, (char *)&pcb.pcb_toc);
+
+ supply_register(tdep->ppc_lr_regnum, (char *)&pcb.pcb_lr);
+ supply_register(tdep->ppc_cr_regnum, (char *)&pcb.pcb_cr);
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+ fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+struct kgdb_frame_cache {
+ CORE_ADDR pc;
+ CORE_ADDR sp;
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+ char buf[MAX_REGISTER_SIZE];
+ struct kgdb_frame_cache *cache;
+
+ cache = *this_cache;
+ if (cache == NULL) {
+ cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+ *this_cache = cache;
+ cache->pc = frame_func_unwind(next_frame);
+ frame_unwind_register(next_frame, SP_REGNUM, buf);
+ cache->sp = extract_unsigned_integer(buf,
+ register_size(current_gdbarch, SP_REGNUM));
+ }
+ return (cache);
+}
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+ struct frame_id *this_id)
+{
+ struct kgdb_frame_cache *cache;
+
+ cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+ *this_id = frame_id_build(cache->sp, cache->pc);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
+ void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
+ CORE_ADDR *addrp, int *realnump, void *valuep)
+{
+ char dummy_valuep[MAX_REGISTER_SIZE];
+ struct gdbarch_tdep *tdep;
+ struct kgdb_frame_cache *cache;
+ int ofs, regsz;
+
+ tdep = gdbarch_tdep(current_gdbarch);
+ regsz = register_size(current_gdbarch, regnum);
+
+ if (valuep == NULL)
+ valuep = dummy_valuep;
+ memset(valuep, 0, regsz);
+ *optimizedp = 0;
+ *addrp = 0;
+ *lvalp = not_lval;
+ *realnump = -1;
+
+ if (regnum >= tdep->ppc_gp0_regnum &&
+ regnum <= tdep->ppc_gplast_regnum)
+ ofs = offsetof(struct trapframe,
+ fixreg[regnum - tdep->ppc_gp0_regnum]);
+ else if (regnum == tdep->ppc_lr_regnum)
+ ofs = offsetof(struct trapframe, lr);
+ else if (regnum == tdep->ppc_cr_regnum)
+ ofs = offsetof(struct trapframe, cr);
+ else if (regnum == tdep->ppc_xer_regnum)
+ ofs = offsetof(struct trapframe, xer);
+ else if (regnum == tdep->ppc_ctr_regnum)
+ ofs = offsetof(struct trapframe, ctr);
+ else if (regnum == PC_REGNUM)
+ ofs = offsetof(struct trapframe, srr0);
+ else
+ return;
+
+ cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+ *addrp = cache->sp + 48 + ofs;
+ *lvalp = lval_memory;
+ target_read_memory(*addrp, valuep, regsz);
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+ UNKNOWN_FRAME,
+ &kgdb_trgt_trapframe_this_id,
+ &kgdb_trgt_trapframe_prev_register
+};
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+ char *pname;
+ CORE_ADDR pc;
+
+ pc = frame_pc_unwind(next_frame);
+ pname = NULL;
+ find_pc_partial_function(pc, &pname, NULL, NULL);
+ if (pname == NULL)
+ return (NULL);
+ if (strcmp(pname, "asttrapexit") == 0 ||
+ strcmp(pname, "trapexit") == 0)
+ return (&kgdb_trgt_trapframe_unwind);
+ /* printf("%s: %llx =%s\n", __func__, pc, pname); */
+ return (NULL);
+}
OpenPOWER on IntegriCloud