Bug 28785

Summary: Support SHT_RELR (.relr.dyn) section
Product: gdb Reporter: Joel Brobecker <brobecker>
Component: gdbAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: hjl.tools
Priority: P2    
Version: 11.1   
Target Milestone: 11.2   
Host: Target:
Build: Last reconfirmed:

Description Joel Brobecker 2022-01-16 10:12:20 UTC
PR to document the backport of the following commits, pushed on Jan 10th, 2022:

commit fb0b83d80d11c2501a9262198f26a820b09f5258
Author: Fangrui Song <maskray@google.com>
Date:   Tue Dec 7 18:24:14 2021 -0800

    bfd_section_from_shdr: Support SHT_RELR sections
    
    If a.so contains an SHT_RELR section, objcopy a.so will fail with:
    
        a.so: unknown type [0x13] section `.relr.dyn'
    
    This change allows objcopy to work.
    
    bfd/
        * elf.c (bfd_section_from_shdr): Support SHT_RELR.
    
    (cherry picked from commit a619b58721f0a03fd91c27670d3e4c2fb0d88f1e)

commit 67609c9c701ea8a679d80e3352266b058b184f4b
Author: Fangrui Song <maskray@google.com>
Date:   Tue Nov 16 13:03:57 2021 -0800

    readelf: Support SHT_RELR/DT_RELR for -r
    
    The -r output for SHT_RELR looks like:
    
    Relocation section '.relr.dyn' at offset 0x530 contains 4 entries:
      7 offsets
    00000000000028c0
    00000000000028c8
    0000000000003ad0
    0000000000003ad8
    0000000000003ae0
    0000000000003ae8
    0000000000003af0
    
    For --use-dynamic, the header looks like
    
        'RELR' relocation section at offset 0x530 contains 32 bytes:
    
    include/
        * elf/common.h (DT_ENCODING): Bump to 38.
        * elf/external.h (Elf32_External_Relr): New.
        (Elf64_External_Relr): New.
    
    (cherry picked from commit a7fd11862703e45d2774981a4888bc127d473b06)

commit 1b244ed9d3f4dc3df364bcd65332985ab03de302
Author: Fangrui Song <maskray@google.com>
Date:   Thu Nov 4 01:30:12 2021 -0700

    readelf: Support RELR in -S and -d and output
    
    readelf -r dumping support is not added in this patch.
    
    include/
            * elf/common.h: Add SHT_RELR, DT_RELR{,SZ,ENT}
    bfd/
            * elf.c (_bfd_elf_print_private_bfd_data): Add DT_RELR{,SZ,ENT}.
    
    (cherry picked from commit dd207c1302d28d2d2b33cff058bb3fbf5138b480)
Comment 1 Joel Brobecker 2022-01-16 10:14:51 UTC
backports completed on Jan 10th.
Comment 2 H.J. Lu 2022-01-16 13:29:50 UTC
Dup

*** This bug has been marked as a duplicate of bug 28758 ***