aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2020-08-28 13:56:53 +0100
committerJozef Lawrynowicz <jozef.l@mittosystems.com>2020-08-28 14:00:54 +0100
commit87870682f3a7fc29208026dfa4aac75b195cc990 (patch)
treeb9c35bab5772a82efe08c23496d6c50646edaedd /ld
parent7ca371dba5d612ff1cdaa4ffe33474c1993fbe7f (diff)
downloadfsf-binutils-gdb-87870682f3a7fc29208026dfa4aac75b195cc990.zip
fsf-binutils-gdb-87870682f3a7fc29208026dfa4aac75b195cc990.tar.gz
fsf-binutils-gdb-87870682f3a7fc29208026dfa4aac75b195cc990.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/ldmisc.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 16274e8..e2ca7f0 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2020-08-28 Jozef Lawrynowicz <jozef.l@mittosystems.com>
+
+ * ldmisc.c (vfinfo): Support new "%pU" format specifier.
+
2020-08-28 Cooper Qu <cooper.qu@linux.alibaba.com>
* emulparams/cskyelf.sh: Support attribute section.
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index 418e8d5..9074a83 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,9 @@ 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 +498,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')
{