aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2023-04-27 13:02:00 +0100
committerNick Clifton <nickc@redhat.com>2023-04-27 13:02:00 +0100
commitc386bf4df5c4a6548278c5a03fc6a790da2e2bd4 (patch)
tree110b984b0dfb5e9659418d92ce10801b3b0f48f5
parent0bda45b270245dd5cf7effec0053cf893ab6e98f (diff)
downloadgdb-c386bf4df5c4a6548278c5a03fc6a790da2e2bd4.zip
gdb-c386bf4df5c4a6548278c5a03fc6a790da2e2bd4.tar.gz
gdb-c386bf4df5c4a6548278c5a03fc6a790da2e2bd4.tar.bz2
Add support for %x and %lx formats to the linker's vinfo() function.
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/ldmisc.c18
2 files changed, 21 insertions, 1 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index c4de327..f941b13 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 5d7012e..ef46ad6 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: