aboutsummaryrefslogtreecommitdiff
path: root/binutils/readelf.c
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r--binutils/readelf.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 7f228f1..c5796e8 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -14237,6 +14237,26 @@ dump_ctf_indent_lines (ctf_sect_names_t sect ATTRIBUTE_UNUSED,
return new_s;
}
+/* Dump CTF errors/warnings. */
+static void
+dump_ctf_errs (ctf_file_t *fp)
+{
+ ctf_next_t *it = NULL;
+ char *errtext;
+ int is_warning;
+ int err;
+
+ /* Dump accumulated errors and warnings. */
+ while ((errtext = ctf_errwarning_next (fp, &it, &is_warning, &err)) != NULL)
+ {
+ error (_("%s: `%s'"), is_warning ? _("warning"): _("error"),
+ errtext);
+ free (errtext);
+ }
+ if (err != ECTF_NEXT_END)
+ error (_("CTF error: cannot get CTF errors: `%s'"), ctf_errmsg (err));
+}
+
/* Dump one CTF archive member. */
static int
@@ -14247,9 +14267,6 @@ dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
"Function objects", "Variables", "Types", "Strings",
""};
const char **thing;
- ctf_next_t *it = NULL;
- char *errtext;
- int is_warning;
size_t i;
int err = 0;
@@ -14290,18 +14307,7 @@ dump_ctf_archive_member (ctf_file_t *ctf, const char *name, void *arg)
}
out:
- /* Dump accumulated errors and warnings. */
- while ((errtext = ctf_errwarning_next (ctf, &it, &is_warning)) != NULL)
- {
- error (_("%s: `%s'\n"), is_warning ? _("warning"): _("error"),
- errtext);
- free (errtext);
- }
- if (ctf_errno (ctf) != ECTF_NEXT_END)
- {
- error (_("CTF error: cannot get CTF errors: `%s'\n"),
- ctf_errmsg (ctf_errno (ctf)));
- }
+ dump_ctf_errs (ctf);
return err;
}
@@ -14388,6 +14394,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
if ((ctfa = ctf_arc_bufopen (&ctfsect, symsectp, strsectp, &err)) == NULL)
{
+ dump_ctf_errs (NULL);
error (_("CTF open failure: %s\n"), ctf_errmsg (err));
goto fail;
}
@@ -14397,6 +14404,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
if ((parenta = ctf_arc_bufopen (&parentsect, symsectp, strsectp,
&err)) == NULL)
{
+ dump_ctf_errs (NULL);
error (_("CTF open failure: %s\n"), ctf_errmsg (err));
goto fail;
}
@@ -14410,6 +14418,7 @@ dump_section_as_ctf (Elf_Internal_Shdr * section, Filedata * filedata)
put CTFs and their parents in archives together.) */
if ((parent = ctf_arc_open_by_name (lookparent, NULL, &err)) == NULL)
{
+ dump_ctf_errs (NULL);
error (_("CTF open failure: %s\n"), ctf_errmsg (err));
goto fail;
}