From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 7E99F3858D20 for ; Tue, 29 Aug 2023 10:55:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7E99F3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id F3ACB3000593; Tue, 29 Aug 2023 12:55:52 +0200 (CEST) Received: by r6.localdomain (Postfix, from userid 1000) id AD6083403BF; Tue, 29 Aug 2023 12:55:52 +0200 (CEST) Message-ID: Subject: Re: [PATCHv2] libelf, readelf, elflint: Add RELR support From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Omar Sandoval Date: Tue, 29 Aug 2023 12:55:52 +0200 In-Reply-To: <20230824233355.2034723-1-mark@klomp.org> References: <20230824233355.2034723-1-mark@klomp.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) MIME-Version: 1.0 X-Spam-Status: No, score=-3027.5 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Fri, 2023-08-25 at 01:33 +0200, Mark Wielaard wrote: > Handle RELR as defined here: > https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/YT2RrjpMAwAJ >=20 > Introduce new ELF_T_RELR Elf_Type and handle it for SHT_RELR. Check > various properties in elflint. Print RELR relocations in > readelf. Just the entries with -U. Just the addresses with -N. And > addresses plus symbol/offsets by default. >=20 > Also add a test to check that gelf.h works with the system elf.h. >=20 > * libebl/eblsectiontypename.c (ebl_section_type_name): Add RELR > to knownstype. > * libelf/elf32_updatenull.c (updatenull_wrlock): Handle > sh_entsize for SHT_RELR. > * libelf/gelf.h (GElf_Relr): New typedef for Elf64_Relr. > * libelf/gelf_fsize.c (__libelf_type_sizes): Add ELF_T_RELR. > * libelf/gelf_xlate.c (__elf_xfctstom): Likewise. > * libelf/gelf_xlate.h: Add RELR as FUNDAMENTAL. > * libelf/libelf.h (Elf_Type): Add ELF_T_RELR. Add RELR > defines/typedefs if undefined in system elf.h. > * libelf/libelfP.h: Define ELF32_FSZ_RELR and ELF64_FSZ_RELR. > * src/elflint.c (check_reloc_shdr): Check she_entsize for > ELF_T_RELR. > (check_relr): New function. > (check_dynamic): Handle DT_RELR. > (special_sections): Add SHT_RELR. > (check_sections): Call check_relr. > * src/readelf.c (print_relocs): Also accept a Dwfl_Module. > (handle_relocs_relr): New function. > (print_dwarf_addr): Make static and declare early. > (process_elf_file): Pass dwflmod to print_relocs. > (handle_dynamic): Handle DT_RELRSZ and DTRELRENT. > * system-elf-gelf-test.c: New test. > * Makefile.am (TESTS): Add system-elf-gelf-test. > (check_PROGRAMS): Likewise. > (system_elf_gelf_test_CPPFLAGS): New variable. > (system_elf_gelf_test_LDADD): Likewise. >=20 > https://sourceware.org/bugzilla/show_bug.cgi?id=3D28495 >=20 > Signed-off-by: Mark Wielaard > --- >=20 > v2 > - Fix GElf_Relr typedef name > - Add RELR typedefs/defines if missing from system elf.h > - Add a system-elf-gelf-test I pushed this variant. The same, minus the new testcase has also been backported to Fedora rawhide. Cheers, Mark