2010-12-14 Robert Millan * config/tc-mips.h (TARGET_SUFFIX): New macro, adds a "-freebsd" suffix to FreeBSD targets. * config/te-tmips-freebsd.h: New file. Includes tc-mips.h after defining TE_FreeBSD to enable FreeBSD version of TARGET_SUFFIX(). * config/tc-mips.c (mips_target_format): Wrap traditional MIPS targets around TARGET_SUFFIX(). * configure.in: Recognize mips-freebsd and mips-kfreebsd-gnu. * configure.tgt: Likewise. * configure: Regenerate. diff -Nur binutils/gas/config/tc-mips.c binutils.gas/gas/config/tc-mips.c --- binutils/gas/config/tc-mips.c 2010-12-10 15:25:04.000000000 +0100 +++ binutils.gas/gas/config/tc-mips.c 2010-12-14 17:09:54.000000000 +0100 @@ -1333,13 +1333,13 @@ /* This is traditional mips. */ return (target_big_endian ? (HAVE_64BIT_OBJECTS - ? "elf64-tradbigmips" + ? TARGET_SUFFIX ("elf64-tradbigmips") : (HAVE_NEWABI - ? "elf32-ntradbigmips" : "elf32-tradbigmips")) + ? TARGET_SUFFIX ("elf32-ntradbigmips") : TARGET_SUFFIX ("elf32-tradbigmips"))) : (HAVE_64BIT_OBJECTS - ? "elf64-tradlittlemips" + ? TARGET_SUFFIX ("elf64-tradlittlemips") : (HAVE_NEWABI - ? "elf32-ntradlittlemips" : "elf32-tradlittlemips"))); + ? TARGET_SUFFIX ("elf32-ntradlittlemips") : TARGET_SUFFIX ("elf32-tradlittlemips")))); #else return (target_big_endian ? (HAVE_64BIT_OBJECTS diff -Nur binutils/gas/config/tc-mips.h binutils.gas/gas/config/tc-mips.h --- binutils/gas/config/tc-mips.h 2010-12-10 15:25:05.000000000 +0100 +++ binutils.gas/gas/config/tc-mips.h 2010-12-14 17:09:54.000000000 +0100 @@ -35,6 +35,12 @@ #define TARGET_ARCH bfd_arch_mips +#ifdef TE_FreeBSD +#define TARGET_SUFFIX(tgt) tgt "-freebsd" +#else +#define TARGET_SUFFIX(tgt) tgt +#endif + #define WORKING_DOT_WORD 1 #define OLD_FLOAT_READS #define REPEAT_CONS_EXPRESSIONS diff -Nur binutils/gas/config/te-tmips-freebsd.h binutils.gas/gas/config/te-tmips-freebsd.h --- binutils/gas/config/te-tmips-freebsd.h 1970-01-01 01:00:00.000000000 +0100 +++ binutils.gas/gas/config/te-tmips-freebsd.h 2010-12-14 17:09:54.000000000 +0100 @@ -0,0 +1,27 @@ +/* te-tmips-freebsd.h -- Traditional MIPS / FreeBSD target environment declarations. + Copyright 2000, 2005, 2007 Free Software Foundation, Inc. + + This file is part of GAS, the GNU Assembler. + + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + GAS is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GAS; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* Target environment for FreeBSD. It is the same as the generic + target, except that it arranges via the TE_FreeBSD define to + suppress the use of "/" as a comment character. Some code in the + FreeBSD kernel uses "/" to mean division. (What a concept!) */ +#define TE_FreeBSD 1 + +#include "te-tmips.h" diff -Nur binutils/gas/configure.in binutils.gas/gas/configure.in --- binutils/gas/configure.in 2010-11-19 03:32:00.000000000 +0100 +++ binutils.gas/gas/configure.in 2010-12-14 17:12:29.000000000 +0100 @@ -250,10 +250,10 @@ esac # Decide which ABI to target by default. case ${target} in - mips64*-linux* | mips-sgi-irix6*) + mips64*-linux* | mips-sgi-irix6* | mips64*-freebsd* | mips64*-kfreebsd*-gnu) mips_default_abi=N32_ABI ;; - mips*-linux*) + mips*-linux* | mips*-freebsd* | mips*-kfreebsd*-gnu) mips_default_abi=O32_ABI ;; mips64*-openbsd*) @@ -401,7 +401,8 @@ case ${generic_target}-${fmt} in mips-*-irix5*-*) emulation="mipsbelf mipslelf mipself mipsbecoff mipslecoff mipsecoff" ;; - mips*-*-linux*-*) case "$endian" in + mips*-*-linux*-* | mips*-*-freebsd* | mips*-*-kfreebsd*-gnu) + case "$endian" in big) emulation="mipsbelf mipslelf mipself" ;; *) emulation="mipslelf mipsbelf mipself" ;; esac ;; diff -Nur binutils/gas/configure.tgt binutils.gas/gas/configure.tgt --- binutils/gas/configure.tgt 2010-11-30 02:14:08.000000000 +0100 +++ binutils.gas/gas/configure.tgt 2010-12-14 17:13:09.000000000 +0100 @@ -290,6 +290,8 @@ mips-*-lnews*) fmt=ecoff em=lnews ;; mips-*-riscos*) fmt=ecoff ;; mips*-*-linux*) fmt=elf em=tmips ;; + mips*-*-freebsd* | mips*-*-kfreebsd*-gnu) + fmt=elf em=tmips-freebsd ;; mips-*-sysv4*MP* | mips-*-gnu*) fmt=elf em=tmips ;; mips*-sde-elf*) fmt=elf em=tmips ;; mips-*-sysv*) fmt=ecoff ;;