aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/cc
diff options
context:
space:
mode:
authorJayachandran C. <jchandra@FreeBSD.org>2010-11-27 12:26:40 +0000
committerJayachandran C. <jchandra@FreeBSD.org>2010-11-27 12:26:40 +0000
commit43f6e368b0a5523c2727da0b0248172b488b758e (patch)
treefd7cffbdc745cef2675b66c7c0b61767483a2475 /gnu/usr.bin/cc
parent30409a7564cd898dd84a0f5835cf3931705d01c0 (diff)
Notes
Diffstat (limited to 'gnu/usr.bin/cc')
-rw-r--r--gnu/usr.bin/cc/Makefile.inc33
-rw-r--r--gnu/usr.bin/cc/Makefile.tgt3
2 files changed, 33 insertions, 3 deletions
diff --git a/gnu/usr.bin/cc/Makefile.inc b/gnu/usr.bin/cc/Makefile.inc
index d7ed8a821806..ec5c54dd3e81 100644
--- a/gnu/usr.bin/cc/Makefile.inc
+++ b/gnu/usr.bin/cc/Makefile.inc
@@ -30,6 +30,39 @@ 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)
+CFLAGS += -DTARGET_ENDIAN_DEFAULT=0
+.endif
+
+.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
+.if ${TARGET_ABI} == "n32"
+MIPS_ABI_DEFAULT=ABI_N32
+.elif ${TARGET_ABI} == "n64"
+MIPS_ABI_DEFAULT=ABI_64
+.endif
+.endif
+
+MIPS_ABI_DEFAULT?=ABI_32
+CFLAGS += -DMIPS_ABI_DEFAULT=${MIPS_ABI_DEFAULT}
+
+# If we are compiling for the O32 ABI, we need to default to MIPS-III rather
+# than taking the ISA from the ABI requirements, since FreeBSD is built with
+# a number of MIPS-III features/instructions and that is the minimum ISA we
+# support, not the O32 default MIPS-I.
+.if ${MIPS_ABI_DEFAULT} == "ABI_32"
+TARGET_CPUTYPE?=mips3
+.endif
+
+# GCC by default takes the ISA from the ABI's requirements. If world is built
+# with a superior ISA, since we lack multilib, we have to set the right
+# default ISA to be able to link against what's in /usr/lib. Terrible stuff.
+.if defined(TARGET_CPUTYPE)
+CFLAGS += -DMIPS_CPU_STRING_DEFAULT=\"${TARGET_CPUTYPE}\"
+.endif
+.endif
+
.if defined(WANT_FORCE_OPTIMIZATION_DOWNGRADE)
CFLAGS+= -DFORCE_OPTIMIZATION_DOWNGRADE=${WANT_FORCE_OPTIMIZATION_DOWNGRADE}
.endif
diff --git a/gnu/usr.bin/cc/Makefile.tgt b/gnu/usr.bin/cc/Makefile.tgt
index dc6cc81f39a1..3cb9678a0025 100644
--- a/gnu/usr.bin/cc/Makefile.tgt
+++ b/gnu/usr.bin/cc/Makefile.tgt
@@ -15,9 +15,6 @@ GCC_CPU= ${TARGET_ARCH}
.if ${TARGET_ARCH} == "ia64"
TARGET_CPU_DEFAULT= MASK_GNU_AS|MASK_GNU_LD
.endif
-.if ${TARGET_ARCH} == "mips"
-TARGET_CPU_DEFAULT= 16
-.endif
.if ${TARGET_ARCH} == "sparc64"
TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
.endif