summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2010-11-11 20:52:24 +0000
committerDimitry Andric <dim@FreeBSD.org>2010-11-11 20:52:24 +0000
commit1170f3d12ebd03d02f8bb4f075319f461e38d7d9 (patch)
tree9a6496b320a182a536b4a33b916ab30b48840f06 /gnu
parent7f1b3c9427de245f0888601791098c2c56559dfd (diff)
parent19da400c6428b54fa989d98146798f9746d426d0 (diff)
downloadsrc-test-1170f3d12ebd03d02f8bb4f075319f461e38d7d9.tar.gz
src-test-1170f3d12ebd03d02f8bb4f075319f461e38d7d9.zip
Notes
Diffstat (limited to 'gnu')
-rw-r--r--gnu/lib/libgcc/Makefile37
-rw-r--r--gnu/usr.bin/binutils/Makefile.inc031
-rw-r--r--gnu/usr.bin/binutils/as/Makefile6
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.arm2
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile.mips4
-rw-r--r--gnu/usr.bin/binutils/libbfd/Makefile.arm4
-rw-r--r--gnu/usr.bin/binutils/libbfd/Makefile.mips6
-rw-r--r--gnu/usr.bin/cc/Makefile.inc10
-rw-r--r--gnu/usr.bin/cc/Makefile.tgt19
-rw-r--r--gnu/usr.bin/cc/cc_int/Makefile4
-rw-r--r--gnu/usr.bin/cc/cc_tools/Makefile22
-rw-r--r--gnu/usr.bin/gdb/Makefile.inc14
-rw-r--r--gnu/usr.bin/gdb/arch/mips/Makefile2
-rw-r--r--gnu/usr.bin/gdb/arch/mips/init.c5
-rw-r--r--gnu/usr.bin/gdb/kgdb/Makefile2
-rw-r--r--gnu/usr.bin/gdb/kgdb/trgt_mips.c41
-rw-r--r--gnu/usr.bin/gdb/libgdb/Makefile10
17 files changed, 123 insertions, 96 deletions
diff --git a/gnu/lib/libgcc/Makefile b/gnu/lib/libgcc/Makefile
index b3480dc2da30e..2021c8c737cc1 100644
--- a/gnu/lib/libgcc/Makefile
+++ b/gnu/lib/libgcc/Makefile
@@ -3,7 +3,6 @@
GCCDIR= ${.CURDIR}/../../../contrib/gcc
GCCLIB= ${.CURDIR}/../../../contrib/gcclibs
-LIB= gcc
SHLIB_NAME= libgcc_s.so.1
SHLIBDIR?= /lib
@@ -27,7 +26,7 @@ CFLAGS+= -DIN_GCC -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
LDFLAGS+= -nodefaultlibs
LDADD+= -lc
-OBJS= # added to below in various ways depending on TARGET_ARCH
+OBJS= # added to below in various ways depending on TARGET_CPUARCH
#---------------------------------------------------------------------------
#
@@ -100,7 +99,7 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
# Platform specific bits.
# When upgrading GCC, get the following definitions from config/<cpu>/t-*
#
-.if ${TARGET_ARCH} == "arm"
+.if ${TARGET_CPUARCH} == "arm"
# from config/arm/t-strongarm-elf
CFLAGS+= -Dinhibit_libc -fno-inline
LIB1ASMSRC = lib1funcs.asm
@@ -116,7 +115,7 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
# _fixsfsi _fixunssfsi _floatdidf _floatdisf
.endif
-.if ${TARGET_ARCH} == "mips"
+.if ${TARGET_CPUARCH} == "mips"
LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
@@ -126,7 +125,7 @@ LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c
.endif
.endif
-.if ${TARGET_ARCH} == "ia64"
+.if ${TARGET_CPUARCH} == "ia64"
# from config/ia64/t-ia64
LIB1ASMSRC = lib1funcs.asm
LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \
@@ -137,18 +136,18 @@ LIB1ASMFUNCS = __divxf3 __divdf3 __divsf3 \
LIB2ADDEH = unwind-ia64.c unwind-sjlj.c unwind-c.c
.endif
-.if ${TARGET_ARCH} == "powerpc"
+.if ${TARGET_CPUARCH} == "powerpc"
# from config/rs6000/t-ppccomm
LIB2FUNCS_EXTRA = tramp.asm
LIB2FUNCS_STATIC_EXTRA = eabi.asm
.endif
-.if ${TARGET_ARCH} == "powerpc64"
+.if ${TARGET_CPUARCH} == "powerpc64"
# from config/rs6000/t-ppccomm
LIB2FUNCS_EXTRA = tramp.asm
.endif
-.if ${TARGET_ARCH} == "sparc64"
+.if ${TARGET_CPUARCH} == "sparc64"
# from config/sparc/t-elf
LIB1ASMSRC = lb1spc.asm
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3
@@ -195,8 +194,8 @@ OBJ_GRPS = STD DIV
#
# Floating point emulation functions
#
-.if ${TARGET_ARCH} == "armNOT_YET" || \
- ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "sparc64"
+.if ${TARGET_CPUARCH} == "armNOT_YET" || \
+ ${TARGET_CPUARCH} == "powerpc" || ${TARGET_CPUARCH} == "sparc64"
FPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES -DFLOAT
DPBIT_CFLAGS = -DFINE_GRAINED_LIBRARIES
@@ -334,21 +333,21 @@ CLEANFILES += libgcc.map
#
# Build additional static libgcc_eh[_p].a libraries.
#
-lib${LIB}_eh.a: ${EH_OBJS_T}
- @${ECHO} building static ${LIB}_eh library
+libgcc_eh.a: ${EH_OBJS_T}
+ @${ECHO} building static gcc_eh library
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} `lorder ${EH_OBJS_T} | tsort -q`
${RANLIB} ${.TARGET}
-all: lib${LIB}_eh.a
+all: libgcc_eh.a
.if ${MK_PROFILE} != "no"
-lib${LIB}_eh_p.a: ${EH_OBJS_P}
- @${ECHO} building profiled ${LIB}_eh library
+libgcc_eh_p.a: ${EH_OBJS_P}
+ @${ECHO} building profiled gcc_eh library
@rm -f ${.TARGET}
@${AR} cq ${.TARGET} `lorder ${EH_OBJS_P} | tsort -q`
${RANLIB} ${.TARGET}
-all: lib${LIB}_eh_p.a
+all: libgcc_eh_p.a
.endif
_libinstall: _lib-eh-install
@@ -356,14 +355,14 @@ _libinstall: _lib-eh-install
_lib-eh-install:
.if ${MK_INSTALLLIB} != "no"
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${_INSTALLFLAGS} lib${LIB}_eh.a ${DESTDIR}${LIBDIR}
+ ${_INSTALLFLAGS} libgcc_eh.a ${DESTDIR}${LIBDIR}
.endif
.if ${MK_PROFILE} != "no"
${INSTALL} -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
- ${_INSTALLFLAGS} lib${LIB}_eh_p.a ${DESTDIR}${LIBDIR}
+ ${_INSTALLFLAGS} libgcc_eh_p.a ${DESTDIR}${LIBDIR}
.endif
-CLEANFILES+= lib${LIB}_eh.a lib${LIB}_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
+CLEANFILES+= libgcc_eh.a libgcc_eh_p.a ${EH_OBJS_T} ${EH_OBJS_P}
.include <bsd.lib.mk>
diff --git a/gnu/usr.bin/binutils/Makefile.inc0 b/gnu/usr.bin/binutils/Makefile.inc0
index 7a062bab0f4bc..09bda29a3cc11 100644
--- a/gnu/usr.bin/binutils/Makefile.inc0
+++ b/gnu/usr.bin/binutils/Makefile.inc0
@@ -6,15 +6,19 @@
VERSION= "2.17.50 [FreeBSD] 2007-07-03"
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
+.else
+TARGET_CPUARCH=${MACHINE_CPUARCH}
+.endif
TARGET_ARCH?= ${MACHINE_ARCH}
TARGET_VENDOR?= unknown
TARGET_OS?= freebsd
-.if ${TARGET_ARCH} == "amd64"
-BINUTILS_ARCH=x86_64
-.else
-BINUTILS_ARCH=${TARGET_ARCH}
-.endif
+BINUTILS_ARCH=${TARGET_ARCH:C/amd64/x86_64/}
TARGET_TUPLE?= ${BINUTILS_ARCH}-${TARGET_VENDOR}-${TARGET_OS}
+.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "mipseb"
+TARGET_BIG_ENDIAN=t
+.endif
# RELTOP is the relative path to this point in the source or object
# tree, from any subdirectory of same. It gets extra "../" prefixes
@@ -24,28 +28,29 @@ RELTOP:= ..
RELSRC= ${RELTOP}/../../../contrib/binutils
SRCDIR= ${.CURDIR}/${RELSRC}
-.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "i386" || \
- ${TARGET_ARCH} == "powerpc" || \
- (${TARGET_ARCH} == "mips" && (!defined(TARGET_ABI) || ${TARGET_ABI} != "n64"))
+.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "i386" || \
+ ${TARGET_CPUARCH} == "powerpc" || \
+ (${TARGET_CPUARCH} == "mips" && \
+ (!defined(TARGET_ABI) || ${TARGET_ABI} != "n64"))
CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=32
.else
CFLAGS+= -DBFD_DEFAULT_TARGET_SIZE=64
.endif
CFLAGS+= -I.
-.if exists(${.CURDIR}/${TARGET_ARCH})
-CFLAGS+= -I${.CURDIR}/${TARGET_ARCH}
+.if exists(${.CURDIR}/${TARGET_CPUARCH})
+CFLAGS+= -I${.CURDIR}/${TARGET_CPUARCH}
.endif
CFLAGS+= -I${.CURDIR}
CFLAGS+= -I${.CURDIR}/${RELTOP}/libbfd
CFLAGS+= -I${.OBJDIR}/${RELTOP}/libbfd
CFLAGS+= -I${SRCDIR}/include
-.if exists(${.CURDIR}/${TARGET_ARCH})
-.PATH: ${.CURDIR}/${TARGET_ARCH}
+.if exists(${.CURDIR}/${TARGET_CPUARCH})
+.PATH: ${.CURDIR}/${TARGET_CPUARCH}
.endif
-ARCHS= ${TARGET_ARCH}
+ARCHS= ${TARGET_CPUARCH}
.for _arch in ${CROSS_ARCH}
.if (${ARCHS:R:M${_arch:R}} == "")
diff --git a/gnu/usr.bin/binutils/as/Makefile b/gnu/usr.bin/binutils/as/Makefile
index 7e2df54c3fae2..003ce1f81ab7d 100644
--- a/gnu/usr.bin/binutils/as/Makefile
+++ b/gnu/usr.bin/binutils/as/Makefile
@@ -41,7 +41,7 @@ SRCS+= app.c \
# DEO: why not used?
#SRCS+= itbl-ops.c
-.if ${TARGET_ARCH} == "mips"
+.if ${TARGET_CPUARCH} == "mips"
SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l
.endif
@@ -52,7 +52,7 @@ SRCS+= tc-ppc.c
.elif ${TARGET_ARCH} == "sparc64"
SRCS+= tc-sparc.c
.else
-SRCS+= tc-${TARGET_ARCH}.c
+SRCS+= tc-${TARGET_CPUARCH}.c
.endif
.if ${TARGET_ARCH} == "sparc64"
@@ -70,7 +70,7 @@ CFLAGS+= -DTARGET_ALIAS=\"${TARGET_TUPLE}\"
CFLAGS+= -DVERSION=\"${VERSION}\"
CFLAGS+= -D_GNU_SOURCE
CFLAGS+= -I${SRCDIR}/gas -I${SRCDIR}/bfd -I${SRCDIR}/gas/config -I${SRCDIR}
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_ARCH}-freebsd
+CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-freebsd
NO_SHARED?= yes
diff --git a/gnu/usr.bin/binutils/ld/Makefile.arm b/gnu/usr.bin/binutils/ld/Makefile.arm
index b4d9d69e27749..870fcece5f4d6 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.arm
+++ b/gnu/usr.bin/binutils/ld/Makefile.arm
@@ -1,6 +1,6 @@
# $FreeBSD$
-.if defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "armeb"
NATIVE_EMULATION= armelfb_fbsd
.else
NATIVE_EMULATION= armelf_fbsd
diff --git a/gnu/usr.bin/binutils/ld/Makefile.mips b/gnu/usr.bin/binutils/ld/Makefile.mips
index e0d0582df617d..de0ec945d68b8 100644
--- a/gnu/usr.bin/binutils/ld/Makefile.mips
+++ b/gnu/usr.bin/binutils/ld/Makefile.mips
@@ -1,8 +1,6 @@
# $FreeBSD$
-#xxxIMPxxx: TARGET_BIG_ENDIAN is lame. We should use the netbsd convention
-# of mipsel and mips.
-.if !defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "mipsel"
_EMULATION_ENDIAN=l
.else
_EMULATION_ENDIAN=b
diff --git a/gnu/usr.bin/binutils/libbfd/Makefile.arm b/gnu/usr.bin/binutils/libbfd/Makefile.arm
index 9633783068fc6..4910f38086313 100644
--- a/gnu/usr.bin/binutils/libbfd/Makefile.arm
+++ b/gnu/usr.bin/binutils/libbfd/Makefile.arm
@@ -1,6 +1,6 @@
# $FreeBSD$
-.if defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "armeb"
DEFAULT_VECTOR= bfd_elf32_bigarm_vec
.else
DEFAULT_VECTOR= bfd_elf32_littlearm_vec
@@ -14,7 +14,7 @@ SRCS+= cpu-arm.c \
elflink.c
VECS+= ${DEFAULT_VECTOR}
-.if defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "armeb"
VECS+= bfd_elf32_littlearm_vec
.else
VECS+= bfd_elf32_bigarm_vec
diff --git a/gnu/usr.bin/binutils/libbfd/Makefile.mips b/gnu/usr.bin/binutils/libbfd/Makefile.mips
index cb1e370e34d2f..bf21130d39bbb 100644
--- a/gnu/usr.bin/binutils/libbfd/Makefile.mips
+++ b/gnu/usr.bin/binutils/libbfd/Makefile.mips
@@ -1,15 +1,11 @@
# $FreeBSD$
-#xxxIMPxxx: TARGET_BIG_ENDIAN is lame. We should use the netbsd convention
-# of mipsel and mips.
-.if !defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "mipsel"
_EMULATION_ENDIAN=little
.else
_EMULATION_ENDIAN=big
.endif
-DEFAULT_VECTOR= bfd_elf32_tradbigmips_vec
-
.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
.if ${TARGET_ABI} == "n32"
DEFAULT_VECTOR= bfd_elf32_ntrad${_EMULATION_ENDIAN}mips_vec
diff --git a/gnu/usr.bin/cc/Makefile.inc b/gnu/usr.bin/cc/Makefile.inc
index 994d97937083d..9d3ee2dbfa0fe 100644
--- a/gnu/usr.bin/cc/Makefile.inc
+++ b/gnu/usr.bin/cc/Makefile.inc
@@ -32,9 +32,13 @@ CFLAGS+= -DLONG_TYPE_SIZE=${LONG_TYPE_SIZE}
CFLAGS+= -DCROSS_COMPILE
.endif
-.if ${TARGET_ARCH} == "mips"
-# XXX This is backwards, MIPS should default to BE.
-.if !defined(TARGET_BIG_ENDIAN)
+.if ${TARGET_ARCH} == "armeb"
+CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
+.endif
+
+
+.if ${TARGET_CPUARCH} == "mips"
+.if ${TARGET_ARCH} == "mipsel"
CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
.endif
diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt
index 5e036bc141454..a1e6d08ed6243 100644
--- a/gnu/usr.bin/cc/Makefile.tgt
+++ b/gnu/usr.bin/cc/Makefile.tgt
@@ -1,16 +1,15 @@
# $FreeBSD$
-TARGET_ARCH?= ${MACHINE_ARCH}
+# These assignments duplicate much of the functionality of
+# MACHINE_CPUARCH, but there's no easy way to export make functions...
-.if ${TARGET_ARCH} == "amd64"
-GCC_CPU= i386
-.elif ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
-GCC_CPU= rs6000
-.elif ${TARGET_ARCH} == "sparc64"
-GCC_CPU= sparc
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
.else
-GCC_CPU= ${TARGET_ARCH}
+TARGET_CPUARCH=${MACHINE_CPUARCH}
.endif
+TARGET_ARCH?= ${MACHINE_ARCH}
+GCC_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs6000/:C/sparc64/sparc/}
.if ${TARGET_ARCH} == "ia64"
TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
@@ -18,7 +17,9 @@ TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
.if ${TARGET_ARCH} == "sparc64"
TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
.endif
+.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "mipseb" || ${TARGET_ARCH} == "mips64eb"
+TARGET_BIG_ENDIAN=t
+.endif
.if ${TARGET_ARCH} == "powerpc64"
TARGET_CPU_DEFAULT= \"powerpc64\"
.endif
-
diff --git a/gnu/usr.bin/cc/cc_int/Makefile b/gnu/usr.bin/cc/cc_int/Makefile
index a7ec17c064105..7082c3ea4238a 100644
--- a/gnu/usr.bin/cc/cc_int/Makefile
+++ b/gnu/usr.bin/cc/cc_int/Makefile
@@ -75,10 +75,6 @@ OBJS-md+= ${GCC_CPU}-c.o
# Target specific, C specific object file
C_TARGET_OBJS=
-.if ${TARGET_ARCH} == "arm" && defined(TARGET_BIG_ENDIAN)
-CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
-.endif
-
# Language-specific object files for C and Objective C.
C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \
c-convert.o c-aux-info.o c-common.o c-opts.o c-format.o c-semantics.o \
diff --git a/gnu/usr.bin/cc/cc_tools/Makefile b/gnu/usr.bin/cc/cc_tools/Makefile
index 87ad642870acc..1ba230060e775 100644
--- a/gnu/usr.bin/cc/cc_tools/Makefile
+++ b/gnu/usr.bin/cc/cc_tools/Makefile
@@ -22,13 +22,13 @@ LIBIBERTY= libiberty.a
# The list of headers to go into tm.h
#
TARGET_INC+= options.h
-.if ${TARGET_ARCH} == "amd64"
+.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+= i386/biarch64.h
.endif
-.if ${TARGET_ARCH} != "arm"
+.if ${TARGET_CPUARCH} != "arm"
TARGET_INC+= ${GCC_CPU}/${GCC_CPU}.h
.endif
-.if ${TARGET_ARCH} == "i386" || ${TARGET_ARCH} == "amd64"
+.if ${TARGET_CPUARCH} == "i386" || ${TARGET_CPUARCH} == "amd64"
TARGET_INC+= ${GCC_CPU}/unix.h
TARGET_INC+= ${GCC_CPU}/att.h
.endif
@@ -38,18 +38,18 @@ TARGET_INC+= elfos.h
TARGET_INC+= freebsd-native.h
TARGET_INC+= freebsd-spec.h
TARGET_INC+= freebsd.h
-.if ${TARGET_ARCH} != "i386" && ${TARGET_ARCH} != "amd64"
+.if ${TARGET_CPUARCH} != "i386" && ${TARGET_CPUARCH} != "amd64"
. if exists(${GCCDIR}/config/${GCC_CPU}/sysv4.h)
TARGET_INC+= ${GCC_CPU}/sysv4.h
. endif
.endif
-.if ${TARGET_ARCH} == "amd64"
+.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+= ${GCC_CPU}/x86-64.h
.endif
-.if ${TARGET_ARCH} == "arm" || ${TARGET_ARCH} == "mips"
+.if ${TARGET_CPUARCH} == "arm" || ${TARGET_CPUARCH} == "mips"
TARGET_INC+= ${GCC_CPU}/elf.h
.endif
-.if ${TARGET_ARCH} == "arm"
+.if ${TARGET_CPUARCH} == "arm"
TARGET_INC+= ${GCC_CPU}/aout.h
.endif
.if ${TARGET_ARCH} == "powerpc64"
@@ -57,10 +57,10 @@ TARGET_INC+= ${GCC_CPU}/biarch64.h
TARGET_INC+= ${GCC_CPU}/default64.h
.endif
TARGET_INC+= ${GCC_CPU}/freebsd.h
-.if ${TARGET_ARCH} == "amd64"
+.if ${TARGET_CPUARCH} == "amd64"
TARGET_INC+= ${GCC_CPU}/freebsd64.h
.endif
-.if ${TARGET_ARCH} == "arm"
+.if ${TARGET_CPUARCH} == "arm"
TARGET_INC+= ${GCC_CPU}/arm.h
.endif
TARGET_INC+= defaults.h
@@ -175,11 +175,11 @@ OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/${GCC_CPU}.opt
OPT_FILES+= ${.CURDIR}/${GCC_CPU}-freebsd.opt
.endif
-.if ${TARGET_ARCH} == "powerpc" || ${TARGET_ARCH} == "powerpc64"
+.if ${TARGET_CPUARCH} == "powerpc"
OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/sysv4.opt
.endif
-.if ${TARGET_ARCH} == "sparc64"
+.if ${TARGET_CPUARCH} == "sparc64"
OPT_FILES+= ${GCCDIR}/config/${GCC_CPU}/long-double-switch.opt
.endif
diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc
index c230f95574402..2888163467b42 100644
--- a/gnu/usr.bin/gdb/Makefile.inc
+++ b/gnu/usr.bin/gdb/Makefile.inc
@@ -16,8 +16,16 @@ OBJ_ROOT= ${.OBJDIR}/../..
OBJ_BU= ${OBJ_ROOT}/binutils
OBJ_GDB= ${OBJ_ROOT}/gdb
-TARGET_ARCH?= ${MACHINE_ARCH}
-TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_ARCH}
+# These assignments duplicate much of the functionality of
+# MACHINE_CPUARCH, but there's no easy way to export make functions...
+
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
+.else
+TARGET_CPUARCH=${MACHINE_CPUARCH}
+.endif
+TARGET_ARCH?= ${MACHINE_ARCH}
+TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_CPUARCH}
.if ${TARGET_ARCH} != ${MACHINE_ARCH}
GDB_CROSS_DEBUGGER=
@@ -31,7 +39,7 @@ GDB_CROSS_DEBUGGER=
CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1
CFLAGS+= -I.
CFLAGS+= -I${TARGET_SUBDIR}
-CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_ARCH}
+CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_CPUARCH}
CFLAGS+= -I${CNTRB_GDB}/gdb
CFLAGS+= -I${CNTRB_GDB}/gdb/config
CFLAGS+= -I${CNTRB_BU}/include
diff --git a/gnu/usr.bin/gdb/arch/mips/Makefile b/gnu/usr.bin/gdb/arch/mips/Makefile
index 54180d9571510..a6d4d9e14f7b4 100644
--- a/gnu/usr.bin/gdb/arch/mips/Makefile
+++ b/gnu/usr.bin/gdb/arch/mips/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
.if !defined(GDB_CROSS_DEBUGGER)
-LIBSRCS+= mipsfbsd-nat.c
+LIBSRCS+= mipsfbsd-nat.c fbsd-threads.c
.endif
LIBSRCS+= solib.c solib-svr4.c
LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c
diff --git a/gnu/usr.bin/gdb/arch/mips/init.c b/gnu/usr.bin/gdb/arch/mips/init.c
index 27631f2c0458f..491b2b3ee3967 100644
--- a/gnu/usr.bin/gdb/arch/mips/init.c
+++ b/gnu/usr.bin/gdb/arch/mips/init.c
@@ -119,6 +119,8 @@ initialize_all_files (void)
_initialize_mips_tdep ();
_initialize_mipsfbsd_tdep ();
_initialize_corelow ();
+ _initialize_solib ();
+ _initialize_svr4_solib ();
_initialize_ser_hardwire ();
_initialize_ser_pipe ();
_initialize_ser_tcp ();
@@ -130,8 +132,7 @@ initialize_all_files (void)
_initialize_kernel_u_addr ();
_initialize_infptrace ();
_initialize_inftarg ();
- _initialize_solib ();
- _initialize_svr4_solib ();
+ _initialize_thread_db ();
#if 0
_initialize_svr4_lm ();
#endif
diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile
index 955394a5d9fa4..1372f17bf8ed0 100644
--- a/gnu/usr.bin/gdb/kgdb/Makefile
+++ b/gnu/usr.bin/gdb/kgdb/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PROG= kgdb${GDB_SUFFIX}
-SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_ARCH}.c
+SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_CPUARCH}.c
WARNS?= 2
BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \
diff --git a/gnu/usr.bin/gdb/kgdb/trgt_mips.c b/gnu/usr.bin/gdb/kgdb/trgt_mips.c
index 97822223d0764..423cacd8a0616 100644
--- a/gnu/usr.bin/gdb/kgdb/trgt_mips.c
+++ b/gnu/usr.bin/gdb/kgdb/trgt_mips.c
@@ -46,11 +46,16 @@ __FBSDID("$FreeBSD$");
#include <frame-unwind.h>
#include <mips-tdep.h>
+#ifndef CROSS_DEBUGGER
+#include <machine/pcb.h>
+#endif
+
#include "kgdb.h"
void
kgdb_trgt_fetch_registers(int regno __unused)
{
+#ifndef CROSS_DEBUGGER
struct kthr *kt;
struct pcb pcb;
@@ -61,24 +66,27 @@ kgdb_trgt_fetch_registers(int regno __unused)
warnx("kvm_read: %s", kvm_geterr(kvm));
memset(&pcb, 0, sizeof(pcb));
}
- supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]);
- supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]);
- supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]);
- supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[3]);
- supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[4]);
- supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[5]);
- supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[6]);
- supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[7]);
- supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[8]);
- supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[9]);
- supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[10]);
+
+ supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S0]);
+ supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S1]);
+ supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S2]);
+ supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S3]);
+ supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S4]);
+ supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S5]);
+ supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S6]);
+ supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S7]);
+ supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_SP]);
+ supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_GP]);
+ supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[PCB_REG_RA]);
+ supply_register(MIPS_EMBED_PC_REGNUM, (char *)&pcb.pcb_context[PCB_REG_PC]);
+#endif
}
void
kgdb_trgt_store_registers(int regno __unused)
{
- fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+ fprintf_unfiltered(gdb_stderr, "Unimplemented function: %s\n", __func__);
}
void
@@ -86,6 +94,7 @@ kgdb_trgt_new_objfile(struct objfile *objfile)
{
}
+#ifndef CROSS_DEBUGGER
struct kgdb_frame_cache {
CORE_ADDR pc;
CORE_ADDR sp;
@@ -127,7 +136,7 @@ static int kgdb_trgt_frame_offset[] = {
};
static struct kgdb_frame_cache *
-kgdb_trgt_frame_cache(struct frame_info *next_frame __unused, void **this_cache __unused)
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
{
char buf[MAX_REGISTER_SIZE];
struct kgdb_frame_cache *cache;
@@ -190,10 +199,12 @@ static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
&kgdb_trgt_trapframe_this_id,
&kgdb_trgt_trapframe_prev_register
};
+#endif
const struct frame_unwind *
-kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame __unused)
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
{
+#ifndef CROSS_DEBUGGER
char *pname;
CORE_ADDR pc;
@@ -207,6 +218,6 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame __unused)
(strcmp(pname, "MipsUserIntr") == 0) ||
(strcmp(pname, "MipsUserGenException") == 0))
return (&kgdb_trgt_trapframe_unwind);
- /* printf("%s: %llx =%s\n", __func__, pc, pname); */
+#endif
return (NULL);
}
diff --git a/gnu/usr.bin/gdb/libgdb/Makefile b/gnu/usr.bin/gdb/libgdb/Makefile
index 8c22a1acb3651..bb18a8e6bdd98 100644
--- a/gnu/usr.bin/gdb/libgdb/Makefile
+++ b/gnu/usr.bin/gdb/libgdb/Makefile
@@ -1,6 +1,14 @@
# $FreeBSD$
-TARGET_ARCH?= ${MACHINE_ARCH}
+# These assignments duplicate much of the functionality of
+# MACHINE_CPUARCH, but there's no easy way to export make functions...
+
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
+.else
+TARGET_CPUARCH=${MACHINE_CPUARCH}
+.endif
+TARGET_ARCH?= ${MACHINE_ARCH}
LIB= gdb
INTERNALLIB=