+2019-09-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * configure.ac (AC_DISABLE_SHARED): New, like opcodes/.
+ (LT_INIT): Likewise.
+ (AM_INSTALL_LIBBFD): Likewise.
+ (dlopen): Note why this is necessary in a comment.
+ (SHARED_LIBADD): Initialize for possibly-PIC libiberty: derived from
+ opcodes/.
+ (SHARED_LDFLAGS): Likewise.
+ (BFD_LIBADD): Likewise, for libbfd.
+ (BFD_DEPENDENCIES): Likewise.
+ (VERSION_FLAGS): Initialize, using a version script if ld supports
+ one, or libtool -export-symbols-regex otherwise.
+ (AC_CONFIG_MACRO_DIR): Add ../BFD.
+ * Makefile.am (ACLOCAL_AMFLAGS): Likewise.
+ (INCDIR): New.
+ (AM_CPPFLAGS): Use $(srcdir), not $(top_srcdir).
+ (noinst_LIBRARIES): Replace with...
+ [INSTALL_LIBBFD] (lib_LTLIBRARIES): This, or...
+ [!INSTALL_LIBBFD] (noinst_LTLIBRARIES): ... this, mentioning new
+ libctf-nobfd.la as well.
+ [INSTALL_LIBCTF] (include_HEADERS): Add the CTF headers.
+ [!INSTALL_LIBCTF] (include_HEADERS): New, empty.
+ (libctf_a_SOURCES): Rename to...
+ (libctf_nobfd_la_SOURCES): ... this, all of libctf other than
+ ctf-open-bfd.c.
+ (libctf_la_SOURCES): Now derived from libctf_nobfd_la_SOURCES,
+ with ctf-open-bfd.c added.
+ (libctf_nobfd_la_LIBADD): New, using @SHARED_LIBADD@.
+ (libctf_la_LIBADD): New, using @BFD_LIBADD@ as well.
+ (libctf_la_DEPENDENCIES): New, using @BFD_DEPENDENCIES@.
+ * Makefile.am [INSTALL_LIBCTF]: Use it.
+ * aclocal.m4: Add ../bfd/acinclude.m4, ../config/acx.m4, and the
+ libtool macros.
+ * libctf.ver: New, everything is version LIBCTF_1.0 currently (even
+ the unstable components).
+ * Makefile.in: Regenerated.
+ * config.h.in: Likewise.
+ * configure: Likewise.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * configure.ac (INSTALL_LIBCTF): New, controlled by
+ --enable-install-libctf.
+ [INSTALL_LIBCTF] (lib_LIBRARIES): Add libctf.a.
+ * Makefile.in: Regenerated.
+ * configure: Regenerated.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set.
+ * ctf-open-bfd.c (ctf_bfdclose): Fix comment.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-open-bfd.c (ctf_fdopen): Call bfd_set_cacheable.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (includes): Include <sys/param.h> here.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-open.c (flip_lbls): Eschew for-loop initial declarations.
+ (flip_objts): Likewise.
+ (flip_vars): Likewise.
+ (flip_types): Likewise.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-hash.c (ctf_hashtab_insert): Pass in the key and value
+ freeing functions: if set, free the key and value if the slot
+ already exists. Always reassign the key.
+ (ctf_dynhash_insert): Adjust call appropriately.
+ (ctf_hash_insert_type): Likewise.
+
+2019-08-03 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-create.c (ctf_add_type): Look up and use the forwarded-to
+ type kind. Allow forwards to unify with pre-existing structs/
+ unions/enums.
+
+2019-07-30 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (ctf_file_t) <ctf_link_cu_mappping>: New.
+ <ctf_link_memb_name_changer>: Likewise.
+ <ctf_link_memb_name_changer_arg>: Likewise.
+ * ctf-create.c (ctf_update): Update accordingly.
+ * ctf-open.c (ctf_file_close): Likewise.
+ * ctf-link.c (ctf_create_per_cu): Apply the cu mapping.
+ (ctf_link_add_cu_mapping): New.
+ (ctf_link_set_memb_name_changer): Likewise.
+ (ctf_change_parent_name): New.
+ (ctf_name_list_accum_cb_arg_t) <dynames>: New, storage for names
+ allocated by the caller's ctf_link_memb_name_changer.
+ <ndynames>: Likewise.
+ (ctf_accumulate_archive_names): Call the ctf_link_memb_name_changer.
+ (ctf_link_write): Likewise (for _CTF_SECTION only): also call
+ ctf_change_parent_name. Free any resulting names.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-link.c (ctf_create_per_cu): New, refactored out of...
+ (ctf_link_one_type): ... here, with parent-name setting added.
+ (check_variable): New.
+ (ctf_link_one_variable): Likewise.
+ (ctf_link_one_input_archive_member): Call it.
+ * ctf-error.c (_ctf_errlist): Updated with new errors.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (ctf_file_t): New field ctf_link_type_mapping.
+ (struct ctf_link_type_mapping_key): New.
+ (ctf_hash_type_mapping_key): Likewise.
+ (ctf_hash_eq_type_mapping_key): Likewise.
+ (ctf_add_type_mapping): Likewise.
+ (ctf_type_mapping): Likewise.
+ (ctf_dynhash_empty): Likewise.
+ * ctf-open.c (ctf_file_close): Update accordingly.
+ * ctf-create.c (ctf_update): Likewise.
+ (ctf_add_type): Populate the mapping.
+ * ctf-hash.c (ctf_hash_type_mapping_key): Hash a type mapping key.
+ (ctf_hash_eq_type_mapping_key): Check the key for equality.
+ (ctf_dynhash_insert): Fix comment typo.
+ (ctf_dynhash_empty): New.
+ * ctf-link.c (ctf_add_type_mapping): New.
+ (ctf_type_mapping): Likewise.
+ (empty_link_type_mapping): New.
+ (ctf_link_one_input_archive): Call it.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-link.c: New file, linking of the string and type sections.
+ * Makefile.am (libctf_a_SOURCES): Add it.
+ * Makefile.in: Regenerate.
+
+ * ctf-impl.h (ctf_file_t): New fields ctf_link_inputs,
+ ctf_link_outputs.
+ * ctf-create.c (ctf_update): Update accordingly.
+ * ctf-open.c (ctf_file_close): Likewise.
+ * ctf-error.c (_ctf_errlist): Updated with new errors.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-dump.c (ctf_dump_funcs): Check the right error value.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-dump.c (ctf_dump): Use ctf_type_iter_all to dump types, not
+ ctf_type_iter.
+ (ctf_dump_type): Pass down the flag from ctf_type_iter_all.
+ (ctf_dump_format_type): Add non-root-type { } notation.
+ Add root flag to prototype.
+ (ctf_dump_label): Adjust accordingly.
+ (ctf_dump_objts): Likewise.
+ (ctf_dump_var): Likewise.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-create.c (ctf_compress_write): Fix double-free.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms
+ of...
+ (ctf_arc_write_fd): ... this new function.
+ * ctf-create.c (ctf_write_mem): New.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (ctf_str_atom_t) <csa_offset>: New field.
+ (ctf_file_t) <ctf_syn_ext_strtab>: Likewise.
+ (ctf_str_add_ref): Name the last arg.
+ (ctf_str_add_external) New.
+ (ctf_str_add_strraw_explicit): Likewise.
+ (ctf_simple_open_internal): Likewise.
+ (ctf_bufopen_internal): Likewise.
+
+ * ctf-string.c (ctf_strraw_explicit): Split from...
+ (ctf_strraw): ... here, with new support for ctf_syn_ext_strtab.
+ (ctf_str_add_ref_internal): Return the atom, not the
+ string.
+ (ctf_str_add): Adjust accordingly.
+ (ctf_str_add_ref): Likewise. Move up in the file.
+ (ctf_str_add_external): New: update the csa_offset.
+ (ctf_str_count_strtab): Only account for strings with no csa_offset
+ in the internal strtab length.
+ (ctf_str_write_strtab): If the csa_offset is set, update the
+ string's refs without writing the string out, and update the
+ ctf_syn_ext_strtab. Make OOM handling less ugly.
+ * ctf-create.c (struct ctf_sort_var_arg_cb): New.
+ (ctf_update): Handle failure to populate the strtab. Pass in the
+ new ctf_sort_var arg. Adjust for ctf_syn_ext_strtab addition.
+ Call ctf_simple_open_internal, not ctf_simple_open.
+ (ctf_sort_var): Call ctf_strraw_explicit rather than looking up
+ strings by hand.
+ * ctf-hash.c (ctf_hash_insert_type): Likewise (but using
+ ctf_strraw). Adjust to diagnose ECTF_STRTAB nonetheless.
+ * ctf-open.c (init_types): No longer filter out ECTF_STRTAB.
+ (ctf_file_close): Destroy the ctf_syn_ext_strtab.
+ (ctf_simple_open): Rename to, and reimplement as a wrapper around...
+ (ctf_simple_open_internal): ... this new function, which calls
+ ctf_bufopen_internal.
+ (ctf_bufopen): Rename to, and reimplement as a wrapper around...
+ (ctf_bufopen_internal): ... this new function, which sets
+ ctf_syn_ext_strtab.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf_types.c (ctf_type_iter_all): New.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-open.c (init_symtab): Check for overflow against the right
+ section.
+ (upgrade_header): Set cth_objtidxoff, cth_funcidxoff to zero-length.
+ (upgrade_types_v1): Note that these sections are not checked.
+ (flip_header): Endian-swap the header fields.
+ (flip_ctf): Endian-swap the sections.
+ (flip_objts): Update comment.
+ (ctf_bufopen): Check header offsets and alignment for validity.
+
+2019-07-13 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-open-bfd.c: Add <assert.h>.
+ (ctf_bfdopen_ctfsect): Open string and symbol tables using
+ techniques borrowed from bfd_elf_sym_name.
+ (ctf_new_archive_internal): Improve comment.
+ * ctf-archive.c (ctf_arc_close): Do not free the ctfi_strsect.
+ * ctf-open.c (ctf_bufopen): Allow opening with a string section but
+ no symbol section, but not vice versa.
+
+2019-07-08 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (ctf_file_t): New field ctf_openflags.
+ * ctf-open.c (ctf_bufopen): Set it. No longer dump header offsets.
+ * ctf-dump.c (dump_header): New function, dump the CTF header.
+ (ctf_dump): Call it.
+ (ctf_dump_header_strfield): New function.
+ (ctf_dump_header_sectfield): Likewise.
+
+2019-07-06 Nick Alcock <nick.alcock@oracle.com>
+
+ * ctf-impl.h (ctf_file_t): New fields ctf_header, ctf_dynbase,
+ ctf_cuname, ctf_dyncuname: ctf_base and ctf_buf are no longer const.
+ * ctf-open.c (ctf_set_base): Preserve the gap between ctf_buf and
+ ctf_base: do not assume that it is always sizeof (ctf_header_t).
+ Print out ctf_cuname: only print out ctf_parname if set.
+ (ctf_free_base): Removed, ctf_base is no longer freed: free
+ ctf_dynbase instead.
+ (ctf_set_version): Fix spacing.
+ (upgrade_header): New, in-place header upgrading.
+ (upgrade_types): Rename to...
+ (upgrade_types_v1): ... this. Free ctf_dynbase, not ctf_base. No
+ longer track old and new headers separately. No longer allow for
+ header sizes explicitly: squeeze the headers out on upgrade (they
+ are preserved in fp->ctf_header). Set ctf_dynbase, ctf_base and
+ ctf_buf explicitly. Use ctf_free, not ctf_free_base.
+ (upgrade_types): New, also handle ctf_parmax updating.
+ (flip_header): Flip ctf_cuname.
+ (flip_types): Flip BUF explicitly rather than deriving BUF from
+ BASE.
+ (ctf_bufopen): Store the header in fp->ctf_header. Correct minimum
+ required alignment of objtoff and funcoff. No longer store it in
+ the ctf_buf unless that buf is derived unmodified from the input.
+ Set ctf_dynbase where ctf_base is dynamically allocated. Drop locals
+ that duplicate fields in ctf_file: move allocation of ctf_file
+ further up instead. Call upgrade_header as needed. Move
+ version-specific ctf_parmax initialization into upgrade_types. More
+ concise error handling.
+ (ctf_file_close): No longer test for null pointers before freeing.
+ Free ctf_dyncuname, ctf_dynbase, and ctf_header. Do not call
+ ctf_free_base.
+ (ctf_cuname): New.
+ (ctf_cuname_set): New.
+ * ctf-create.c (ctf_update): Populate ctf_cuname.
+ (ctf_gzwrite): Write out the header explicitly. Remove obsolescent
+ comment.
+ (ctf_write): Likewise.
+ (ctf_compress_write): Get the header from ctf_header, not ctf_base.
+ Fix the compression length: fp->ctf_size never counted the CTF
+ header. Simplify the compress call accordingly.
+
2019-07-11 Hans-Peter Nilsson <hp@bitrange.com>
* ctf-endian.h: Don't assume htole64 and le64toh are always