diff options
Diffstat (limited to 'bfd/elf64-x86-64.c')
-rw-r--r-- | bfd/elf64-x86-64.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index b9b3cf8..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; @@ -6136,13 +6132,14 @@ elf_x86_64_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, static bool elf_x86_64_copy_private_section_data (bfd *ibfd, asection *isec, - bfd *obfd, asection *osec) + bfd *obfd, asection *osec, + struct bfd_link_info *link_info) { - if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec)) + if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec, link_info)) return false; /* objcopy --set-section-flags without "large" drops SHF_X86_64_LARGE. */ - if (ibfd != obfd) + if (link_info == NULL && ibfd != obfd) elf_section_flags (osec) &= ~SHF_X86_64_LARGE; return true; |