diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-12-22 10:31:02 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-12-22 10:31:02 +0000 |
commit | 4c89bc7b04088a0255798c0ce2326a4d0e1a96f6 (patch) | |
tree | 969816dcc41de52d586ac3f343ec325d476577f9 /gnu/usr.bin/binutils-2.17 | |
parent | b2591d607e0b8a72a640f3918434c09f7d36ea0d (diff) |
Add support for R_MIPS_PC32 relocation. It is needed for linking code
that has been compiled using clang.
The added code is based on old binutils code from year 2000.
Prodded by and OK jca@, OK kettenis@ guenther@
Diffstat (limited to 'gnu/usr.bin/binutils-2.17')
-rw-r--r-- | gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c b/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c index c8f3127e3c9..dc74d36d1bf 100644 --- a/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c +++ b/gnu/usr.bin/binutils-2.17/bfd/elf64-mips.c @@ -1632,6 +1632,22 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = 0, /* src_mask */ 0x0000ffff, /* dst_mask */ TRUE); /* pcrel_offset */ + +/* 32 bit pc-relative. */ +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. */ @@ -2221,6 +2237,8 @@ bfd_elf64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, 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; @@ -2243,6 +2261,8 @@ mips_elf64_rtype_to_howto (unsigned int r_type, bfd_boolean rela_p) 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) { |