=== gnu/usr.bin/binutils/as/Makefile ================================================================== --- gnu/usr.bin/binutils/as/Makefile (revision 180961) +++ gnu/usr.bin/binutils/as/Makefile (local) @@ -20,6 +20,10 @@ # DEO: why not used? #SRCS+= itbl-ops.c +.if ${TARGET_ARCH} == "mips" +SRCS+= itbl-ops.c itbl-parse.y itbl-lex.l +.endif + .if ${TARGET_ARCH} == "amd64" SRCS+= tc-i386.c .elif ${TARGET_ARCH} == "powerpc" === as/mips-freebsd (new directory) ================================================================== === gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h ================================================================== --- gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h (revision 180961) +++ gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h (local) @@ -0,0 +1,19 @@ +/* $FreeBSD$ */ + +#include "itbl-mips.h" + +/* Choose a default ABI for MIPS targets. */ +/* XXX: Where should this be ? */ +#define MIPS_DEFAULT_ABI NO_ABI + +/* Default CPU for MIPS targets. */ +#define MIPS_CPU_STRING_DEFAULT "from-abi" + +/* Generate 64-bit code by default on MIPS targets. */ +#define MIPS_DEFAULT_64BIT 0 + +/* Allow use of E_MIPS_ABI_O32 on MIPS targets. */ +#define USE_E_MIPS_ABI_O32 1 + +/* Use traditional mips */ +#define TE_TMIPS 1 === gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h ================================================================== --- gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h (revision 180961) +++ gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h (local) @@ -0,0 +1,4 @@ +/* $FreeBSD$ */ +#define TE_TMIPS 1 + +#include "tc-mips.h" === gnu/usr.bin/binutils/ld/Makefile.mips ================================================================== --- gnu/usr.bin/binutils/ld/Makefile.mips (revision 180961) +++ gnu/usr.bin/binutils/ld/Makefile.mips (local) @@ -0,0 +1,24 @@ +# $FreeBSD$ + +#xxxIMPxxx: size? +#xxxIMPxxx: TARGET_BIG_ENDIAN is lame. We should use the netbsd convention +# of mipsel and mips. +_sz?=32 +.if defined(TARGET_BIG_ENDIAN) +NATIVE_EMULATION=elf${_sz}btsmip_fbsd +.else +NATIVE_EMULATION=elf${_sz}ltsmip_fbsd +.endif + +SRCS+= e${NATIVE_EMULATION}.c +CLEANFILES+= e${NATIVE_EMULATION}.c + +# nb: elf32 handles both elf32 and elf64 targets +e${NATIVE_EMULATION}.c: ${.CURDIR}/${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} \ + ${.CURDIR}/${NATIVE_EMULATION}.sh + === gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh ================================================================== --- gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh (revision 180961) +++ gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh (local) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes === gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh ================================================================== --- gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh (revision 180961) +++ gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh (local) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes === gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh ================================================================== --- gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh (revision 180961) +++ gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh (local) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf64btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes === gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh ================================================================== --- gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh (revision 180961) +++ gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh (local) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf64ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes === gnu/usr.bin/binutils/libbfd/bfd.h ================================================================== --- gnu/usr.bin/binutils/libbfd/bfd.h (revision 180961) +++ gnu/usr.bin/binutils/libbfd/bfd.h (local) @@ -57,7 +57,7 @@ #define BFD_ARCH_SIZE 64 -#if defined(__i386__) || defined(__powerpc__) || defined(__arm__) +#if defined(__i386__) || defined(__powerpc__) || defined(__arm__) || defined(__mips__) #define BFD_HOST_64BIT_LONG 0 #define BFD_HOST_64_BIT long long #define BFD_HOST_U_64_BIT unsigned long long === gnu/usr.bin/binutils/libbfd/Makefile.mips ================================================================== --- gnu/usr.bin/binutils/libbfd/Makefile.mips (revision 180961) +++ gnu/usr.bin/binutils/libbfd/Makefile.mips (local) @@ -0,0 +1,27 @@ +# $FreeBSD$ + +#xxxIMPxxx: endian and size +DEFAULT_VECTOR= bfd_elf32_tradbigmips_vec + +SRCS+= coff-mips.c \ + cpu-mips.c \ + ecoff.c \ + ecofflink.c \ + elf32.c \ + elf64.c \ + elfn32-mips.c \ + elf32-mips.c \ + elf64-mips.c \ + elfxx-mips.c \ + elf32-target.h \ + elf64-target.h \ + elflink.c + +VECS= bfd_elf32_tradbigmips_vec \ + bfd_elf32_tradlittlemips_vec \ + bfd_elf32_ntradbigmips_vec \ + bfd_elf32_ntradlittlemips_vec \ + bfd_elf64_tradbigmips_vec \ + bfd_elf64_tradlittlemips_vec \ + ecoff_little_vec \ + ecoff_big_vec === gnu/usr.bin/binutils/libopcodes/Makefile.mips ================================================================== --- gnu/usr.bin/binutils/libopcodes/Makefile.mips (revision 180961) +++ gnu/usr.bin/binutils/libopcodes/Makefile.mips (local) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +SRCS+= mips-dis.c mips-opc.c mips16-opc.c +CFLAGS+= -DARCH_mips === contrib/binutils/bfd/config.bfd ================================================================== --- contrib/binutils/bfd/config.bfd (revision 180961) +++ contrib/binutils/bfd/config.bfd (local) @@ -768,6 +768,10 @@ targ_defvec=bfd_elf32_littlemips_vec targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_little_vec ecoff_big_vec" ;; + mips*-*-freebsd*) + targ_defvec=bfd_elf32_tradbigmips_vec + targ_selvecs="bfd_elf32_tradlittlemips_vec bfd_elf32_ntradbigmisp_vec bfd_elf32_ntradlittlemips_vec bfd_elf64_tradbigmips_vec bfd_elf64_tradlittlemips_vec ecoff_big_vec ecoff_little_vec" + ;; mips*-*-netbsd*) targ_defvec=bfd_elf32_bigmips_vec targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec ecoff_big_vec ecoff_little_vec" === contrib/binutils/gas/config/tc-mips.c ================================================================== --- contrib/binutils/gas/config/tc-mips.c (revision 180961) +++ contrib/binutils/gas/config/tc-mips.c (local) @@ -281,6 +281,9 @@ #define HAVE_64BIT_OBJECTS (mips_abi == N64_ABI) +/* True if relocations are stored in-place. */ +#define HAVE_IN_PLACE_ADDENDS (!HAVE_NEWABI) + /* We can only have 64bit addresses if the object file format supports it. */ #define HAVE_32BIT_ADDRESSES \ @@ -13020,6 +13023,26 @@ if (fixp->fx_addsy == NULL) return 1; + /* If symbol SYM is in a mergeable section, relocations of the form + SYM + 0 can usually be made section-relative. The mergeable data + is then identified by the section offset rather than by the symbol. + + However, if we're generating REL LO16 relocations, the offset is split + between the LO16 and parterning high part relocation. The linker will + need to recalculate the complete offset in order to correctly identify + the merge data. + + The linker has traditionally not looked for the parterning high part + relocation, and has thus allowed orphaned R_MIPS_LO16 relocations to be + placed anywhere. Rather than break backwards compatibility by changing + this, it seems better not to force the issue, and instead keep the + original symbol. This will work with either linker behavior. */ + if ((fixp->fx_r_type == BFD_RELOC_LO16 + || reloc_needs_lo_p (fixp->fx_r_type)) + && HAVE_IN_PLACE_ADDENDS + && (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) != 0) + return 0; + #ifdef OBJ_ELF if (OUTPUT_FLAVOR == bfd_target_elf_flavour && S_GET_OTHER (fixp->fx_addsy) == STO_MIPS16 === contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh ================================================================== --- contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh (revision 180961) +++ contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh (local) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32bmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes