diff --git a/binutils/objdump.c b/binutils/objdump.c index bbc34ed21dd..bb791e2a8b3 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -4817,9 +4817,8 @@ static void dump_ctf_archive_member (ctf_dict_t *ctf, const char *name, ctf_dict_t *parent, size_t member) { - const char *things[] = {"Header", "Labels", "Data objects", - "Function objects", "Variables", "Types", "Strings", - ""}; + const char *things[] = {"Header", "Data objects", "Function objects", + "Variables", "Types", "Strings", ""}; const char **thing; size_t i; diff --git a/binutils/readelf.c b/binutils/readelf.c index d71ec194bda..062ad3eb790 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -16940,9 +16940,8 @@ static void dump_ctf_archive_member (ctf_dict_t *ctf, const char *name, ctf_dict_t *parent, size_t member) { - const char *things[] = {"Header", "Labels", "Data objects", - "Function objects", "Variables", "Types", "Strings", - ""}; + const char *things[] = {"Header", "Data objects", "Function objects", + "Variables", "Types", "Strings", ""}; const char **thing; size_t i; diff --git a/include/ctf-api.h b/include/ctf-api.h index afaa08c13da..2554c275460 100644 --- a/include/ctf-api.h +++ b/include/ctf-api.h @@ -124,7 +124,6 @@ typedef struct ctf_link_sym typedef enum ctf_sect_names { CTF_SECT_HEADER, - CTF_SECT_LABEL, CTF_SECT_OBJT, CTF_SECT_OBJTIDX = CTF_SECT_OBJT, CTF_SECT_FUNC, @@ -165,11 +164,6 @@ typedef struct ctf_funcinfo uint32_t ctc_flags; /* Function attributes (see below). */ } ctf_funcinfo_t; -typedef struct ctf_lblinfo -{ - ctf_id_t ctb_type; /* Last type associated with the label. */ -} ctf_lblinfo_t; - typedef struct ctf_snapshot_id { unsigned long dtd_id; /* Highest DTD ID at time of snapshot. */ @@ -221,8 +215,6 @@ typedef struct ctf_snapshot_id _CTF_ITEM (ECTF_NOFUNCDAT, "No function information available for function.") \ _CTF_ITEM (ECTF_NOTDATA, "Symbol table entry does not refer to a data object.") \ _CTF_ITEM (ECTF_NOTYPEDAT, "No type information available for symbol.") \ - _CTF_ITEM (ECTF_NOLABEL, "No label found corresponding to name.") \ - _CTF_ITEM (ECTF_NOLABELDATA, "File does not contain any labels.") \ _CTF_ITEM (ECTF_NOTSUP, "Feature not supported.") \ _CTF_ITEM (ECTF_NOENUMNAM, "Enumerator name not found.") \ _CTF_ITEM (ECTF_NOMEMBNAM, "Member name not found.") \ @@ -310,7 +302,6 @@ typedef int ctf_enum_f (const char *name, int val, void *arg); typedef int ctf_variable_f (const char *name, ctf_id_t type, void *arg); typedef int ctf_type_f (ctf_id_t type, void *arg); typedef int ctf_type_all_f (ctf_id_t type, int flag, void *arg); -typedef int ctf_label_f (const char *name, const ctf_lblinfo_t *info, void *arg); typedef int ctf_archive_member_f (ctf_dict_t *fp, const char *name, void *arg); typedef int ctf_archive_raw_member_f (const char *name, const void *content, @@ -1025,13 +1016,6 @@ extern ctf_dict_t *ctf_arc_open_by_name_sections (const ctf_archive_t *arc, extern int ctf_gzwrite (ctf_dict_t *fp, gzFile fd); -/* Deprecated functions with no current use. */ - -extern const char *ctf_label_topmost (ctf_dict_t *); -extern int ctf_label_info (ctf_dict_t *, const char *, ctf_lblinfo_t *); -extern int ctf_label_iter (ctf_dict_t *, ctf_label_f *, void *); -extern int ctf_label_next (ctf_dict_t *, ctf_next_t **, const char **); /* TBD */ - #ifdef __cplusplus } #endif diff --git a/libctf/Makefile.am b/libctf/Makefile.am index 1620df61e80..7afdd30d8b0 100644 --- a/libctf/Makefile.am +++ b/libctf/Makefile.am @@ -57,9 +57,8 @@ libctf_ldflags_nover = $(libctf_version_info) @SHARED_LDFLAGS@ libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@ libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1 libctf_nobfd_la_SOURCES = ctf-api.c ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \ - ctf-hash.c ctf-labels.c ctf-dedup.c ctf-link.c ctf-lookup.c \ - ctf-open.c ctf-port.c ctf-serialize.c ctf-sha1.c ctf-string.c \ - ctf-types.c ctf-util.c + ctf-hash.c ctf-dedup.c ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c \ + ctf-serialize.c ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c if NEED_CTF_QSORT_R libctf_nobfd_la_SOURCES += ctf-qsort_r.c endif diff --git a/libctf/Makefile.in b/libctf/Makefile.in index 298def58996..31fa27ee92d 100644 --- a/libctf/Makefile.in +++ b/libctf/Makefile.in @@ -198,21 +198,20 @@ LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) am__DEPENDENCIES_1 = libctf_nobfd_la_DEPENDENCIES = $(am__DEPENDENCIES_1) am__libctf_nobfd_la_SOURCES_DIST = ctf-api.c ctf-archive.c ctf-dump.c \ - ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c \ - ctf-dedup.c ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c \ - ctf-serialize.c ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c \ - ctf-qsort_r.c + ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-dedup.c \ + ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c ctf-serialize.c \ + ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c ctf-qsort_r.c @NEED_CTF_QSORT_R_TRUE@am__objects_1 = libctf_nobfd_la-ctf-qsort_r.lo am_libctf_nobfd_la_OBJECTS = libctf_nobfd_la-ctf-api.lo \ libctf_nobfd_la-ctf-archive.lo libctf_nobfd_la-ctf-dump.lo \ libctf_nobfd_la-ctf-create.lo libctf_nobfd_la-ctf-decl.lo \ libctf_nobfd_la-ctf-error.lo libctf_nobfd_la-ctf-hash.lo \ - libctf_nobfd_la-ctf-labels.lo libctf_nobfd_la-ctf-dedup.lo \ - libctf_nobfd_la-ctf-link.lo libctf_nobfd_la-ctf-lookup.lo \ - libctf_nobfd_la-ctf-open.lo libctf_nobfd_la-ctf-port.lo \ - libctf_nobfd_la-ctf-serialize.lo libctf_nobfd_la-ctf-sha1.lo \ - libctf_nobfd_la-ctf-string.lo libctf_nobfd_la-ctf-types.lo \ - libctf_nobfd_la-ctf-util.lo $(am__objects_1) + libctf_nobfd_la-ctf-dedup.lo libctf_nobfd_la-ctf-link.lo \ + libctf_nobfd_la-ctf-lookup.lo libctf_nobfd_la-ctf-open.lo \ + libctf_nobfd_la-ctf-port.lo libctf_nobfd_la-ctf-serialize.lo \ + libctf_nobfd_la-ctf-sha1.lo libctf_nobfd_la-ctf-string.lo \ + libctf_nobfd_la-ctf-types.lo libctf_nobfd_la-ctf-util.lo \ + $(am__objects_1) libctf_nobfd_la_OBJECTS = $(am_libctf_nobfd_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -227,20 +226,20 @@ libctf_nobfd_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libctf_la_DEPENDENCIES = ../bfd/libbfd.la $(am__DEPENDENCIES_2) am__libctf_la_SOURCES_DIST = ctf-api.c ctf-archive.c ctf-dump.c \ - ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c \ - ctf-dedup.c ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c \ - ctf-serialize.c ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c \ - ctf-qsort_r.c ctf-open-bfd.c + ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-dedup.c \ + ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c ctf-serialize.c \ + ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c ctf-qsort_r.c \ + ctf-open-bfd.c @NEED_CTF_QSORT_R_TRUE@am__objects_2 = libctf_la-ctf-qsort_r.lo am__objects_3 = libctf_la-ctf-api.lo libctf_la-ctf-archive.lo \ libctf_la-ctf-dump.lo libctf_la-ctf-create.lo \ libctf_la-ctf-decl.lo libctf_la-ctf-error.lo \ - libctf_la-ctf-hash.lo libctf_la-ctf-labels.lo \ - libctf_la-ctf-dedup.lo libctf_la-ctf-link.lo \ - libctf_la-ctf-lookup.lo libctf_la-ctf-open.lo \ - libctf_la-ctf-port.lo libctf_la-ctf-serialize.lo \ - libctf_la-ctf-sha1.lo libctf_la-ctf-string.lo \ - libctf_la-ctf-types.lo libctf_la-ctf-util.lo $(am__objects_2) + libctf_la-ctf-hash.lo libctf_la-ctf-dedup.lo \ + libctf_la-ctf-link.lo libctf_la-ctf-lookup.lo \ + libctf_la-ctf-open.lo libctf_la-ctf-port.lo \ + libctf_la-ctf-serialize.lo libctf_la-ctf-sha1.lo \ + libctf_la-ctf-string.lo libctf_la-ctf-types.lo \ + libctf_la-ctf-util.lo $(am__objects_2) am_libctf_la_OBJECTS = $(am__objects_3) libctf_la-ctf-open-bfd.lo libctf_la_OBJECTS = $(am_libctf_la_OBJECTS) libctf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ @@ -609,10 +608,9 @@ libctf_ldflags_nover = $(libctf_version_info) @SHARED_LDFLAGS@ libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@ libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1 libctf_nobfd_la_SOURCES = ctf-api.c ctf-archive.c ctf-dump.c \ - ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-labels.c \ - ctf-dedup.c ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c \ - ctf-serialize.c ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c \ - $(am__append_1) + ctf-create.c ctf-decl.c ctf-error.c ctf-hash.c ctf-dedup.c \ + ctf-link.c ctf-lookup.c ctf-open.c ctf-port.c ctf-serialize.c \ + ctf-sha1.c ctf-string.c ctf-types.c ctf-util.c $(am__append_1) # @CTF_LIBADD@ appears here twice: once, to force libiberty to get searched before # install-time libbfd adds a -L to the install dir (possibly pointing at an @@ -766,7 +764,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-labels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-link.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-lookup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_la-ctf-open-bfd.Plo@am__quote@ @@ -786,7 +783,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-dump.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-labels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-link.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-lookup.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libctf_nobfd_la-ctf-open.Plo@am__quote@ @@ -868,13 +864,6 @@ libctf_nobfd_la-ctf-hash.lo: ctf-hash.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_nobfd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libctf_nobfd_la-ctf-hash.lo `test -f 'ctf-hash.c' || echo '$(srcdir)/'`ctf-hash.c -libctf_nobfd_la-ctf-labels.lo: ctf-labels.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_nobfd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libctf_nobfd_la-ctf-labels.lo -MD -MP -MF $(DEPDIR)/libctf_nobfd_la-ctf-labels.Tpo -c -o libctf_nobfd_la-ctf-labels.lo `test -f 'ctf-labels.c' || echo '$(srcdir)/'`ctf-labels.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libctf_nobfd_la-ctf-labels.Tpo $(DEPDIR)/libctf_nobfd_la-ctf-labels.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ctf-labels.c' object='libctf_nobfd_la-ctf-labels.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_nobfd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libctf_nobfd_la-ctf-labels.lo `test -f 'ctf-labels.c' || echo '$(srcdir)/'`ctf-labels.c - libctf_nobfd_la-ctf-dedup.lo: ctf-dedup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_nobfd_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libctf_nobfd_la-ctf-dedup.lo -MD -MP -MF $(DEPDIR)/libctf_nobfd_la-ctf-dedup.Tpo -c -o libctf_nobfd_la-ctf-dedup.lo `test -f 'ctf-dedup.c' || echo '$(srcdir)/'`ctf-dedup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libctf_nobfd_la-ctf-dedup.Tpo $(DEPDIR)/libctf_nobfd_la-ctf-dedup.Plo @@ -1001,13 +990,6 @@ libctf_la-ctf-hash.lo: ctf-hash.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libctf_la-ctf-hash.lo `test -f 'ctf-hash.c' || echo '$(srcdir)/'`ctf-hash.c -libctf_la-ctf-labels.lo: ctf-labels.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libctf_la-ctf-labels.lo -MD -MP -MF $(DEPDIR)/libctf_la-ctf-labels.Tpo -c -o libctf_la-ctf-labels.lo `test -f 'ctf-labels.c' || echo '$(srcdir)/'`ctf-labels.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libctf_la-ctf-labels.Tpo $(DEPDIR)/libctf_la-ctf-labels.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ctf-labels.c' object='libctf_la-ctf-labels.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libctf_la-ctf-labels.lo `test -f 'ctf-labels.c' || echo '$(srcdir)/'`ctf-labels.c - libctf_la-ctf-dedup.lo: ctf-dedup.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libctf_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libctf_la-ctf-dedup.lo -MD -MP -MF $(DEPDIR)/libctf_la-ctf-dedup.Tpo -c -o libctf_la-ctf-dedup.lo `test -f 'ctf-dedup.c' || echo '$(srcdir)/'`ctf-dedup.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libctf_la-ctf-dedup.Tpo $(DEPDIR)/libctf_la-ctf-dedup.Plo diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index d38d12ee1b3..64c6a09f65f 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -754,14 +754,6 @@ ctf_dump (ctf_dict_t *fp, ctf_dump_state_t **statep, ctf_sect_names_t sect, case CTF_SECT_HEADER: ctf_dump_header (fp, state); break; - case CTF_SECT_LABEL: - if (ctf_label_iter (fp, ctf_dump_label, state) < 0) - { - if (ctf_errno (fp) != ECTF_NOLABELDATA) - goto end; /* errno is set for us. */ - ctf_set_errno (fp, 0); - } - break; case CTF_SECT_OBJT: if (ctf_dump_objts (fp, state, 0) < 0) goto end; /* errno is set for us. */ diff --git a/libctf/ctf-labels.c b/libctf/ctf-labels.c deleted file mode 100644 index 6a7b4525d5b..00000000000 --- a/libctf/ctf-labels.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Labelled ranges of type IDs. - Copyright (C) 2019-2025 Free Software Foundation, Inc. - - This file is part of libctf. - - libctf is free software; you can redistribute it and/or modify it under - the terms of the GNU General Public License as published by the Free - Software Foundation; either version 3, or (at your option) any later - version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not see - . */ - -#include -#include - -static int -extract_label_info (ctf_dict_t *fp, const ctf_lblent_t **ctl, - uint32_t *num_labels) -{ - const ctf_header_t *h; - - h = (const ctf_header_t *) fp->ctf_data.cts_data; - - *ctl = (const ctf_lblent_t *) (fp->ctf_buf + h->cth_lbloff); - *num_labels = (h->cth_objtoff - h->cth_lbloff) / sizeof (ctf_lblent_t); - - return 0; -} - -/* Returns the topmost label, or NULL if any errors are encountered. */ - -const char * -ctf_label_topmost (ctf_dict_t *fp) -{ - const ctf_lblent_t *ctlp = NULL; - const char *s; - uint32_t num_labels = 0; - - if (extract_label_info (fp, &ctlp, &num_labels) < 0) - return NULL; /* errno is set for us. */ - - if (num_labels == 0) - { - (void) ctf_set_errno (fp, ECTF_NOLABELDATA); - return NULL; - } - - if ((s = ctf_strraw (fp, (ctlp + num_labels - 1)->ctl_label)) == NULL) - (void) ctf_set_errno (fp, ECTF_CORRUPT); - - return s; -} - -/* Iterate over all labels. We pass the label string and the lblinfo_t struct - to the specified callback function. */ -int -ctf_label_iter (ctf_dict_t *fp, ctf_label_f *func, void *arg) -{ - const ctf_lblent_t *ctlp = NULL; - uint32_t i; - uint32_t num_labels = 0; - ctf_lblinfo_t linfo; - const char *lname; - int rc; - - if (extract_label_info (fp, &ctlp, &num_labels) < 0) - return -1; /* errno is set for us. */ - - if (num_labels == 0) - return (ctf_set_errno (fp, ECTF_NOLABELDATA)); - - for (i = 0; i < num_labels; i++, ctlp++) - { - if ((lname = ctf_strraw (fp, ctlp->ctl_label)) == NULL) - { - /* Not marked for translation: label code not used yet. */ - ctf_err_warn (fp, 0, ECTF_CORRUPT, - "failed to decode label %u with type %u", - ctlp->ctl_label, ctlp->ctl_type); - return (ctf_set_errno (fp, ECTF_CORRUPT)); - } - - linfo.ctb_type = ctlp->ctl_type; - if ((rc = func (lname, &linfo, arg)) != 0) - return rc; - } - - return 0; -} - -typedef struct linfo_cb_arg -{ - const char *lca_name; /* Label we want to retrieve info for. */ - ctf_lblinfo_t *lca_info; /* Where to store the info about the label. */ -} linfo_cb_arg_t; - -static int -label_info_cb (const char *lname, const ctf_lblinfo_t *linfo, void *arg) -{ - /* If lname matches the label we are looking for, copy the - lblinfo_t struct for the caller. */ - - if (strcmp (lname, ((linfo_cb_arg_t *) arg)->lca_name) == 0) - { - /* * Allow caller not to allocate storage to test if label exists. */ - - if (((linfo_cb_arg_t *) arg)->lca_info != NULL) - memcpy (((linfo_cb_arg_t *) arg)->lca_info, linfo, - sizeof (ctf_lblinfo_t)); - return 1; /* Indicate we found a match. */ - } - - return 0; -} - -/* Retrieve information about the label with name "lname". */ -int -ctf_label_info (ctf_dict_t *fp, const char *lname, ctf_lblinfo_t *linfo) -{ - linfo_cb_arg_t cb_arg; - int rc; - - cb_arg.lca_name = lname; - cb_arg.lca_info = linfo; - - if ((rc = ctf_label_iter (fp, label_info_cb, &cb_arg)) < 0) - return rc; - - if (rc != 1) - return (ctf_set_errno (fp, ECTF_NOLABEL)); - - return 0; -} diff --git a/libctf/libctf.ver b/libctf/libctf.ver index b3d844ae58e..699c09a47f7 100644 --- a/libctf/libctf.ver +++ b/libctf/libctf.ver @@ -89,8 +89,6 @@ LIBCTF_2.0 { ctf_enum_name; ctf_enum_value; - ctf_label_topmost; - ctf_label_info; ctf_lookup_enumerator; ctf_lookup_enumerator_next; ctf_arc_lookup_enumerator_next; @@ -101,7 +99,6 @@ LIBCTF_2.0 { ctf_type_iter; ctf_type_next; ctf_type_iter_all; - ctf_label_iter; ctf_variable_iter; ctf_variable_next;