Index: bfd/elf64-mips.c |
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c |
index a427985fc86b5fda77b798448e350c81e4180fb1..e02f969ed86015fb81da6e751c077cf60c20b480 100644 |
--- a/bfd/elf64-mips.c |
+++ b/bfd/elf64-mips.c |
@@ -1590,6 +1590,111 @@ static reloc_howto_type mips16_elf64_howto_table_rel[] = |
0x0000ffff, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS general dynamic variable reference. */ |
+ HOWTO (R_MIPS16_TLS_GD, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_GD", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic variable reference. */ |
+ HOWTO (R_MIPS16_TLS_LDM, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_LDM", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic offset. */ |
+ HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_DTPREL_HI16", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic offset. */ |
+ HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_DTPREL_LO16", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_GOTTPREL", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_TPREL_HI16", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_TPREL_LO16", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
}; |
static reloc_howto_type mips16_elf64_howto_table_rela[] = |
@@ -1686,6 +1791,111 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS general dynamic variable reference. */ |
+ HOWTO (R_MIPS16_TLS_GD, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_GD", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic variable reference. */ |
+ HOWTO (R_MIPS16_TLS_LDM, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_LDM", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic offset. */ |
+ HOWTO (R_MIPS16_TLS_DTPREL_HI16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_DTPREL_HI16", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS local dynamic offset. */ |
+ HOWTO (R_MIPS16_TLS_DTPREL_LO16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_DTPREL_LO16", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_GOTTPREL, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_GOTTPREL", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_TPREL_HI16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_TPREL_HI16", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* MIPS16 TLS thread pointer offset. */ |
+ HOWTO (R_MIPS16_TLS_TPREL_LO16, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 16, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS16_TLS_TPREL_LO16", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0x0000ffff, /* src_mask */ |
+ 0x0000ffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
}; |
static reloc_howto_type micromips_elf64_howto_table_rel[] = |
@@ -2498,6 +2708,7 @@ mips_elf64_be_swap_reloc_out (bfd *abfd, const Elf_Internal_Rela *src, |
mirel.r_offset = src[0].r_offset; |
BFD_ASSERT(src[0].r_offset == src[1].r_offset); |
+ BFD_ASSERT(src[0].r_offset == src[2].r_offset); |
mirel.r_type = ELF64_MIPS_R_TYPE (src[0].r_info); |
mirel.r_sym = ELF64_R_SYM (src[0].r_info); |
@@ -2908,6 +3119,15 @@ static const struct elf_reloc_map mips16_reloc_map[] = |
{ BFD_RELOC_MIPS16_CALL16, R_MIPS16_CALL16 - R_MIPS16_min }, |
{ BFD_RELOC_MIPS16_HI16_S, R_MIPS16_HI16 - R_MIPS16_min }, |
{ BFD_RELOC_MIPS16_LO16, R_MIPS16_LO16 - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_GD, R_MIPS16_TLS_GD - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_LDM, R_MIPS16_TLS_LDM - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_DTPREL_HI16, |
+ R_MIPS16_TLS_DTPREL_HI16 - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_DTPREL_LO16, |
+ R_MIPS16_TLS_DTPREL_LO16 - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_GOTTPREL, R_MIPS16_TLS_GOTTPREL - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_TPREL_HI16, R_MIPS16_TLS_TPREL_HI16 - R_MIPS16_min }, |
+ { BFD_RELOC_MIPS16_TLS_TPREL_LO16, R_MIPS16_TLS_TPREL_LO16 - R_MIPS16_min } |
}; |
static const struct elf_reloc_map micromips_reloc_map[] = |
@@ -3906,7 +4126,7 @@ const struct elf_size_info mips_elf64_size_info = |
#define elf_backend_grok_prstatus elf64_mips_grok_prstatus |
#define elf_backend_grok_psinfo elf64_mips_grok_psinfo |
-#define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) |
+#define elf_backend_got_header_size (8 * MIPS_RESERVED_GOTNO) |
/* MIPS ELF64 can use a mixture of REL and RELA, but some Relocations |
work better/work only in RELA, so we default to this. */ |