Index: bfd/elf64-mips.c |
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c |
index e02f969ed86015fb81da6e751c077cf60c20b480..a0c5cc59d3922a134fac7f58ff31cac405f162c0 100644 |
--- a/bfd/elf64-mips.c |
+++ b/bfd/elf64-mips.c |
@@ -1803,7 +1803,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_GD", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1818,7 +1818,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_LDM", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1833,7 +1833,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_DTPREL_HI16", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1848,7 +1848,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_DTPREL_LO16", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1863,7 +1863,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_GOTTPREL", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1878,7 +1878,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_TPREL_HI16", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
@@ -1893,7 +1893,7 @@ static reloc_howto_type mips16_elf64_howto_table_rela[] = |
_bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS16_TLS_TPREL_LO16", /* name */ |
FALSE, /* partial_inplace */ |
- 0x0000ffff, /* src_mask */ |
+ 0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
}; |
@@ -2184,6 +2184,37 @@ static reloc_howto_type micromips_elf64_howto_table_rel[] = |
0x0000ffff, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
+ |
+ /* Section displacement. */ |
+ HOWTO (R_MICROMIPS_SCN_DISP, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_dont, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MICROMIPS_SCN_DISP", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0xffffffff, /* src_mask */ |
+ 0xffffffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* Protected jump conversion. This is an optimization hint. No |
+ relocation is required for correctness. */ |
+ HOWTO (R_MICROMIPS_JALR, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_dont, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MICROMIPS_JALR", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0, /* src_mask */ |
+ 0x00000000, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
}; |
static reloc_howto_type micromips_elf64_howto_table_rela[] = |
@@ -2495,6 +2526,37 @@ static reloc_howto_type micromips_elf64_howto_table_rela[] = |
0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
FALSE), /* pcrel_offset */ |
+ |
+ /* Section displacement. */ |
+ HOWTO (R_MICROMIPS_SCN_DISP, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_dont, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MICROMIPS_SCN_DISP", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0, /* src_mask */ |
+ 0xffffffff, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
+ |
+ /* Protected jump conversion. This is an optimization hint. No |
+ relocation is required for correctness. */ |
+ HOWTO (R_MICROMIPS_JALR, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_dont, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MICROMIPS_JALR", /* name */ |
+ FALSE, /* partial_inplace */ |
+ 0, /* src_mask */ |
+ 0x00000000, /* dst_mask */ |
+ FALSE), /* pcrel_offset */ |
}; |
/* GNU extension to record C++ vtable hierarchy */ |
@@ -2560,6 +2622,23 @@ static reloc_howto_type elf_mips_gnu_rela16_s2 = |
0, /* src_mask */ |
0x0000ffff, /* dst_mask */ |
TRUE); /* pcrel_offset */ |
+ |
+/* 32 bit pc-relative. Used for compact EH tables. */ |
+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 */ |
+ |
/* Originally a VxWorks extension, but now used for other systems too. */ |
static reloc_howto_type elf_mips_copy_howto = |
@@ -2570,7 +2649,7 @@ static reloc_howto_type elf_mips_copy_howto = |
FALSE, /* pc_relative */ |
0, /* bitpos */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
- bfd_elf_generic_reloc, /* special_function */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS_COPY", /* name */ |
FALSE, /* partial_inplace */ |
0x0, /* src_mask */ |
@@ -2586,12 +2665,29 @@ static reloc_howto_type elf_mips_jump_slot_howto = |
FALSE, /* pc_relative */ |
0, /* bitpos */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
- bfd_elf_generic_reloc, /* special_function */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
"R_MIPS_JUMP_SLOT", /* name */ |
FALSE, /* partial_inplace */ |
0x0, /* src_mask */ |
0x0, /* dst_mask */ |
FALSE); /* pcrel_offset */ |
+ |
+/* Used in EH tables. */ |
+static reloc_howto_type elf_mips_eh_howto = |
+ HOWTO (R_MIPS_EH, /* type */ |
+ 0, /* rightshift */ |
+ 2, /* size (0 = byte, 1 = short, 2 = long) */ |
+ 32, /* bitsize */ |
+ FALSE, /* pc_relative */ |
+ 0, /* bitpos */ |
+ complain_overflow_signed, /* complain_on_overflow */ |
+ _bfd_mips_elf_generic_reloc, /* special_function */ |
+ "R_MIPS_EH", /* name */ |
+ TRUE, /* partial_inplace */ |
+ 0xffffffff, /* src_mask */ |
+ 0xffffffff, /* dst_mask */ |
+ FALSE); /* pcrel_offset */ |
+ |
/* Swap in a MIPS 64-bit Rel reloc. */ |
@@ -3152,6 +3248,8 @@ static const struct elf_reloc_map micromips_reloc_map[] = |
{ BFD_RELOC_MICROMIPS_HIGHEST, R_MICROMIPS_HIGHEST - R_MICROMIPS_min }, |
{ BFD_RELOC_MICROMIPS_CALL_HI16, R_MICROMIPS_CALL_HI16 - R_MICROMIPS_min }, |
{ BFD_RELOC_MICROMIPS_CALL_LO16, R_MICROMIPS_CALL_LO16 - R_MICROMIPS_min }, |
+ { BFD_RELOC_MICROMIPS_SCN_DISP, R_MICROMIPS_SCN_DISP - R_MICROMIPS_min }, |
+ { BFD_RELOC_MICROMIPS_JALR, R_MICROMIPS_JALR - R_MICROMIPS_min }, |
}; |
/* Given a BFD reloc type, return a howto structure. */ |
@@ -3193,6 +3291,10 @@ 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; |
+ case BFD_RELOC_MIPS_EH: |
+ return &elf_mips_eh_howto; |
case BFD_RELOC_MIPS_COPY: |
return &elf_mips_copy_howto; |
case BFD_RELOC_MIPS_JUMP_SLOT: |
@@ -3240,6 +3342,10 @@ bfd_elf64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
return &elf_mips_gnu_rel16_s2; |
if (strcasecmp (elf_mips_gnu_rela16_s2.name, r_name) == 0) |
return &elf_mips_gnu_rela16_s2; |
+ if (strcasecmp (elf_mips_gnu_pcrel32.name, r_name) == 0) |
+ return &elf_mips_gnu_pcrel32; |
+ if (strcasecmp (elf_mips_eh_howto.name, r_name) == 0) |
+ return &elf_mips_eh_howto; |
if (strcasecmp (elf_mips_copy_howto.name, r_name) == 0) |
return &elf_mips_copy_howto; |
if (strcasecmp (elf_mips_jump_slot_howto.name, r_name) == 0) |
@@ -3264,6 +3370,10 @@ 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; |
+ case R_MIPS_EH: |
+ return &elf_mips_eh_howto; |
case R_MIPS_COPY: |
return &elf_mips_copy_howto; |
case R_MIPS_JUMP_SLOT: |
@@ -3944,10 +4054,10 @@ elf64_mips_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) |
case 480: /* Linux/MIPS - N64 kernel */ |
/* pr_cursig */ |
- elf_tdata (abfd)->core_signal = bfd_get_16 (abfd, note->descdata + 12); |
+ elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); |
/* pr_pid */ |
- elf_tdata (abfd)->core_lwpid = bfd_get_32 (abfd, note->descdata + 32); |
+ elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32); |
/* pr_reg */ |
offset = 112; |
@@ -3970,9 +4080,9 @@ elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
return FALSE; |
case 136: /* Linux/MIPS - N64 kernel elf_prpsinfo */ |
- elf_tdata (abfd)->core_program |
+ elf_tdata (abfd)->core->program |
= _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); |
- elf_tdata (abfd)->core_command |
+ elf_tdata (abfd)->core->command |
= _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); |
} |
@@ -3981,7 +4091,7 @@ elf64_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) |
implementations, so strip it off if it exists. */ |
{ |
- char *command = elf_tdata (abfd)->core_command; |
+ char *command = elf_tdata (abfd)->core->command; |
int n = strlen (command); |
if (0 < n && command[n - 1] == ' ') |
@@ -4166,6 +4276,7 @@ const struct elf_size_info mips_elf64_size_info = |
#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound |
#define bfd_elf64_canonicalize_dynamic_reloc mips_elf64_canonicalize_dynamic_reloc |
#define bfd_elf64_bfd_relax_section _bfd_mips_relax_section |
+#define bfd_elf64_mkobject _bfd_mips_elf_mkobject |
/* MIPS ELF64 archive functions. */ |
#define bfd_elf64_archive_functions |