[PATCH v3 0/6] elf: Use mmap to map in section contents

H.J. Lu hjl.tools@gmail.com
Wed Mar 6 23:26:43 GMT 2024


On Wed, Mar 6, 2024 at 3:00 PM Alan Modra <amodra@gmail.com> wrote:
>
> On Wed, Mar 06, 2024 at 12:47:25PM -0800, H.J. Lu wrote:
> > Changes in v3:
>
> I ran my target tests against this version and found two regressions.
> mipsisa32r2el-elf  +FAIL: MIPS eh-frame 3
> mipstx39-elf  +FAIL: MIPS eh-frame 3
>
> The keep_memory change causes 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;
>
> Yes, the test also fails with --no-keep-memory so this is really a bug
> in the mips backend, but we should try to not break this code.
>

I changed it to

bool
_bfd_elf_link_keep_memory (struct bfd_link_info *info)
{
#ifdef USE_MMAP
  /* Don't cache symbol nor relocation tables if they are mapped in.
     NB: Since the --no-keep-memory linker option causes

     FAIL: MIPS eh-frame 3

     in the linker testsuite for mipsisa32r2el-elf target, this is
     opt-in by each backend.  */
  const struct elf_backend_data *bed
    = get_elf_backend_data (info->output_bfd);
  if (bed->use_mmap)
    return false;
#endif

The v4 patch is at

https://patchwork.sourceware.org/project/binutils/list/?series=31668

-- 
H.J.


More information about the Binutils mailing list