[PATCH 1/2] LD: Add new %pU vfinfo format for printing linker script name
Jozef Lawrynowicz
jozef.l@mittosystems.com
Fri Aug 7 12:13:22 GMT 2020
The %pT vfinfo format prints the linker script name with a line number,
however sometimes it may be necessary to print the linker script name
without any associated line number.
-------------- next part --------------
>From 1302861f0efa6e811fe8185960fd2a58178c6659 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
Date: Fri, 7 Aug 2020 12:56:44 +0100
Subject: [PATCH 1/2] LD: Add new %pU vfinfo format for printing linker script
name
The %pT vfinfo format prints the linker script name with a line number,
however sometimes it may be necessary to print the linker script name
without any associated line number.
ld/ChangeLog:
* ldmisc.c (vfinfo): Support new "%pU" format specifier.
---
ld/ldmisc.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 418e8d5c6ed..1ca2a70da4c 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -59,6 +59,7 @@
%pR info about a relent
%pS print script file and linenumber from etree_type.
%pT symbol name
+ %pU print script file without linenumber from etree_type.
%s arbitrary string, like printf
%u integer, like printf
%v hex bfd_vma, no leading zeros
@@ -483,9 +484,10 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
relent->addend,
relent->howto->name);
}
- else if (*fmt == 'S')
+ else if (*fmt == 'S' || *fmt == 'U')
{
- /* Print script file and linenumber. */
+ /* Print script file and perhaps the associated
+ linenumber. */
etree_type node;
etree_type *tp = (etree_type *) args[arg_no].p;
@@ -497,8 +499,10 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
tp->type.filename = ldlex_filename ();
tp->type.lineno = lineno;
}
- if (tp->type.filename != NULL)
+ if (tp->type.filename != NULL && fmt[-1] == 'S')
fprintf (fp, "%s:%u", tp->type.filename, tp->type.lineno);
+ else if (tp->type.filename != NULL && fmt[-1] == 'U')
+ fprintf (fp, "%s", tp->type.filename);
}
else if (*fmt == 'T')
{
--
2.27.0
More information about the Binutils
mailing list