diff options
Diffstat (limited to 'bfd/elf32-m68k.c')
-rw-r--r-- | bfd/elf32-m68k.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 50b962d..81d219d 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1833,11 +1833,12 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, else { /* This symbol is local, or marked to become local. */ + outrel.r_addend = relocation + rel->r_addend; + if (r_type == R_68K_32) { relocate = TRUE; outrel.r_info = ELF32_R_INFO (0, R_68K_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; } else { @@ -1854,13 +1855,24 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section, { asection *osec; + /* We are turning this relocation into one + against a section symbol. It would be + proper to subtract the symbol's value, + osec->vma, from the emitted reloc addend, + but ld.so expects buggy relocs. */ osec = sec->output_section; indx = elf_section_data (osec)->dynindx; - BFD_ASSERT (indx > 0); + if (indx == 0) + { + struct elf_link_hash_table *htab; + htab = elf_hash_table (info); + osec = htab->text_index_section; + indx = elf_section_data (osec)->dynindx; + } + BFD_ASSERT (indx != 0); } outrel.r_info = ELF32_R_INFO (indx, r_type); - outrel.r_addend = relocation + rel->r_addend; } } @@ -2418,6 +2430,7 @@ elf_m68k_plt_sym_val (bfd_vma i, const asection *plt, elf_m68k_adjust_dynamic_symbol #define elf_backend_size_dynamic_sections \ elf_m68k_size_dynamic_sections +#define elf_backend_init_index_section _bfd_elf_init_1_index_section #define elf_backend_relocate_section elf_m68k_relocate_section #define elf_backend_finish_dynamic_symbol \ elf_m68k_finish_dynamic_symbol |