svn commit: r209867 - in head: contrib/binutils/bfd
contrib/binutils/ld contrib/gcc/config/rs6000 contrib/gdb/gdb
gnu/lib/csu gnu/lib/libgcc gnu/usr.bin/binutils/as
gnu/usr.bin/binutils/as/powerpc6...
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Sat Jul 10 02:29:23 UTC 2010
Author: nwhitehorn
Date: Sat Jul 10 02:29:22 2010
New Revision: 209867
URL: http://svn.freebsd.org/changeset/base/209867
Log:
Teach our toolchain how to generate 64-bit PowerPC binaries. This fixes
a variety of bugs in binutils related to handling of 64-bit PPC ELF,
provides a GCC configuration for 64-bit PowerPC on FreeBSD, and
associated build systems tweaks.
Obtained from: projects/ppc64
Added:
head/gnu/usr.bin/binutils/as/powerpc64-freebsd/
- copied from r209845, head/gnu/usr.bin/binutils/as/powerpc-freebsd/
head/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 (contents, props changed)
head/gnu/usr.bin/binutils/ld/Makefile.powerpc64 (contents, props changed)
head/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64 (contents, props changed)
head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64
- copied unchanged from r209845, head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc
head/gnu/usr.bin/gdb/arch/powerpc64/
- copied from r209845, head/gnu/usr.bin/gdb/arch/powerpc/
head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
- copied, changed from r209845, head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
Modified:
head/contrib/binutils/bfd/elf64-ppc.c
head/contrib/binutils/ld/lexsup.c
head/contrib/gcc/config/rs6000/freebsd.h
head/contrib/gdb/gdb/ppcfbsd-tdep.c
head/contrib/gdb/gdb/solib-svr4.c
head/gnu/lib/csu/Makefile
head/gnu/lib/libgcc/Makefile
head/gnu/usr.bin/binutils/as/Makefile
head/gnu/usr.bin/binutils/gdb/Makefile
head/gnu/usr.bin/binutils/libbfd/Makefile
head/gnu/usr.bin/cc/Makefile.tgt
head/gnu/usr.bin/cc/cc_tools/Makefile
head/gnu/usr.bin/cc/include/Makefile
head/gnu/usr.bin/gdb/arch/powerpc64/config.h
Modified: head/contrib/binutils/bfd/elf64-ppc.c
==============================================================================
--- head/contrib/binutils/bfd/elf64-ppc.c Fri Jul 9 21:27:42 2010 (r209866)
+++ head/contrib/binutils/bfd/elf64-ppc.c Sat Jul 10 02:29:22 2010 (r209867)
@@ -3268,13 +3268,13 @@ create_got_section (bfd *abfd, struct bf
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 *ou
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_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 *
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
Modified: head/contrib/binutils/ld/lexsup.c
==============================================================================
--- head/contrib/binutils/ld/lexsup.c Fri Jul 9 21:27:42 2010 (r209866)
+++ head/contrib/binutils/ld/lexsup.c Sat Jul 10 02:29:22 2010 (r209867)
@@ -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;
Modified: head/contrib/gcc/config/rs6000/freebsd.h
==============================================================================
--- head/contrib/gcc/config/rs6000/freebsd.h Fri Jul 9 21:27:42 2010 (r209866)
+++ head/contrib/gcc/config/rs6000/freebsd.h Sat Jul 10 02:29:22 2010 (r209867)
@@ -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)
+
Modified: head/contrib/gdb/gdb/ppcfbsd-tdep.c
==============================================================================
--- head/contrib/gdb/gdb/ppcfbsd-tdep.c Fri Jul 9 21:27:42 2010 (r209866)
+++ head/contrib/gdb/gdb/ppcfbsd-tdep.c Sat Jul 10 02:29:22 2010 (r209867)
@@ -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 in
/* 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
Modified: head/contrib/gdb/gdb/solib-svr4.c
==============================================================================
--- head/contrib/gdb/gdb/solib-svr4.c Fri Jul 9 21:27:42 2010 (r209866)
+++ head/contrib/gdb/gdb/solib-svr4.c Sat Jul 10 02:29:22 2010 (r209867)
@@ -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
Modified: head/gnu/lib/csu/Makefile
==============================================================================
--- head/gnu/lib/csu/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/lib/csu/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -31,7 +31,7 @@ CFLAGS+= -x assembler-with-cpp # Ugly ha
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
Modified: head/gnu/lib/libgcc/Makefile
==============================================================================
--- head/gnu/lib/libgcc/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/lib/libgcc/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -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
Modified: head/gnu/usr.bin/binutils/as/Makefile
==============================================================================
--- head/gnu/usr.bin/binutils/as/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/binutils/as/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -26,7 +26,7 @@ SRCS+= itbl-ops.c itbl-parse.y itbl-lex.
.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
Modified: head/gnu/usr.bin/binutils/gdb/Makefile
==============================================================================
--- head/gnu/usr.bin/binutils/gdb/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/binutils/gdb/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -12,6 +12,8 @@ GDBDIR= ${.CURDIR}/../../../../contrib/g
GDB_CPU= sparc
.elif ${TARGET_ARCH} == "amd64"
GDB_CPU= i386
+.elif ${TARGET_ARCH} == "powerpc64"
+GDB_CPU= powerpc
.else
GDB_CPU= ${TARGET_ARCH}
.endif
Added: head/gnu/usr.bin/binutils/gdb/Makefile.powerpc64
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/gnu/usr.bin/binutils/gdb/Makefile.powerpc64 Sat Jul 10 02:29:22 2010 (r209867)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+XSRCS+= ppcnbsd-nat.c ppc-tdep.c \
+ core-regset.c
+CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_powerpc_vec
Added: head/gnu/usr.bin/binutils/ld/Makefile.powerpc64
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/gnu/usr.bin/binutils/ld/Makefile.powerpc64 Sat Jul 10 02:29:22 2010 (r209867)
@@ -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}
+
Modified: head/gnu/usr.bin/binutils/libbfd/Makefile
==============================================================================
--- head/gnu/usr.bin/binutils/libbfd/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/binutils/libbfd/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -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} == ""
Added: head/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/gnu/usr.bin/binutils/libbfd/Makefile.powerpc64 Sat Jul 10 02:29:22 2010 (r209867)
@@ -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
+
Copied: head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64 (from r209845, head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc64 Sat Jul 10 02:29:22 2010 (r209867, copy of r209845, head/gnu/usr.bin/binutils/libopcodes/Makefile.powerpc)
@@ -0,0 +1,4 @@
+# $FreeBSD$
+
+SRCS+= ppc-dis.c ppc-opc.c
+CFLAGS+= -DARCH_powerpc -DARCH_rs6000
Modified: head/gnu/usr.bin/cc/Makefile.tgt
==============================================================================
--- head/gnu/usr.bin/cc/Makefile.tgt Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/cc/Makefile.tgt Sat Jul 10 02:29:22 2010 (r209867)
@@ -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
.if ${TARGET_ARCH} == "sparc64"
TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
.endif
+.if ${TARGET_ARCH} == "powerpc64"
+TARGET_CPU_DEFAULT= \"powerpc64\"
+.endif
+
Modified: head/gnu/usr.bin/cc/cc_tools/Makefile
==============================================================================
--- head/gnu/usr.bin/cc/cc_tools/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/cc/cc_tools/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -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}/
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}
Modified: head/gnu/usr.bin/cc/include/Makefile
==============================================================================
--- head/gnu/usr.bin/cc/include/Makefile Fri Jul 9 21:27:42 2010 (r209866)
+++ head/gnu/usr.bin/cc/include/Makefile Sat Jul 10 02:29:22 2010 (r209867)
@@ -12,7 +12,7 @@ INCS= emmintrin.h mmintrin.h pmmintrin.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
Modified: head/gnu/usr.bin/gdb/arch/powerpc64/config.h
==============================================================================
--- head/gnu/usr.bin/gdb/arch/powerpc/config.h Fri Jul 9 11:27:33 2010 (r209845)
+++ head/gnu/usr.bin/gdb/arch/powerpc64/config.h Sat Jul 10 02:29:22 2010 (r209867)
@@ -446,7 +446,7 @@
#define DEFAULT_BFD_ARCH bfd_rs6000_arch
/* Define to BFD's default target vector. */
-#define DEFAULT_BFD_VEC bfd_elf32_powerpc_vec
+#define DEFAULT_BFD_VEC bfd_elf64_powerpc_vec
/* Define to 1 if your system has the _etext variable. */
#define HAVE__ETEXT 1
Copied and modified: head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c (from r209845, head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c)
==============================================================================
--- head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c Fri Jul 9 11:27:33 2010 (r209845, copy source)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c Sat Jul 10 02:29:22 2010 (r209867)
@@ -72,6 +72,8 @@ kgdb_trgt_fetch_registers(int regno __un
/* 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);
@@ -160,7 +162,7 @@ kgdb_trgt_trapframe_prev_register(struct
return;
cache = kgdb_trgt_frame_cache(next_frame, this_cache);
- *addrp = cache->sp + 8 + ofs;
+ *addrp = cache->sp + 48 + ofs;
*lvalp = lval_memory;
target_read_memory(*addrp, valuep, regsz);
}
More information about the svn-src-head
mailing list