Index: contrib/binutils/bfd/elf64-mips.c =================================================================== --- contrib/binutils/bfd/elf64-mips.c +++ contrib/binutils/bfd/elf64-mips.c @@ -1673,6 +1673,24 @@ 0, /* src_mask */ 0x0000ffff, /* dst_mask */ TRUE); /* pcrel_offset */ + +/* 32 bit pc-relative. This was a GNU extension used by embedded-PIC. + It was co-opted by mips-linux for exception-handling data. */ +/* XXXBD: blind cut and paste from elf32-mips.c */ +static reloc_howto_type elf_mips_gnu_pcrel32 = + HOWTO (R_MIPS_PC32, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long) */ + 32, /* bitsize */ + TRUE, /* pc_relative */ + 0, /* bitpos */ + complain_overflow_signed, /* complain_on_overflow */ + _bfd_mips_elf_generic_reloc, /* special_function */ + "R_MIPS_PC32", /* name */ + TRUE, /* partial_inplace */ + 0xffffffff, /* src_mask */ + 0xffffffff, /* dst_mask */ + TRUE); /* pcrel_offset */ /* Swap in a MIPS 64-bit Rel reloc. */ @@ -2231,6 +2249,8 @@ return &elf_mips_gnu_vtinherit_howto; case BFD_RELOC_VTABLE_ENTRY: return &elf_mips_gnu_vtentry_howto; + case BFD_RELOC_32_PCREL: + return &elf_mips_gnu_pcrel32; default: bfd_set_error (bfd_error_bad_value); return NULL; @@ -2262,6 +2282,8 @@ return &elf_mips_gnu_vtinherit_howto; if (strcasecmp (elf_mips_gnu_vtentry_howto.name, r_name) == 0) return &elf_mips_gnu_vtentry_howto; + if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) + return &elf_mips_gnu_pcrel32; if (strcasecmp (elf_mips_gnu_rel16_s2.name, r_name) == 0) return &elf_mips_gnu_rel16_s2; if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) @@ -2286,6 +2308,8 @@ return &elf_mips_gnu_rela16_s2; else return &elf_mips_gnu_rel16_s2; + case R_MIPS_PC32: + return &elf_mips_gnu_pcrel32; default: if (r_type >= R_MIPS16_min && r_type < R_MIPS16_max) { Index: contrib/gcc/config/mips/mips.h =================================================================== --- contrib/gcc/config/mips/mips.h +++ contrib/gcc/config/mips/mips.h @@ -2721,6 +2721,7 @@ nop\n\ 1: .cpload $31\n\ .set reorder\n\ + .local " USER_LABEL_PREFIX #FUNC "\n\ jal " USER_LABEL_PREFIX #FUNC "\n\ " TEXT_SECTION_ASM_OP); #endif /* Switch to #elif when we're no longer limited by K&R C. */ @@ -2732,6 +2733,7 @@ bal 1f\n\ nop\n\ 1: .set reorder\n\ + .local " USER_LABEL_PREFIX #FUNC "\n\ .cpsetup $31, $2, 1b\n\ jal " USER_LABEL_PREFIX #FUNC "\n\ " TEXT_SECTION_ASM_OP); Index: contrib/top/loadavg.h =================================================================== --- contrib/top/loadavg.h +++ contrib/top/loadavg.h @@ -19,7 +19,7 @@ * * Defined types: load_avg for load averages, pctcpu for cpu percentages. */ -#if defined(mips) && !(defined(NetBSD) || defined(FreeBSD)) +#if defined(mips) && !(defined(NetBSD) || defined(__FreeBSD__)) # include # if defined(FBITS) && !defined(FSCALE) # define FSCALE (1 << FBITS) /* RISC/os on mips */ Index: lib/csu/mips/crti.S =================================================================== --- lib/csu/mips/crti.S +++ lib/csu/mips/crti.S @@ -1,7 +1,9 @@ #include __FBSDID("$FreeBSD$"); +#ifndef __clang__ .gnu_attribute 4, 0 +#endif .section .init,"ax",%progbits .align 4 .globl _init Index: lib/csu/mips/crtn.S =================================================================== --- lib/csu/mips/crtn.S +++ lib/csu/mips/crtn.S @@ -1,7 +1,9 @@ #include __FBSDID("$FreeBSD$"); +#ifndef __clang__ .gnu_attribute 4, 0 +#endif .section .init,"ax",%progbits .align 4 .set noreorder Index: libexec/rtld-elf/mips/rtld_start.S =================================================================== --- libexec/rtld-elf/mips/rtld_start.S +++ libexec/rtld-elf/mips/rtld_start.S @@ -133,8 +133,9 @@ /* .got = $gp - 0x7ff0 */ /* Simple math as you can see. */ #if defined(__mips_n64) - ld a0, 8(a0) /* object = pltgot[1] */ - and a0, a0, 0x7fffffffffffffff + not t0, zero + srl t0, 1 + and a0, a0, t0 #else lw a0, 4(a0) /* object = pltgot[1] & 0x7fffffff */ and a0, a0, 0x7fffffff Index: sys/boot/mips/beri/boot2/Makefile =================================================================== --- sys/boot/mips/beri/boot2/Makefile +++ sys/boot/mips/beri/boot2/Makefile @@ -63,7 +63,6 @@ LDFLAGS= -nostdlib \ -static \ - -N \ -G0 \ -L${.CURDIR} Index: sys/boot/mips/beri/boot2/relocate.S =================================================================== --- sys/boot/mips/beri/boot2/relocate.S +++ sys/boot/mips/beri/boot2/relocate.S @@ -32,7 +32,9 @@ .set mips64 .set noreorder +#ifndef __clang__ .set nobopt +#endif .set noat /* Index: sys/boot/mips/beri/boot2/start.S =================================================================== --- sys/boot/mips/beri/boot2/start.S +++ sys/boot/mips/beri/boot2/start.S @@ -32,7 +32,9 @@ .set mips64 .set noreorder +#ifndef __clang__ .set nobopt +#endif .set noat /* Index: sys/boot/mips/beri/loader/start.S =================================================================== --- sys/boot/mips/beri/loader/start.S +++ sys/boot/mips/beri/loader/start.S @@ -33,7 +33,9 @@ .set mips64 .set noreorder +#ifndef __clang__ .set nobopt +#endif .set noat ASM_ENTRY(__start) Index: usr.bin/xlint/xlint/xlint.c =================================================================== --- usr.bin/xlint/xlint/xlint.c +++ usr.bin/xlint/xlint/xlint.c @@ -405,7 +405,11 @@ break; case 'p': +#ifdef __clang__ + appcstrg(&lcflags, "-Traditional"); +#else /* gcc */ appcstrg(&lcflags, "-Wtraditional"); +#endif appcstrg(&lcflags, "-Wno-system-headers"); appcstrg(&l1flags, "-p"); appcstrg(&l2flags, "-p");