public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] Simplify readelf's RELR relocation display.
Date: Tue, 16 Apr 2024 12:18:05 +0000 (GMT)	[thread overview]
Message-ID: <20240416121805.D3C433858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=21061c384c510e13b56c3991adf31ad85e80a824

commit 21061c384c510e13b56c3991adf31ad85e80a824
Author: Fangrui Song <i@maskray.me>
Date:   Tue Apr 16 13:17:35 2024 +0100

    Simplify readelf's RELR relocation display.

Diff:
---
 binutils/readelf.c                        | 20 +++-----------------
 ld/testsuite/ld-elf/dt-relr-2b.d          |  4 ++--
 ld/testsuite/ld-elf/dt-relr-2c.d          |  4 ++--
 ld/testsuite/ld-elf/dt-relr-2d.d          |  4 ++--
 ld/testsuite/ld-elf/dt-relr-2e.d          |  4 ++--
 ld/testsuite/ld-elf/dt-relr-2i.d          |  4 ++--
 ld/testsuite/ld-i386/dt-relr-1a.d         |  4 ++--
 ld/testsuite/ld-i386/dt-relr-1b.d         |  4 ++--
 ld/testsuite/ld-powerpc/abs-pie-relr.r    |  4 ++--
 ld/testsuite/ld-powerpc/abs-shared-relr.r |  4 ++--
 ld/testsuite/ld-x86-64/dt-relr-1a-x32.d   |  4 ++--
 ld/testsuite/ld-x86-64/dt-relr-1a.d       |  4 ++--
 ld/testsuite/ld-x86-64/dt-relr-1b-x32.d   |  4 ++--
 ld/testsuite/ld-x86-64/dt-relr-1b.d       |  4 ++--
 14 files changed, 29 insertions(+), 43 deletions(-)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index fcf95ee3047..e0cf718aa28 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -1665,20 +1665,10 @@ dump_relr_relocations (Filedata *          filedata,
      be used later on for some other purpose.  */
   qsort (symtab, nsyms, sizeof (Elf_Internal_Sym), symcmp);
 
-  if (do_wide)
-    {
-      if (relr_entsize == 4)
-	printf (_("Index: Entry:   Address  Symbolic Address     Notes\n"));
-      else
-	printf (_("Index: Entry:           Address relocated Symbolic Address        Notes\n"));
-    }
+  if (relr_entsize == 4)
+    printf (_ ("Index: Entry    Address   Symbolic Address\n"));
   else
-    {
-      if (relr_entsize == 4)
-	printf (_("Index: Entry:   Address  Symbolic Address\n"));
-      else
-	printf (_("Index: Entry:           Address relocated Symbolic Address\n"));
-    }
+    printf (_ ("Index: Entry            Address           Symbolic Address\n"));
 
   for (i = 0; i < nentries; i++)
     {
@@ -1698,8 +1688,6 @@ dump_relr_relocations (Filedata *          filedata,
 	{
 	  where = entry;
 	  print_relr_addr_and_sym (symtab, nsyms, strtab, strtablen, where);
-	  if (do_wide)
-	    printf (_(" (new starting address)"));
 	  printf ("\n");
 	  where += relr_entsize;
 	}
@@ -1722,8 +1710,6 @@ dump_relr_relocations (Filedata *          filedata,
 		if (first)
 		  {
 		    print_relr_addr_and_sym (symtab, nsyms, strtab, strtablen, addr);
-		    if (do_wide)
-		      printf (_(" (start of bitmap)"));
 		    first = false;
 		  }
 		else
diff --git a/ld/testsuite/ld-elf/dt-relr-2b.d b/ld/testsuite/ld-elf/dt-relr-2b.d
index 48a3eb7f15c..f9c688087f9 100644
--- a/ld/testsuite/ld-elf/dt-relr-2b.d
+++ b/ld/testsuite/ld-elf/dt-relr-2b.d
@@ -14,8 +14,8 @@ Relocation section '\.rel(a|)\.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
 #...
 Relocation section '\.relr\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +data \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+ \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +data
+0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
 #pass
diff --git a/ld/testsuite/ld-elf/dt-relr-2c.d b/ld/testsuite/ld-elf/dt-relr-2c.d
index 7f6383b0184..d9e3698a8f0 100644
--- a/ld/testsuite/ld-elf/dt-relr-2c.d
+++ b/ld/testsuite/ld-elf/dt-relr-2c.d
@@ -14,7 +14,7 @@ Relocation section '\.rel(a|)\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
 Relocation section '\.relr\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #pass
diff --git a/ld/testsuite/ld-elf/dt-relr-2d.d b/ld/testsuite/ld-elf/dt-relr-2d.d
index f1184fefeb2..69863bddec4 100644
--- a/ld/testsuite/ld-elf/dt-relr-2d.d
+++ b/ld/testsuite/ld-elf/dt-relr-2d.d
@@ -14,8 +14,8 @@ Relocation section '\.rel(a|)\.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
 #...
 Relocation section '\.relr\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +data \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+ \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +data
+0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
 #pass
diff --git a/ld/testsuite/ld-elf/dt-relr-2e.d b/ld/testsuite/ld-elf/dt-relr-2e.d
index eddb5e3d14e..e047c0d6529 100644
--- a/ld/testsuite/ld-elf/dt-relr-2e.d
+++ b/ld/testsuite/ld-elf/dt-relr-2e.d
@@ -14,8 +14,8 @@ Relocation section '\.rel(a|)\.data' at offset 0x[0-9a-f]+ contains 1 entry:
 #...
 Relocation section '\.relr\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +data \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+ \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +data
+0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
 #pass
diff --git a/ld/testsuite/ld-elf/dt-relr-2i.d b/ld/testsuite/ld-elf/dt-relr-2i.d
index 55e8c256b92..a328ccb92e5 100644
--- a/ld/testsuite/ld-elf/dt-relr-2i.d
+++ b/ld/testsuite/ld-elf/dt-relr-2i.d
@@ -14,8 +14,8 @@ Relocation section '\.rel(a|)\.dyn' at offset 0x[0-9a-f]+ contains 1 entry:
 #...
 Relocation section '\.relr\.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +data \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+ \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +data
+0001: +[0-9a-f]+ [0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
  +[0-9a-f]+ +data \+ 0x[0-9a-f]+
 #pass
diff --git a/ld/testsuite/ld-i386/dt-relr-1a.d b/ld/testsuite/ld-i386/dt-relr-1a.d
index 3944911e4f7..89cc636f4bc 100644
--- a/ld/testsuite/ld-i386/dt-relr-1a.d
+++ b/ld/testsuite/ld-i386/dt-relr-1a.d
@@ -15,8 +15,8 @@ Relocation section '\.rel\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-i386/dt-relr-1b.d b/ld/testsuite/ld-i386/dt-relr-1b.d
index 947d8354b23..6e7f3ca0a25 100644
--- a/ld/testsuite/ld-i386/dt-relr-1b.d
+++ b/ld/testsuite/ld-i386/dt-relr-1b.d
@@ -18,8 +18,8 @@ Relocation section '\.rel\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-powerpc/abs-pie-relr.r b/ld/testsuite/ld-powerpc/abs-pie-relr.r
index 049cd7aa983..e84b0af115b 100644
--- a/ld/testsuite/ld-powerpc/abs-pie-relr.r
+++ b/ld/testsuite/ld-powerpc/abs-pie-relr.r
@@ -4,5 +4,5 @@
 #readelf: -rW
 
 Relocation section '\.relr\.dyn' at offset .* contains 1 entry:
-Index: Entry: +Address relocated Symbolic Address +Notes
-0000: +[0-9a-f]+ [0-9a-f]+ +x \(new starting address\)
+Index: Entry            Address           Symbolic Address
+0000: +[0-9a-f]+ [0-9a-f]+ +x
diff --git a/ld/testsuite/ld-powerpc/abs-shared-relr.r b/ld/testsuite/ld-powerpc/abs-shared-relr.r
index 3ce70f740e2..ce1a7eee339 100644
--- a/ld/testsuite/ld-powerpc/abs-shared-relr.r
+++ b/ld/testsuite/ld-powerpc/abs-shared-relr.r
@@ -13,6 +13,6 @@ Relocation section '\.rela\.dyn' at offset .* contains 6 entries:
 0+10450  0+400000026 R_PPC64_ADDR64         123456789abcdef0 c \+ 0
 
 Relocation section '\.relr\.dyn' at offset .* contains 1 entry:
-Index: Entry: +Address relocated Symbolic Address +Notes
-0000: +[0-9a-f]+ [0-9a-f]+ +x \(new starting address\)
+Index: Entry            Address           Symbolic Address
+0000: +[0-9a-f]+ [0-9a-f]+ +x
 
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1a-x32.d b/ld/testsuite/ld-x86-64/dt-relr-1a-x32.d
index 78ffda9ce15..863e97a7980 100644
--- a/ld/testsuite/ld-x86-64/dt-relr-1a-x32.d
+++ b/ld/testsuite/ld-x86-64/dt-relr-1a-x32.d
@@ -15,8 +15,8 @@ Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1a.d b/ld/testsuite/ld-x86-64/dt-relr-1a.d
index 8e099257037..30af87535c9 100644
--- a/ld/testsuite/ld-x86-64/dt-relr-1a.d
+++ b/ld/testsuite/ld-x86-64/dt-relr-1a.d
@@ -15,8 +15,8 @@ Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1b-x32.d b/ld/testsuite/ld-x86-64/dt-relr-1b-x32.d
index c2e3a3a931f..3c37bcd5358 100644
--- a/ld/testsuite/ld-x86-64/dt-relr-1b-x32.d
+++ b/ld/testsuite/ld-x86-64/dt-relr-1b-x32.d
@@ -18,8 +18,8 @@ Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:
diff --git a/ld/testsuite/ld-x86-64/dt-relr-1b.d b/ld/testsuite/ld-x86-64/dt-relr-1b.d
index 03e0202fe81..bc07cf89b26 100644
--- a/ld/testsuite/ld-x86-64/dt-relr-1b.d
+++ b/ld/testsuite/ld-x86-64/dt-relr-1b.d
@@ -18,8 +18,8 @@ Relocation section '.rela.plt' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.relr.dyn' at offset 0x[a-f0-9]+ contains 2 entries:
 #...
-0000: +[0-9a-f]+ [0-9a-f]+ +.* \(new starting address\)
-0001: +[0-9a-f]+ [0-9a-f]+ +.* \(start of bitmap\)
+0000: +[0-9a-f]+ [0-9a-f]+ +.*
+0001: +[0-9a-f]+ [0-9a-f]+ +.*
  +[0-9a-f]+ +.*
 #...
 Symbol table '.symtab' contains [0-9]+ entries:

                 reply	other threads:[~2024-04-16 12:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240416121805.D3C433858D35@sourceware.org \
    --to=nickc@sourceware.org \
    --cc=binutils-cvs@sourceware.org \
    /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).