+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.