diff options
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index c40a0c5..b6f97b5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3268,10 +3268,14 @@ elf_x86_64_relocate_section (bfd *output_bfd, wrel->r_addend = 0; /* For ld -r, remove relocations in debug sections against - sections defined in discarded sections. Not done for - eh_frame editing code expects to be present. */ + sections defined in discarded sections, including sframe + sections. Not done for eh_frame editing code expects to + be present. NB: Since sframe code keeps R_X86_64_NONE + reloc as is, its r_offset is wrong, we must not generate + R_X86_64_NONE reloc in sframe section. */ if (bfd_link_relocatable (info) - && (input_section->flags & SEC_DEBUGGING)) + && ((input_section->flags & SEC_DEBUGGING) != 0 + || elf_section_type (input_section) == SHT_GNU_SFRAME)) wrel--; continue; @@ -5095,14 +5099,6 @@ elf_x86_64_relocate_section (bfd *output_bfd, rel_hdr = _bfd_elf_single_rel_hdr (input_section->output_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; - if (rel_hdr->sh_size == 0) - { - /* It is too late to remove an empty reloc section. Leave - one NONE reloc. - ??? What is wrong with an empty section??? */ - rel_hdr->sh_size = rel_hdr->sh_entsize; - deleted -= 1; - } rel_hdr = _bfd_elf_single_rel_hdr (input_section); rel_hdr->sh_size -= rel_hdr->sh_entsize * deleted; input_section->reloc_count -= deleted; |