diff options
Diffstat (limited to 'bfd/elf32-avr.c')
-rw-r--r-- | bfd/elf32-avr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c index 18f2b953d8e..33d52269fd8 100644 --- a/bfd/elf32-avr.c +++ b/bfd/elf32-avr.c @@ -1153,9 +1153,6 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, Elf_Internal_Rela * relend; struct elf32_avr_link_hash_table * htab = avr_link_hash_table (info); - if (info == NULL || info->relocatable) - return TRUE; - symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr; sym_hashes = elf_sym_hashes (input_bfd); relend = relocs + input_section->reloc_count; @@ -1172,7 +1169,6 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, const char * name; int r_type; - /* This is a final link. */ r_type = ELF32_R_TYPE (rel->r_info); r_symndx = ELF32_R_SYM (rel->r_info); howto = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info); @@ -1202,6 +1198,20 @@ elf32_avr_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED, name = h->root.root.string; } + if (sec != NULL && elf_discarded_section (sec)) + { + /* For relocs against symbols from removed linkonce sections, + or sections discarded by a linker script, we just want the + section contents zeroed. Avoid any special processing. */ + _bfd_clear_contents (howto, input_bfd, contents + rel->r_offset); + rel->r_info = 0; + rel->r_addend = 0; + continue; + } + + if (info->relocatable) + continue; + r = avr_final_link_relocate (howto, input_bfd, input_section, contents, rel, relocation, htab); |