public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readelf: Support RELR in -S and -d and output
@ 2021-11-04  8:30 Fangrui Song
  2021-11-06 10:50 ` Alan Modra
  0 siblings, 1 reply; 2+ messages in thread
From: Fangrui Song @ 2021-11-04  8:30 UTC (permalink / raw)
  To: binutils, Alan Modra, Nick Clifton; +Cc: Fangrui Song

readelf -r dumping support is not added in this patch.

bfd/
    * elf.c (_bfd_elf_print_private_bfd_data): Add DT_RELR{,SZ,ENT}.
binutils/
    * readelf.c (get_dynamic_type): Add DT_RELR{,SZ,ENT}.
    (get_section_type_name): Add SHT_RELR.
include/
    * elf/common.h: Add SHT_RELR, DT_RELR{,SZ,ENT}
---
 bfd/elf.c            | 3 +++
 binutils/readelf.c   | 6 ++++++
 include/elf/common.h | 4 ++++
 3 files changed, 13 insertions(+)

diff --git a/bfd/elf.c b/bfd/elf.c
index 4df144b04f0..79231e242bd 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1773,6 +1773,9 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg)
 	    case DT_REL: name = "REL"; break;
 	    case DT_RELSZ: name = "RELSZ"; break;
 	    case DT_RELENT: name = "RELENT"; break;
+	    case DT_RELR: name = "RELR"; break;
+	    case DT_RELRSZ: name = "RELRSZ"; break;
+	    case DT_RELRENT: name = "RELRENT"; break;
 	    case DT_PLTREL: name = "PLTREL"; break;
 	    case DT_DEBUG: name = "DEBUG"; break;
 	    case DT_TEXTREL: name = "TEXTREL"; break;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0fed82b63e3..567f81a7a77 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -2228,6 +2228,9 @@ get_dynamic_type (Filedata * filedata, unsigned long type)
     case DT_REL:	return "REL";
     case DT_RELSZ:	return "RELSZ";
     case DT_RELENT:	return "RELENT";
+    case DT_RELR:	return "RELR";
+    case DT_RELRSZ:	return "RELRSZ";
+    case DT_RELRENT:	return "RELRENT";
     case DT_PLTREL:	return "PLTREL";
     case DT_DEBUG:	return "DEBUG";
     case DT_TEXTREL:	return "TEXTREL";
@@ -4535,6 +4538,7 @@ get_section_type_name (Filedata * filedata, unsigned int sh_type)
     case SHT_SYMTAB:		return "SYMTAB";
     case SHT_STRTAB:		return "STRTAB";
     case SHT_RELA:		return "RELA";
+    case SHT_RELR:		return "RELR";
     case SHT_HASH:		return "HASH";
     case SHT_DYNAMIC:		return "DYNAMIC";
     case SHT_NOTE:		return "NOTE";
@@ -11385,6 +11389,8 @@ the .dynstr section doesn't match the DT_STRTAB and DT_STRSZ tags\n"));
 	case DT_PLTPADSZ:
 	case DT_MOVEENT	:
 	case DT_MOVESZ	:
+	case DT_RELRENT	:
+	case DT_RELRSZ	:
 	case DT_INIT_ARRAYSZ:
 	case DT_FINI_ARRAYSZ:
 	case DT_GNU_CONFLICTSZ:
diff --git a/include/elf/common.h b/include/elf/common.h
index 42dadbb25a2..4da28fa24a4 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -523,6 +523,7 @@
 #define SHT_PREINIT_ARRAY 16		/* Array of ptrs to pre-init funcs */
 #define SHT_GROUP	  17		/* Section contains a section group */
 #define SHT_SYMTAB_SHNDX  18		/* Indices for SHN_XINDEX entries */
+#define SHT_RELR	  19		/* RELR relative relocations */
 
 #define SHT_LOOS	0x60000000	/* First of OS specific semantics */
 #define SHT_HIOS	0x6fffffff	/* Last of OS specific semantics */
@@ -1105,6 +1106,9 @@
 #define DT_PREINIT_ARRAY   32
 #define DT_PREINIT_ARRAYSZ 33
 #define DT_SYMTAB_SHNDX    34
+#define DT_RELRSZ	35
+#define DT_RELR		36
+#define DT_RELRENT	37
 
 /* Note, the Oct 4, 1999 draft of the ELF ABI changed the values
    for DT_LOOS and DT_HIOS.  Some implementations however, use
-- 
2.33.1.1089.g2158813163f-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] readelf: Support RELR in -S and -d and output
  2021-11-04  8:30 [PATCH] readelf: Support RELR in -S and -d and output Fangrui Song
@ 2021-11-06 10:50 ` Alan Modra
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2021-11-06 10:50 UTC (permalink / raw)
  To: Fangrui Song, Cary Coutant; +Cc: binutils, Nick Clifton

On Thu, Nov 04, 2021 at 01:30:12AM -0700, Fangrui Song wrote:
> readelf -r dumping support is not added in this patch.
> 
> bfd/
>     * elf.c (_bfd_elf_print_private_bfd_data): Add DT_RELR{,SZ,ENT}.
> binutils/
>     * readelf.c (get_dynamic_type): Add DT_RELR{,SZ,ENT}.
>     (get_section_type_name): Add SHT_RELR.
> include/
>     * elf/common.h: Add SHT_RELR, DT_RELR{,SZ,ENT}

Applied.  I'm unsure whether the new DT_ and SHT_ values have yet been
accepted into the gABI.  If not, and there's a clash, we may need to
bump the values.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-06 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04  8:30 [PATCH] readelf: Support RELR in -S and -d and output Fangrui Song
2021-11-06 10:50 ` Alan Modra

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).