Index: gnu/usr.bin/binutils/libbfd/bfd.h =================================================================== --- gnu/usr.bin/binutils/libbfd/bfd.h (revision 183186) +++ gnu/usr.bin/binutils/libbfd/bfd.h (working copy) @@ -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 Index: gnu/usr.bin/binutils/libbfd/Makefile.mips =================================================================== --- gnu/usr.bin/binutils/libbfd/Makefile.mips (revision 0) +++ gnu/usr.bin/binutils/libbfd/Makefile.mips (revision 0) @@ -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 Index: gnu/usr.bin/binutils/libopcodes/Makefile.mips =================================================================== --- gnu/usr.bin/binutils/libopcodes/Makefile.mips (revision 0) +++ gnu/usr.bin/binutils/libopcodes/Makefile.mips (revision 0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +SRCS+= mips-dis.c mips-opc.c mips16-opc.c +CFLAGS+= -DARCH_mips Index: gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh =================================================================== --- gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh (revision 0) +++ gnu/usr.bin/binutils/ld/elf64ltsmip_fbsd.sh (revision 0) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf64ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Index: gnu/usr.bin/binutils/ld/Makefile.mips =================================================================== --- gnu/usr.bin/binutils/ld/Makefile.mips (revision 0) +++ gnu/usr.bin/binutils/ld/Makefile.mips (revision 0) @@ -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 + Index: gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh =================================================================== --- gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh (revision 0) +++ gnu/usr.bin/binutils/ld/elf32btsmip_fbsd.sh (revision 0) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Index: gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh =================================================================== --- gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh (revision 0) +++ gnu/usr.bin/binutils/ld/elf64btsmip_fbsd.sh (revision 0) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf64btsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Index: gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh =================================================================== --- gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh (revision 0) +++ gnu/usr.bin/binutils/ld/elf32ltsmip_fbsd.sh (revision 0) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32ltsmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Index: gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h =================================================================== --- gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h (revision 0) +++ gnu/usr.bin/binutils/as/mips-freebsd/itbl-cpu.h (revision 0) @@ -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 Index: gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h =================================================================== --- gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h (revision 0) +++ gnu/usr.bin/binutils/as/mips-freebsd/targ-cpu.h (revision 0) @@ -0,0 +1,4 @@ +/* $FreeBSD$ */ +#define TE_TMIPS 1 + +#include "tc-mips.h" Index: gnu/usr.bin/binutils/as/Makefile =================================================================== --- gnu/usr.bin/binutils/as/Makefile (revision 183186) +++ gnu/usr.bin/binutils/as/Makefile (working copy) @@ -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" Index: contrib/openpam/include/security/openpam.h =================================================================== --- contrib/openpam/include/security/openpam.h (revision 183185) +++ contrib/openpam/include/security/openpam.h (working copy) @@ -316,7 +316,8 @@ # define NO_STATIC_MODULES #endif -#if defined(__GNUC__) && !defined(__PIC__) && !defined(NO_STATIC_MODULES) +#if defined(__GNUC__) +#if !defined(NO_STATIC_MODULES) /* gcc, static linking */ # include # include @@ -341,6 +342,7 @@ # define PAM_EXTERN # define PAM_MODULE_ENTRY(name) #endif +#endif #ifdef __cplusplus } Index: contrib/bsnmp/snmp_mibII/mibII.c =================================================================== --- contrib/bsnmp/snmp_mibII/mibII.c (revision 183185) +++ contrib/bsnmp/snmp_mibII/mibII.c (working copy) @@ -1044,7 +1044,7 @@ break; case RTM_IFINFO: - ifm = (struct if_msghdr *)rtm; + ifm = (struct if_msghdr *)(void *)rtm; mib_extract_addrs(ifm->ifm_addrs, (u_char *)(ifm + 1), addrs); if ((ifp = mib_find_if_sys(ifm->ifm_index)) == NULL) break; Index: contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh =================================================================== --- contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh (revision 0) +++ contrib/binutils/ld/emulparams/elf32bmip_fbsd.sh (revision 0) @@ -0,0 +1,3 @@ +. ${srcdir}/emulparams/elf32bmip.sh +. ${srcdir}/emulparams/elf_fbsd.sh +GENERATE_PIE_SCRIPT=yes Index: contrib/binutils/gas/config/tc-mips.c =================================================================== --- contrib/binutils/gas/config/tc-mips.c (revision 183186) +++ contrib/binutils/gas/config/tc-mips.c (working copy) @@ -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 Index: contrib/binutils/bfd/config.bfd =================================================================== --- contrib/binutils/bfd/config.bfd (revision 183186) +++ contrib/binutils/bfd/config.bfd (working copy) @@ -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" Index: usr.sbin/rpc.yppasswdd/yppasswdd_server.c =================================================================== --- usr.sbin/rpc.yppasswdd/yppasswdd_server.c (revision 183185) +++ usr.sbin/rpc.yppasswdd/yppasswdd_server.c (working copy) @@ -820,7 +820,7 @@ yp_error("pw_tmp() failed"); return &result; } - if (pw_copy(pfd, tfd, (struct passwd *)&argp->newpw, NULL) == -1) { + if (pw_copy(pfd, tfd, (struct passwd *)(void *)&argp->newpw, NULL) == -1) { pw_fini(); yp_error("pw_copy() failed"); return &result; @@ -858,7 +858,7 @@ pw_fini(); if (inplace) { - if ((rval = update_inplace((struct passwd *)&argp->newpw, + if ((rval = update_inplace((struct passwd *)(void *)&argp->newpw, argp->domain))) { yp_error("inplace update failed -- rebuilding maps"); } Index: lib/libpam/Makefile.inc =================================================================== --- lib/libpam/Makefile.inc (revision 183185) +++ lib/libpam/Makefile.inc (working copy) @@ -28,5 +28,10 @@ DEBUG_FLAGS+= -DDEBUG .endif +# Specify dynamic linking explicitly, instead of using check whether +# __PIC__ is defined or not. MIPS -mabicalls assumes -fpic and -mabicalls +# flag is used for both static and dynamic libraries. +PICFLAG+= -DNO_STATIC_MODULES + SHLIB_MAJOR= 4 PAM_MOD_DIR= ${LIBDIR}