public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Add support for %x and %lx formats to the linker's vinfo() function.
@ 2023-04-27 12:02 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2023-04-27 12:02 UTC (permalink / raw)
  To: bfd-cvs

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

commit c386bf4df5c4a6548278c5a03fc6a790da2e2bd4
Author: Nick Clifton <nickc@redhat.com>
Date:   Thu Apr 27 13:02:00 2023 +0100

    Add support for %x and %lx formats to the linker's vinfo() function.

Diff:
---
 ld/ChangeLog |  4 ++++
 ld/ldmisc.c  | 18 +++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index c4de3276784..f941b138c17 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2023-04-27  Nick Clifton  <nickc@redhat.com>
+
+	* ldmisc.c (vfinfo): Add support for %x and %lx.
+
 2023-04-18  mengqinggang  <mengqinggang@loongson.cn>
 
 	* testsuite/ld-loongarch-elf/macro_op.d: Regenerated.
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 5d7012e50b1..ef46ad665e9 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -52,6 +52,7 @@
  %d integer, like printf
  %ld long, like printf
  %lu unsigned long, like printf
+ %lx unsigned long, like printf
  %p native (host) void* pointer, like printf
  %pA section name from a section
  %pB filename from a bfd
@@ -63,6 +64,7 @@
  %s arbitrary string, like printf
  %u integer, like printf
  %v hex bfd_vma, no leading zeros
+ %x integer, like printf
 */
 
 void
@@ -152,11 +154,12 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bool is_warning)
 
 	    case 'd':
 	    case 'u':
+	    case 'x':
 	      arg_type = Int;
 	      break;
 
 	    case 'l':
-	      if (*scan == 'd' || *scan == 'u')
+	      if (*scan == 'd' || *scan == 'u' || *scan == 'x')
 		{
 		  ++scan;
 		  arg_type = Long;
@@ -544,6 +547,12 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bool is_warning)
 	      ++arg_count;
 	      break;
 
+	    case 'x':
+	      /* unsigned integer, like printf */
+	      fprintf (fp, "%x", args[arg_no].i);
+	      ++arg_count;
+	      break;
+
 	    case 'l':
 	      if (*fmt == 'd')
 		{
@@ -559,6 +568,13 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bool is_warning)
 		  ++fmt;
 		  break;
 		}
+	      else if (*fmt == 'x')
+		{
+		  fprintf (fp, "%lx", args[arg_no].l);
+		  ++arg_count;
+		  ++fmt;
+		  break;
+		}
 	      /* Fallthru */
 
 	    default:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-27 12:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-27 12:02 [binutils-gdb] Add support for %x and %lx formats to the linker's vinfo() function Nick Clifton

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