Go to file
Nick Alcock 54a0219150 libctf: remove static/dynamic name lookup distinction
libctf internally maintains a set of hash tables for type name lookups,
one for each valid C type namespace (struct, union, enum, and everything
else).

Or, rather, it maintains *two* sets of hash tables: one, a ctf_hash *,
is meant for lookups in ctf_(buf)open()ed dicts with fixed content; the
other, a ctf_dynhash *, is meant for lookups in ctf_create()d dicts.

This distinction was somewhat valuable in the far pre-binutils past when
two different hashtable implementations were used (one expanding, the
other fixed-size), but those days are long gone: the hash table
implementations are almost identical, both wrappers around the libiberty
hashtab. The ctf_dynhash has many more capabilities than the ctf_hash
(iteration, deletion, etc etc) and has no downsides other than starting
at a fixed, arbitrary small size.

That limitation is easy to lift (via a new ctf_dynhash_create_sized()),
following which we can throw away nearly all the ctf_hash
implementation, and all the code to choose between readable and writable
hashtabs; the few convenience functions that are still useful (for
insertion of name -> type mappings) can also be generalized a bit so
that the extra string verification they do is potentially available to
other string lookups as well.

(libctf still has two hashtable implementations, ctf_dynhash, above,
and ctf_dynset, which is a key-only hashtab that can avoid a great many
malloc()s, used for high-volume applications in the deduplicator.)

libctf/

	* ctf-create.c (ctf_create): Eliminate ctn_writable.
	(ctf_dtd_insert): Likewise.
	(ctf_dtd_delete): Likewise.
	(ctf_rollback): Likewise.
	(ctf_name_table): Eliminate ctf_names_t.
	* ctf-hash.c (ctf_dynhash_create): Comment update.
        Reimplement in terms of...
	(ctf_dynhash_create_sized): ... this new function.
	(ctf_hash_create): Remove.
	(ctf_hash_size): Remove.
	(ctf_hash_define_type): Remove.
	(ctf_hash_destroy): Remove.
	(ctf_hash_lookup_type): Rename to...
	(ctf_dynhash_lookup_type): ... this.
	(ctf_hash_insert_type): Rename to...
	(ctf_dynhash_insert_type): ... this, moving validation to...
	* ctf-string.c (ctf_strptr_validate): ... this new function.
	* ctf-impl.h (struct ctf_names): Extirpate.
	(struct ctf_lookup.ctl_hash): Now a ctf_dynhash_t.
	(struct ctf_dict): All ctf_names_t fields are now ctf_dynhash_t.
	(ctf_name_table): Now returns a ctf_dynhash_t.
	(ctf_lookup_by_rawhash): Remove.
	(ctf_hash_create): Likewise.
	(ctf_hash_insert_type): Likewise.
	(ctf_hash_define_type): Likewise.
	(ctf_hash_lookup_type): Likewise.
	(ctf_hash_size): Likewise.
	(ctf_hash_destroy): Likewise.
	(ctf_dynhash_create_sized): New.
	(ctf_dynhash_insert_type): New.
	(ctf_dynhash_lookup_type): New.
	(ctf_strptr_validate): New.
	* ctf-lookup.c (ctf_lookup_by_name_internal): Adapt.
	* ctf-open.c (init_types): Adapt.
	(ctf_set_ctl_hashes): Adapt.
	(ctf_dict_close): Adapt.
	* ctf-serialize.c (ctf_serialize): Adapt.
	* ctf-types.c (ctf_lookup_by_rawhash): Remove.
2024-04-19 16:14:46 +01:00
bfd Re: elf: Strip unreferenced weak undefined symbols 2024-04-19 16:48:03 +09:30
binutils binutils, objdump: Add --ctf-parent-section 2024-04-19 16:14:45 +01:00
config mmap: Avoid the sanitizer configure check failure 2024-04-10 03:57:02 -07:00
contrib contrib: sync dg-extract-results.sh with GCC 2024-03-12 15:49:25 +00:00
cpu
elfcpp
etc
gas x86: Fix a memory leak in md_assemble 2024-04-16 06:32:33 -07:00
gdb gdb: Document qIsAddressTagged packet 2024-04-19 15:29:40 +01:00
gdbserver gdbsupport: constify some return values in print-utils.{h,cc} 2024-04-18 10:31:54 -04:00
gdbsupport gdbsupport: constify some return values in print-utils.{h,cc} 2024-04-18 10:31:54 -04:00
gnulib gnulib: re-generate build files 2024-03-11 22:42:56 -04:00
gold Add missing install-dvi and install-ps Makefie targets. 2024-04-05 07:02:56 +00:00
gprof Add missing install-dvi and install-ps Makefie targets. 2024-04-05 07:02:56 +00:00
gprofng gprofng: Fix dvi documentation build rule 2024-04-15 09:51:19 +00:00
include aarch64: Remove asserts from operand qualifier decoders [PR31595] 2024-04-17 11:18:55 +01:00
ld elf: Strip unreferenced weak undefined symbols 2024-04-18 19:17:17 -07:00
libbacktrace Sync libbacktrace from gcc [PR31327] 2024-03-11 23:10:33 +00:00
libctf libctf: remove static/dynamic name lookup distinction 2024-04-19 16:14:46 +01:00
libdecnumber
libiberty mmap: Avoid the sanitizer configure check failure 2024-04-10 03:57:02 -07:00
libsframe mmap: Avoid the sanitizer configure check failure 2024-04-10 03:57:46 -07:00
opcodes mmix disassemble memory leak 2024-04-19 10:00:57 +09:30
readline
sim sim: riscv: Fix confusion with c.jal vs. c.addiw 2024-04-15 11:04:07 +02:00
texinfo
zlib mmap: Avoid the sanitizer configure check failure 2024-04-10 03:57:02 -07:00
.cvsignore
.editorconfig
.gitattributes
.gitignore
.pre-commit-config.yaml Add flake8 and isort to .pre-commit-config.yaml 2024-04-04 06:43:39 -06:00
ar-lib
ChangeLog .pre-commit-config.yaml: bump black hook to 24.3.0 2024-03-20 14:44:16 -04:00
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS Fix compiling bfd/vms-lib.c for a 32-bit host. 2024-03-18 10:26:16 +00:00
Makefile.def Revert "Pass GUILE down to subdirectories" 2024-03-22 11:07:28 -06:00
Makefile.in Revert "Pass GUILE down to subdirectories" 2024-03-22 11:07:28 -06:00
Makefile.tpl Revert "Pass GUILE down to subdirectories" 2024-03-22 11:07:28 -06:00
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
SECURITY.txt
setup.com
src-release.sh
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.