LoongArch: Fix relaxation alignment with ld -r (PR 33236) 33236)
Alan Modra
amodra@gmail.com
Tue Jul 7 01:43:33 GMT 2026
Correct sh_size and sh_entsize to use external reloc size.
loongarch32-elf +FAIL: Linkonce sections with assembler generated notes
loongarch32-elf +FAIL: ld-loongarch-elf/relax-align-ld-r
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index f4d8d32ff2f..11008133255 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -7096,8 +7096,8 @@ loongarch_add_align_relocs (asection *align_sec, bfd* align_bfd)
if (rela_hdr == NULL)
return false;
- rela_hdr->sh_size = sizeof (Elf_Internal_Rela);
- rela_hdr->sh_entsize = sizeof (Elf_Internal_Rela);
+ rela_hdr->sh_size = sizeof (ElfNN_External_Rela);
+ rela_hdr->sh_entsize = sizeof (ElfNN_External_Rela);
rela_hdr->sh_type = SHT_RELA;
rela_hdr->sh_addralign = (bfd_vma) 1 << bed->s->log_file_align;
elf_section_data (align_sec)->rela.hdr = rela_hdr;
--
Alan Modra
More information about the Binutils
mailing list