When --no-keep-memory is enabled, mipstx39-elf reports: FAIL: MIPS eh-frame 3 due to this code in bfd/elfxx-mips.c:_bfd_mips_elf_eh_frame_address_size to fail: if (sec->reloc_count > 0 && elf_section_data (sec)->relocs != NULL && (ELF32_R_TYPE (elf_section_data (sec)->relocs[0].r_info) == R_MIPS_64)) return 8; elf_section_data (sec)->relocs is NULL with --no-keep-memory.
Created attachment 15390 [details] A patch Please feel free to take over this patch.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=33c58f484406bd9665e5bd15637600540157f612 commit 33c58f484406bd9665e5bd15637600540157f612 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Mar 7 08:28:29 2024 -0800 PR31458, FAIL: MIPS eh-frame 3 with --no-keep-memory PR 31458 bfd/ * elf-bfd.h (_bfd_elf_link_read_relocs), (_bfd_elf_link_info_read_relocs): Constify section. * elflink.c: Likewise. * elfxx-mips.c (_bfd_mips_elf_eh_frame_address_size): Read relocs again in case --no-keep-memory. ld/ * testsuite/ld-mips-elf/mips-elf.exp: Run --no-keep-memory version of eh-frame3 test.
Patch with some tidies applied.