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: 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