From owner-svn-src-projects@freebsd.org Wed Feb 17 22:56:56 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D27D3AAAB08 for ; Wed, 17 Feb 2016 22:56:56 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 901FE1760; Wed, 17 Feb 2016 22:56:56 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1HMutoS099113; Wed, 17 Feb 2016 22:56:55 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1HMuthi099112; Wed, 17 Feb 2016 22:56:55 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201602172256.u1HMuthi099112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 17 Feb 2016 22:56:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r295725 - projects/mips64-clang/contrib/binutils/bfd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Feb 2016 22:56:57 -0000 Author: sbruno Date: Wed Feb 17 22:56:55 2016 New Revision: 295725 URL: https://svnweb.freebsd.org/changeset/base/295725 Log: Copy binutils change from CHERIBSD: https://github.com/CTSRD-CHERI/cheribsd/commit/85ff1bcfc56c82334e50835ba3694e3fb17594ba Implement support for R_MIPS_PC32 by copying the code in elf32-mips.c to elf64-mips.c. From examining other relocations, no other changes appear to be required, but I'm not sure how to test the result. It is sufficient to allow code where llvm produces R_MIPS_PC32 relocations to link (or since such code is mostly threaded, to fail due to missing jemalloc symbols rather than linker errors). Submitted by: brooks Modified: projects/mips64-clang/contrib/binutils/bfd/elf64-mips.c Modified: projects/mips64-clang/contrib/binutils/bfd/elf64-mips.c ============================================================================== --- projects/mips64-clang/contrib/binutils/bfd/elf64-mips.c Wed Feb 17 22:53:30 2016 (r295724) +++ projects/mips64-clang/contrib/binutils/bfd/elf64-mips.c Wed Feb 17 22:56:55 2016 (r295725) @@ -1673,6 +1673,24 @@ static reloc_howto_type elf_mips_gnu_rel 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 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *ab 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 @@ bfd_elf64_bfd_reloc_name_lookup (bfd *ab 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 @@ mips_elf64_rtype_to_howto (unsigned int 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) {