public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Omar Sandoval <osandov@osandov.com>
Subject: Re: [PATCHv2] libelf, readelf, elflint: Add RELR support
Date: Tue, 29 Aug 2023 12:55:52 +0200	[thread overview]
Message-ID: <e568979a9d4f0fcaa8725b88d29a7cc5f5bc2d79.camel@klomp.org> (raw)
In-Reply-To: <20230824233355.2034723-1-mark@klomp.org>

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
> 
> 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.
> 
> Also add a test to check that gelf.h works with the system elf.h.
> 
> 	* 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.
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=28495
> 
> Signed-off-by: Mark Wielaard <mark@klomp.org>
> ---
> 
> 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

      reply	other threads:[~2023-08-29 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 23:33 Mark Wielaard
2023-08-29 10:55 ` Mark Wielaard [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e568979a9d4f0fcaa8725b88d29a7cc5f5bc2d79.camel@klomp.org \
    --to=mark@klomp.org \
    --cc=elfutils-devel@sourceware.org \
    --cc=osandov@osandov.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).