return ctf_link_add (fp, ctf, name, NULL, 0);
}
+/* Lazily open a CTF archive for linking, if not already open.
+
+ Returns the number of files contained within the opened archive (0 for none),
+ or -1 on error, as usual. */
+static ssize_t
+ctf_link_lazy_open (ctf_dict_t *fp, ctf_link_input_t *input)
+{
+ size_t count;
+ int err;
+
+ if (input->clin_arc)
+ return ctf_archive_count (input->clin_arc);
+
+ if (input->clin_fp)
+ return 1;
+
+ /* See ctf_link_add_ctf. */
+#if defined (PIC) || !NOBFD
+ input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
+#else
+ ctf_err_warn (fp, 0, ECTF_NEEDSBFD, _("cannot open %s lazily"),
+ input->clin_filename);
+ ctf_set_errno (fp, ECTF_NEEDSBFD);
+ return -1;
+#endif
+
+ /* Having no CTF sections is not an error. We just don't need to do
+ anything. */
+
+ if (!input->clin_arc)
+ {
+ if (err == ECTF_NOCTFDATA)
+ return 0;
+
+ ctf_err_warn (fp, 0, err, _("opening CTF %s failed"),
+ input->clin_filename);
+ ctf_set_errno (fp, err);
+ return -1;
+ }
+
+ if ((count = ctf_archive_count (input->clin_arc)) == 0)
+ ctf_arc_close (input->clin_arc);
+
+ return (ssize_t) count;
+}
+
/* Return a per-CU output CTF dictionary suitable for the given CU, creating and
interning it if need be. */
return 0;
}
-/* Lazily open a CTF archive for linking, if not already open.
-
- Returns the number of files contained within the opened archive (0 for none),
- or -1 on error, as usual. */
-static ssize_t
-ctf_link_lazy_open (ctf_dict_t *fp, ctf_link_input_t *input)
-{
- size_t count;
- int err;
-
- if (input->clin_arc)
- return ctf_archive_count (input->clin_arc);
-
- if (input->clin_fp)
- return 1;
-
- /* See ctf_link_add_ctf. */
-#if defined (PIC) || !NOBFD
- input->clin_arc = ctf_open (input->clin_filename, NULL, &err);
-#else
- ctf_err_warn (fp, 0, ECTF_NEEDSBFD, _("cannot open %s lazily"),
- input->clin_filename);
- ctf_set_errno (fp, ECTF_NEEDSBFD);
- return -1;
-#endif
-
- /* Having no CTF sections is not an error. We just don't need to do
- anything. */
-
- if (!input->clin_arc)
- {
- if (err == ECTF_NOCTFDATA)
- return 0;
-
- ctf_err_warn (fp, 0, err, _("opening CTF %s failed"),
- input->clin_filename);
- ctf_set_errno (fp, err);
- return -1;
- }
-
- if ((count = ctf_archive_count (input->clin_arc)) == 0)
- ctf_arc_close (input->clin_arc);
-
- return (ssize_t) count;
-}
-
typedef struct link_sort_inputs_cb_arg
{
int is_cu_mapped;
cache->ctf_symhash_latest) < 0)
goto oom;
if (strcmp (sym.st_name, symname) == 0)
- return cache->ctf_symhash_latest++;
- }
- break;
+ return cache->ctf_symhash_latest++;
+ }
+ break;
case sizeof (Elf32_Sym):
{
Elf32_Sym *symp = (Elf32_Sym *) sp->cts_data;
cache->ctf_symhash_latest) < 0)
goto oom;
if (strcmp (sym.st_name, symname) == 0)
- return cache->ctf_symhash_latest++;
- }
+ return cache->ctf_symhash_latest++;
+ }
break;
default:
ctf_set_errno (fp, ECTF_SYMTAB);
if (symidx > fp->ctf_dynsymmax)
goto try_parent;
- sym = fp->ctf_dynsymidx[symidx];
+ sym = fp->ctf_dynsymidx[symidx];
err = ECTF_NOTYPEDAT;
if (!sym || (sym->st_shndx != STT_OBJECT && sym->st_shndx != STT_FUNC))
goto try_parent;
static int
print_struct (const char *name, ctf_id_t membtype, unsigned long offset,
- void *fp_)
+ void *fp_)
{
ctf_dict_t *fp = (ctf_dict_t *) fp_;
char *type_name = ctf_type_aname (fp, membtype);
printf ("iter test: %s, offset %lx, has type %lx/%s\n",
- name, offset, membtype, type_name);
+ name, offset, membtype, type_name);
free (type_name);
return 0;
char *type_name = ctf_type_aname (fp, membtype);
printf ("next test: %s, offset %lx, has type %lx/%s\n",
- name, offset, membtype, type_name);
+ name, offset, membtype, type_name);
free (type_name);
}
if (ctf_errno (fp) != ECTF_NEXT_END)