From 90d470c102e6f79a8625df90706109849404d86c Mon Sep 17 00:00:00 2001 From: Thorsten Otto Date: Tue, 26 Sep 2023 15:15:24 +0200 Subject: [PATCH] Fix m68k_elf32_atariprg_relocate_section We must use _bfd_elf_section_offset to compute the real section offset. This is needed especially for .eh_frame sections, which might have parts of its contents merged. --- bfd/elf32-atariprg.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bfd/elf32-atariprg.c b/bfd/elf32-atariprg.c index 680e764460e..5eebefc06b3 100644 --- a/bfd/elf32-atariprg.c +++ b/bfd/elf32-atariprg.c @@ -426,9 +426,13 @@ m68k_elf32_atariprg_relocate_section (bfd *output_bfd, case R_68K_32: { /* Absolute 32-bit address. */ - bfd_vma relocation = input_section->output_section->vma + input_section->output_offset + rel->r_offset; - if (! add_tpa_relocation_entry (output_bfd, input_bfd, relocation)) - return false; + bfd_vma offset = _bfd_elf_section_offset(output_bfd, info, input_section, rel->r_offset); + if (offset != (bfd_vma) -1 && offset != (bfd_vma) -2) + { + bfd_vma relocation = input_section->output_section->vma + input_section->output_offset + offset; + if (! add_tpa_relocation_entry (output_bfd, input_bfd, relocation)) + return false; + } } break;