X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=libctf%2Fctf-link.c;h=31179ae13d7c2f349a6997baf79357bd6f8d86b1;hb=f3f8ece4b1c77c925d1f1566df0bf632790a4d24;hp=28c21132607faa56730a55d866a5f9c8d27790a3;hpb=49ea9b450bb1ca97f6e40c420c8cde5878e11048;p=deliverable%2Fbinutils-gdb.git diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c index 28c2113260..31179ae13d 100644 --- a/libctf/ctf-link.c +++ b/libctf/ctf-link.c @@ -1,5 +1,5 @@ /* CTF linking. - Copyright (C) 2019 Free Software Foundation, Inc. + Copyright (C) 2019-2020 Free Software Foundation, Inc. This file is part of libctf. @@ -348,10 +348,15 @@ ctf_link_one_type (ctf_id_t type, int isroot _libctf_unused_, void *arg_) err = ctf_errno (arg->out_fp); if (err != ECTF_CONFLICT) { - ctf_dprintf ("Cannot link type %lx from archive member %s, input file %s " - "into output link: %s\n", type, arg->arcname, arg->file_name, - ctf_errmsg (err)); - return -1; + if (err != ECTF_NONREPRESENTABLE) + ctf_dprintf ("Cannot link type %lx from archive member %s, input file %s " + "into output link: %s\n", type, arg->arcname, arg->file_name, + ctf_errmsg (err)); + /* We must ignore this problem or we end up losing future types, then + trying to link the variables in, then exploding. Better to link as + much as possible. XXX when we add a proper link warning + infrastructure, we should report the error here! */ + return 0; } ctf_set_errno (arg->out_fp, 0); } @@ -364,6 +369,11 @@ ctf_link_one_type (ctf_id_t type, int isroot _libctf_unused_, void *arg_) return 0; err = ctf_errno (per_cu_out_fp); + if (err != ECTF_NONREPRESENTABLE) + ctf_dprintf ("Cannot link type %lx from CTF archive member %s, input file %s " + "into output per-CU CTF archive member %s: %s: skipped\n", type, + arg->arcname, arg->file_name, arg->arcname, + ctf_errmsg (err)); if (err == ECTF_CONFLICT) /* Conflicts are possible at this stage only if a non-ld user has combined multiple TUs into a single output dictionary. Even in this case we do not @@ -629,7 +639,7 @@ ctf_link_intern_extern_string (void *key _libctf_unused_, void *value, ctf_link_out_string_cb_arg_t *arg = (ctf_link_out_string_cb_arg_t *) arg_; fp->ctf_flags |= LCTF_DIRTY; - if (ctf_str_add_external (fp, arg->str, arg->offset) == NULL) + if (!ctf_str_add_external (fp, arg->str, arg->offset)) arg->err = ENOMEM; } @@ -652,7 +662,7 @@ ctf_link_add_strtab (ctf_file_t *fp, ctf_link_strtab_string_f *add_string, ctf_link_out_string_cb_arg_t iter_arg = { str, offset, 0 }; fp->ctf_flags |= LCTF_DIRTY; - if (ctf_str_add_external (fp, str, offset) == NULL) + if (!ctf_str_add_external (fp, str, offset)) err = ENOMEM; ctf_dynhash_iter (fp->ctf_link_outputs, ctf_link_intern_extern_string, @@ -683,8 +693,7 @@ typedef struct ctf_name_list_accum_cb_arg size_t ndynames; } ctf_name_list_accum_cb_arg_t; -/* Accumulate the names and a count of the names in the link output hash, - and run ctf_update() on them to generate them. */ +/* Accumulate the names and a count of the names in the link output hash. */ static void ctf_accumulate_archive_names (void *key, void *value, void *arg_) { @@ -693,13 +702,6 @@ ctf_accumulate_archive_names (void *key, void *value, void *arg_) char **names; ctf_file_t **files; ctf_name_list_accum_cb_arg_t *arg = (ctf_name_list_accum_cb_arg_t *) arg_; - int err; - - if ((err = ctf_update (fp)) < 0) - { - ctf_set_errno (arg->fp, ctf_errno (fp)); - return; - } if ((names = realloc (arg->names, sizeof (char *) * ++(arg->i))) == NULL) { @@ -778,12 +780,6 @@ ctf_link_write (ctf_file_t *fp, size_t *size, size_t threshold) memset (&arg, 0, sizeof (ctf_name_list_accum_cb_arg_t)); arg.fp = fp; - if (ctf_update (fp) < 0) - { - errloc = "CTF file construction"; - goto err; - } - if (fp->ctf_link_outputs) { ctf_dynhash_iter (fp->ctf_link_outputs, ctf_accumulate_archive_names, &arg);