1*56bb7041Schristos2020-08-27 Nick Alcock <nick.alcock@oracle.com> 2*56bb7041Schristos 3*56bb7041Schristos * ctf-subr.c (open_errors): New list. 4*56bb7041Schristos (ctf_err_warn): Calls with NULL fp append to open_errors. Add err 5*56bb7041Schristos parameter, and use it to decorate the debug stream with errmsgs. 6*56bb7041Schristos (ctf_err_warn_to_open): Splice errors from a CTF dict into the 7*56bb7041Schristos open_errors. 8*56bb7041Schristos (ctf_errwarning_next): Calls with NULL fp report from open_errors. 9*56bb7041Schristos New err param to report iteration errors (including end-of-iteration) 10*56bb7041Schristos when fp is NULL. 11*56bb7041Schristos (ctf_assert_fail_internal): Adjust ctf_err_warn call for new err 12*56bb7041Schristos parameter: gettextize. 13*56bb7041Schristos * ctf-impl.h (ctfo_get_vbytes): Add ctf_file_t parameter. 14*56bb7041Schristos (LCTF_VBYTES): Adjust. 15*56bb7041Schristos (ctf_err_warn_to_open): New. 16*56bb7041Schristos (ctf_err_warn): Adjust. 17*56bb7041Schristos (ctf_bundle): Used in only one place: move... 18*56bb7041Schristos * ctf-create.c: ... here. 19*56bb7041Schristos (enumcmp): Use ctf_err_warn, not ctf_dprintf, passing the err number 20*56bb7041Schristos down as needed. Don't emit the errmsg. Gettextize. 21*56bb7041Schristos (membcmp): Likewise. 22*56bb7041Schristos (ctf_add_type_internal): Likewise. 23*56bb7041Schristos (ctf_write_mem): Likewise. 24*56bb7041Schristos (ctf_compress_write): Likewise. Report errors writing the header or 25*56bb7041Schristos body. 26*56bb7041Schristos (ctf_write): Likewise. 27*56bb7041Schristos * ctf-archive.c (ctf_arc_write_fd): Use ctf_err_warn, not 28*56bb7041Schristos ctf_dprintf, and gettextize, as above. 29*56bb7041Schristos (ctf_arc_write): Likewise. 30*56bb7041Schristos (ctf_arc_bufopen): Likewise. 31*56bb7041Schristos (ctf_arc_open_internal): Likewise. 32*56bb7041Schristos * ctf-labels.c (ctf_label_iter): Likewise. 33*56bb7041Schristos * ctf-open-bfd.c (ctf_bfdclose): Likewise. 34*56bb7041Schristos (ctf_bfdopen): Likewise. 35*56bb7041Schristos (ctf_bfdopen_ctfsect): Likewise. 36*56bb7041Schristos (ctf_fdopen): Likewise. 37*56bb7041Schristos * ctf-string.c (ctf_str_write_strtab): Likewise. 38*56bb7041Schristos * ctf-types.c (ctf_type_resolve): Likewise. 39*56bb7041Schristos * ctf-open.c (get_vbytes_common): Likewise. Pass down the ctf dict. 40*56bb7041Schristos (get_vbytes_v1): Pass down the ctf dict. 41*56bb7041Schristos (get_vbytes_v2): Likewise. 42*56bb7041Schristos (flip_ctf): Likewise. 43*56bb7041Schristos (flip_types): Likewise. Use ctf_err_warn, not ctf_dprintf, and 44*56bb7041Schristos gettextize, as above. 45*56bb7041Schristos (upgrade_types_v1): Adjust calls. 46*56bb7041Schristos (init_types): Use ctf_err_warn, not ctf_dprintf, as above. 47*56bb7041Schristos (ctf_bufopen_internal): Likewise. Adjust calls. Transplant errors 48*56bb7041Schristos emitted into individual dicts into the open errors if this turns 49*56bb7041Schristos out to be a failed open in the end. 50*56bb7041Schristos * ctf-dump.c (ctf_dump_format_type): Adjust ctf_err_warn for new err 51*56bb7041Schristos argument. Gettextize. Don't emit the errmsg. 52*56bb7041Schristos (ctf_dump_funcs): Likewise. Collapse err label into its only case. 53*56bb7041Schristos (ctf_dump_type): Likewise. 54*56bb7041Schristos * ctf-link.c (ctf_create_per_cu): Adjust ctf_err_warn for new err 55*56bb7041Schristos argument. Gettextize. Don't emit the errmsg. 56*56bb7041Schristos (ctf_link_one_type): Likewise. 57*56bb7041Schristos (ctf_link_lazy_open): Likewise. 58*56bb7041Schristos (ctf_link_one_input_archive): Likewise. 59*56bb7041Schristos (ctf_link_deduplicating_count_inputs): Likewise. 60*56bb7041Schristos (ctf_link_deduplicating_open_inputs): Likewise. 61*56bb7041Schristos (ctf_link_deduplicating_close_inputs): Likewise. 62*56bb7041Schristos (ctf_link_deduplicating): Likewise. 63*56bb7041Schristos (ctf_link): Likewise. 64*56bb7041Schristos (ctf_link_deduplicating_per_cu): Likewise. Add some missed 65*56bb7041Schristos ctf_set_errnos to obscure error cases. 66*56bb7041Schristos * ctf-dedup.c (ctf_dedup_rhash_type): Adjust ctf_err_warn for new 67*56bb7041Schristos err argument. Gettextize. Don't emit the errmsg. 68*56bb7041Schristos (ctf_dedup_populate_mappings): Likewise. 69*56bb7041Schristos (ctf_dedup_detect_name_ambiguity): Likewise. 70*56bb7041Schristos (ctf_dedup_init): Likewise. 71*56bb7041Schristos (ctf_dedup_multiple_input_dicts): Likewise. 72*56bb7041Schristos (ctf_dedup_conflictify_unshared): Likewise. 73*56bb7041Schristos (ctf_dedup): Likewise. 74*56bb7041Schristos (ctf_dedup_rwalk_one_output_mapping): Likewise. 75*56bb7041Schristos (ctf_dedup_id_to_target): Likewise. 76*56bb7041Schristos (ctf_dedup_emit_type): Likewise. 77*56bb7041Schristos (ctf_dedup_emit_struct_members): Likewise. 78*56bb7041Schristos (ctf_dedup_populate_type_mapping): Likewise. 79*56bb7041Schristos (ctf_dedup_populate_type_mappings): Likewise. 80*56bb7041Schristos (ctf_dedup_emit): Likewise. 81*56bb7041Schristos (ctf_dedup_hash_type): Likewise. Fix a bit of messed-up error 82*56bb7041Schristos status setting. 83*56bb7041Schristos (ctf_dedup_rwalk_one_output_mapping): Likewise. Don't hide 84*56bb7041Schristos unknown-type-kind messages (which signify file corruption). 85*56bb7041Schristos 86*56bb7041Schristos2020-08-27 Nick Alcock <nick.alcock@oracle.com> 87*56bb7041Schristos 88*56bb7041Schristos * configure.ac: Adjust package name to simply 'libctf': arbitrarily 89*56bb7041Schristos declare this to be version 1.2.0. 90*56bb7041Schristos * Makefile.am (AM_CPPFLAGS): Add @INCINTL@. 91*56bb7041Schristos * Makefile.in: Regenerated. 92*56bb7041Schristos * configure: Regenerated. 93*56bb7041Schristos * ctf-intl.h: New file, lightly modified from opcodes/opintl.h. 94*56bb7041Schristos * ctf-impl.h: Include it. 95*56bb7041Schristos * ctf-error.r (_ctf_errlist_t): Mark strings as noop-translatable. 96*56bb7041Schristos (ctf_errmsg): Actually translate them. 97*56bb7041Schristos 98*56bb7041Schristos2020-07-26 Eli Zaretskii <eliz@gnu.org> 99*56bb7041Schristos 100*56bb7041Schristos PR binutils/25155: 101*56bb7041Schristos * ctf-create.c (EOVERFLOW): If not defined by system header, 102*56bb7041Schristos redirect to ERANGE as a poor man's substitute. 103*56bb7041Schristos * ctf-subr.c (ENOTSUP): If not defined, use ENOSYS instead. 104*56bb7041Schristos 105*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 106*56bb7041Schristos 107*56bb7041Schristos * ctf-create.c (ctf_dtd_insert): Add uintptr_t casts. 108*56bb7041Schristos (ctf_dtd_delete): Likewise. 109*56bb7041Schristos (ctf_dtd_lookup): Likewise. 110*56bb7041Schristos (ctf_rollback): Likewise. 111*56bb7041Schristos * ctf-hash.c (ctf_hash_lookup_type): Likewise. 112*56bb7041Schristos * ctf-types.c (ctf_lookup_by_rawhash): Likewise. 113*56bb7041Schristos 114*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 115*56bb7041Schristos 116*56bb7041Schristos * ctf-lookup.c (ctf_lookup_by_name): Adjust. 117*56bb7041Schristos 118*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 119*56bb7041Schristos 120*56bb7041Schristos * ctf-archive.c (ctf_arc_bufopen): Endian-swap the archive magic 121*56bb7041Schristos number if needed. 122*56bb7041Schristos 123*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 124*56bb7041Schristos 125*56bb7041Schristos * ctf-impl.h (ctf_list_splice): New. 126*56bb7041Schristos * ctf-util.h (ctf_list_splice): Likewise. 127*56bb7041Schristos * ctf-link.c (link_sort_inputs_cb_arg_t): Likewise. 128*56bb7041Schristos (ctf_link_sort_inputs): Likewise. 129*56bb7041Schristos (ctf_link_deduplicating_count_inputs): Likewise. 130*56bb7041Schristos (ctf_link_deduplicating_open_inputs): Likewise. 131*56bb7041Schristos (ctf_link_deduplicating_close_inputs): Likewise. 132*56bb7041Schristos (ctf_link_deduplicating_variables): Likewise. 133*56bb7041Schristos (ctf_link_deduplicating_per_cu): Likewise. 134*56bb7041Schristos (ctf_link_deduplicating): Likewise. 135*56bb7041Schristos (ctf_link): Call it. 136*56bb7041Schristos 137*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 138*56bb7041Schristos 139*56bb7041Schristos * ctf-link.c (ctf_link_one_input_archive_member): Check 140*56bb7041Schristos CTF_LINK_OMIT_VARIABLES_SECTION. 141*56bb7041Schristos 142*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 143*56bb7041Schristos 144*56bb7041Schristos * ctf-impl.h (ctf_type_id_key): New, the key in the 145*56bb7041Schristos cd_id_to_file_t. 146*56bb7041Schristos (ctf_dedup): New, core deduplicator state. 147*56bb7041Schristos (ctf_file_t) <ctf_dedup>: New. 148*56bb7041Schristos <ctf_dedup_atoms>: New. 149*56bb7041Schristos <ctf_dedup_atoms_alloc>: New. 150*56bb7041Schristos (ctf_hash_type_id_key): New prototype. 151*56bb7041Schristos (ctf_hash_eq_type_id_key): Likewise. 152*56bb7041Schristos (ctf_dedup_atoms_init): Likewise. 153*56bb7041Schristos * ctf-hash.c (ctf_hash_eq_type_id_key): New. 154*56bb7041Schristos (ctf_dedup_atoms_init): Likewise. 155*56bb7041Schristos * ctf-create.c (ctf_serialize): Adjusted. 156*56bb7041Schristos (ctf_add_encoded): No longer static. 157*56bb7041Schristos (ctf_add_reftype): Likewise. 158*56bb7041Schristos * ctf-open.c (ctf_file_close): Destroy the 159*56bb7041Schristos ctf_dedup_atoms_alloc. 160*56bb7041Schristos * ctf-dedup.c: New file. 161*56bb7041Schristos * ctf-decls.h [!HAVE_DECL_STPCPY]: Add prototype. 162*56bb7041Schristos * configure.ac: Check for stpcpy. 163*56bb7041Schristos * Makefile.am: Add it. 164*56bb7041Schristos * Makefile.in: Regenerate. 165*56bb7041Schristos * config.h.in: Regenerate. 166*56bb7041Schristos * configure: Regenerate. 167*56bb7041Schristos 168*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 169*56bb7041Schristos 170*56bb7041Schristos * configure.ac: Add --enable-libctf-hash-debugging. 171*56bb7041Schristos * aclocal.m4: Pull in enable.m4, for GCC_ENABLE. 172*56bb7041Schristos * Makefile.in: Regenerated. 173*56bb7041Schristos * configure: Likewise. 174*56bb7041Schristos * config.h.in: Likewise. 175*56bb7041Schristos * ctf-impl.h [ENABLE_LIBCTF_HASH_DEBUGGING] 176*56bb7041Schristos (ctf_assert): Define to assert. 177*56bb7041Schristos 178*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 179*56bb7041Schristos 180*56bb7041Schristos * ctf-sha1.h: New, inline wrappers around sha1_init_ctx and 181*56bb7041Schristos sha1_process_bytes. 182*56bb7041Schristos * ctf-impl.h: Include it. 183*56bb7041Schristos (ctf_sha1_init): New. 184*56bb7041Schristos (ctf_sha1_add): Likewise. 185*56bb7041Schristos (ctf_sha1_fini): Likewise. 186*56bb7041Schristos * ctf-sha1.c: New, non-inline wrapper around sha1_finish_ctx 187*56bb7041Schristos producing strings. 188*56bb7041Schristos * Makefile.am: Add file. 189*56bb7041Schristos * Makefile.in: Regenerate. 190*56bb7041Schristos 191*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 192*56bb7041Schristos 193*56bb7041Schristos * libctf.ver (ctf_link_set_variable_filter): Add. 194*56bb7041Schristos * ctf-impl.h (ctf_file_t) <ctf_link_variable_filter>: New. 195*56bb7041Schristos <ctf_link_variable_filter_arg>: Likewise. 196*56bb7041Schristos * ctf-create.c (ctf_serialize): Adjust. 197*56bb7041Schristos * ctf-link.c (ctf_link_set_variable_filter): New, set it. 198*56bb7041Schristos (ctf_link_one_variable): Call it if set. 199*56bb7041Schristos 200*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 201*56bb7041Schristos 202*56bb7041Schristos * ctf-link.c (ctf_link_one_variable): Check the dst_type for 203*56bb7041Schristos conflicts, not the source type. 204*56bb7041Schristos 205*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 206*56bb7041Schristos 207*56bb7041Schristos * ctf-impl.h (ctf_file_t): Improve comments. 208*56bb7041Schristos <ctf_link_cu_mapping>: Split into... 209*56bb7041Schristos <ctf_link_in_cu_mapping>: ... this... 210*56bb7041Schristos <ctf_link_out_cu_mapping>: ... and this. 211*56bb7041Schristos * ctf-create.c (ctf_serialize): Adjust. 212*56bb7041Schristos * ctf-open.c (ctf_file_close): Likewise. 213*56bb7041Schristos * ctf-link.c (ctf_create_per_cu): Look things up in the 214*56bb7041Schristos in_cu_mapping instead of the cu_mapping. 215*56bb7041Schristos (ctf_link_add_cu_mapping): The deduplicating link will define 216*56bb7041Schristos what happens if many FROMs share a TO. 217*56bb7041Schristos (ctf_link_add_cu_mapping): Create in_cu_mapping and 218*56bb7041Schristos out_cu_mapping. Do not create ctf_link_outputs here any more, or 219*56bb7041Schristos create per-CU dicts here: they are already created when needed. 220*56bb7041Schristos (ctf_link_one_variable): Log a debug message if we skip a 221*56bb7041Schristos variable due to its type being concealed in a CU-mapped link. 222*56bb7041Schristos (This is probably too common a case to make into a warning.) 223*56bb7041Schristos (ctf_link): Create empty per-CU dicts if requested. 224*56bb7041Schristos 225*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 226*56bb7041Schristos 227*56bb7041Schristos * ctf-link.c (ctf_link_write): Close the fd. 228*56bb7041Schristos 229*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 230*56bb7041Schristos 231*56bb7041Schristos * Makefile.am: Set -DNOBFD=1 in libctf-nobfd, and =0 elsewhere. 232*56bb7041Schristos * Makefile.in: Regenerated. 233*56bb7041Schristos * ctf-impl.h (ctf_link_input_name): New. 234*56bb7041Schristos (ctf_file_t) <ctf_link_flags>: New. 235*56bb7041Schristos * ctf-create.c (ctf_serialize): Adjust accordingly. 236*56bb7041Schristos * ctf-link.c: Define ctf_open as weak when PIC. 237*56bb7041Schristos (ctf_arc_close_thunk): Remove unnecessary thunk. 238*56bb7041Schristos (ctf_file_close_thunk): Likewise. 239*56bb7041Schristos (ctf_link_input_name): New. 240*56bb7041Schristos (ctf_link_input_t): New value of the ctf_file_t.ctf_link_input. 241*56bb7041Schristos (ctf_link_input_close): Adjust accordingly. 242*56bb7041Schristos (ctf_link_add_ctf_internal): New, split from... 243*56bb7041Schristos (ctf_link_add_ctf): ... here. Return error if lazy loading of 244*56bb7041Schristos CTF is not possible. Change to just call... 245*56bb7041Schristos (ctf_link_add): ... this new function. 246*56bb7041Schristos (ctf_link_add_cu_mapping): Transition to ctf_err_warn. Drop the 247*56bb7041Schristos ctf_file_close_thunk. 248*56bb7041Schristos (ctf_link_in_member_cb_arg_t) <file_name> Rename to... 249*56bb7041Schristos <in_file_name>: ... this. 250*56bb7041Schristos <arcname>: Drop. 251*56bb7041Schristos <share_mode>: Likewise (migrated to ctf_link_flags). 252*56bb7041Schristos <done_main_member>: Rename to... 253*56bb7041Schristos <done_parent>: ... this. 254*56bb7041Schristos <main_input_fp>: Rename to... 255*56bb7041Schristos <in_fp_parent>: ... this. 256*56bb7041Schristos <cu_mapped>: New. 257*56bb7041Schristos (ctf_link_one_type): Adjuwt accordingly. Transition to 258*56bb7041Schristos ctf_err_warn, removing a TODO. 259*56bb7041Schristos (ctf_link_one_variable): Note a case too common to warn about. 260*56bb7041Schristos Report in the debug stream if a cu-mapped link prevents addition 261*56bb7041Schristos of a conflicting variable. 262*56bb7041Schristos (ctf_link_one_input_archive_member): Adjust. 263*56bb7041Schristos (ctf_link_lazy_open): New, open a CTF archive for linking when 264*56bb7041Schristos needed. 265*56bb7041Schristos (ctf_link_close_one_input_archive): New, close it again. 266*56bb7041Schristos (ctf_link_one_input_archive): Adjust for lazy opening, member 267*56bb7041Schristos renames, and ctf_err_warn transition. Move the 268*56bb7041Schristos empty_link_type_mapping call to... 269*56bb7041Schristos (ctf_link): ... here. Adjut for renamings and thunk removal. 270*56bb7041Schristos Don't spuriously fail if some input contains no CTF data. 271*56bb7041Schristos (ctf_link_write): ctf_err_warn transition. 272*56bb7041Schristos * libctf.ver: Remove not-yet-stable comment. 273*56bb7041Schristos 274*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 275*56bb7041Schristos 276*56bb7041Schristos * ctf-impl.h (ctf_strerror): Delete. 277*56bb7041Schristos * ctf-subr.c (ctf_strerror): Likewise. 278*56bb7041Schristos * ctf-error.c (ctf_errmsg): Stop using ctf_strerror: just use 279*56bb7041Schristos strerror directly. 280*56bb7041Schristos 281*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 282*56bb7041Schristos 283*56bb7041Schristos * ctf-impl.c (ctf_file_t) <ctf_parent_unreffed>: New. 284*56bb7041Schristos (ctf_import_unref): New. 285*56bb7041Schristos * ctf-open.c (ctf_file_close) Drop the refcount all the way to 286*56bb7041Schristos zero. Don't recurse back in if the refcount is already zero. 287*56bb7041Schristos (ctf_import): Check ctf_parent_unreffed before deciding whether 288*56bb7041Schristos to close a pre-existing parent. Set it to zero. 289*56bb7041Schristos (ctf_import_unreffed): New, as above, setting 290*56bb7041Schristos ctf_parent_unreffed to 1. 291*56bb7041Schristos * ctf-create.c (ctf_serialize): Do not ctf_import into the new 292*56bb7041Schristos child: use direct assignment, and set unreffed on the new and 293*56bb7041Schristos old children. 294*56bb7041Schristos * ctf-link.c (ctf_create_per_cu): Import the parent using 295*56bb7041Schristos ctf_import_unreffed. 296*56bb7041Schristos 297*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 298*56bb7041Schristos 299*56bb7041Schristos * ctf-impl.h (ctf_link_type_mapping_key): Rename to... 300*56bb7041Schristos (ctf_link_type_key): ... this, adjusting member prefixes to 301*56bb7041Schristos match. 302*56bb7041Schristos (ctf_hash_type_mapping_key): Rename to... 303*56bb7041Schristos (ctf_hash_type_key): ... this. 304*56bb7041Schristos (ctf_hash_eq_type_mapping_key): Rename to... 305*56bb7041Schristos (ctf_hash_eq_type_key): ... this. 306*56bb7041Schristos * ctf-hash.c (ctf_hash_type_mapping_key): Rename to... 307*56bb7041Schristos (ctf_hash_type_key): ... this, and adjust for member name 308*56bb7041Schristos changes. 309*56bb7041Schristos (ctf_hash_eq_type_mapping_key): Rename to... 310*56bb7041Schristos (ctf_hash_eq_type_key): ... this, and adjust for member name 311*56bb7041Schristos changes. 312*56bb7041Schristos * ctf-link.c (ctf_add_type_mapping): Adjust. Note the lack of 313*56bb7041Schristos need for out-of-memory checking in this code. 314*56bb7041Schristos (ctf_type_mapping): Adjust. 315*56bb7041Schristos 316*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 317*56bb7041Schristos 318*56bb7041Schristos configure.ac: Check for vasprintf. 319*56bb7041Schristos configure: Regenerated. 320*56bb7041Schristos config.h.in: Likewise. 321*56bb7041Schristos 322*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 323*56bb7041Schristos 324*56bb7041Schristos * ctf-archive.c (ctf_arc_bufopen): Fix message. 325*56bb7041Schristos 326*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 327*56bb7041Schristos 328*56bb7041Schristos * ctf-impl.h (struct ctf_archive_internal) <ctfi_free_strsect> 329*56bb7041Schristos New. 330*56bb7041Schristos * ctf-open-bfd.c (ctf_bfdopen_ctfsect): Explicitly open a strtab 331*56bb7041Schristos if the input has no symtab, rather than dividing by 332*56bb7041Schristos zero. Arrange to free it later via ctfi_free_ctfsect. 333*56bb7041Schristos * ctf-archive.c (ctf_new_archive_internal): Do not 334*56bb7041Schristos ctfi_free_strsect by default. 335*56bb7041Schristos (ctf_arc_close): Possibly free it here. 336*56bb7041Schristos 337*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 338*56bb7041Schristos 339*56bb7041Schristos * ctf-dump.c (ctf_is_slice): Delete, unnecessary. 340*56bb7041Schristos (ctf_dump_format_type): improve slice formatting. Always print 341*56bb7041Schristos the type size, even of slices. 342*56bb7041Schristos (ctf_dump_member): Print slices (-> bitfields) differently from 343*56bb7041Schristos non-slices. Failure to format a type is not an OOM. 344*56bb7041Schristos 345*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 346*56bb7041Schristos 347*56bb7041Schristos * ctf-dump.c (ctf_dump_format_type): Emit a warning. 348*56bb7041Schristos (ctf_dump_label): Swallow errors from ctf_dump_format_type. 349*56bb7041Schristos (ctf_dump_objts): Likewise. 350*56bb7041Schristos (ctf_dump_var): Likewise. 351*56bb7041Schristos (ctf_dump_type): Do not emit a duplicate message. Move to 352*56bb7041Schristos ctf_err_warning, and swallow all errors. 353*56bb7041Schristos 354*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 355*56bb7041Schristos 356*56bb7041Schristos * ctf-decl.c (ctf_decl_fini): Free the cd_buf. 357*56bb7041Schristos (ctf_decl_buf): Once it escapes, don't try to free it later. 358*56bb7041Schristos 359*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 360*56bb7041Schristos 361*56bb7041Schristos * ctf-types.c (ctf_type_aname): Print arg types here... 362*56bb7041Schristos * ctf-dump.c (ctf_dump_funcs): ... not here: but do substitute 363*56bb7041Schristos in the type name here. 364*56bb7041Schristos 365*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 366*56bb7041Schristos 367*56bb7041Schristos * ctf-impl.h (ctf_assert): New. 368*56bb7041Schristos (ctf_err_warning_t): Likewise. 369*56bb7041Schristos (ctf_file_t) <ctf_errs_warnings>: Likewise. 370*56bb7041Schristos (ctf_err_warn): New prototype. 371*56bb7041Schristos (ctf_assert_fail_internal): Likewise. 372*56bb7041Schristos * ctf-inlines.h (ctf_assert_internal): Likewise. 373*56bb7041Schristos * ctf-open.c (ctf_file_close): Free ctf_errs_warnings. 374*56bb7041Schristos * ctf-create.c (ctf_serialize): Copy it on serialization. 375*56bb7041Schristos * ctf-subr.c (ctf_err_warn): New, add an error/warning. 376*56bb7041Schristos (ctf_errwarning_next): New iterator, free and pass back 377*56bb7041Schristos errors/warnings in succession. 378*56bb7041Schristos * libctf.ver (ctf_errwarning_next): Add. 379*56bb7041Schristos 380*56bb7041Schristos2020-07-22 Egeyar Bagcioglu <egeyar.bagcioglu@oracle.com> 381*56bb7041Schristos 382*56bb7041Schristos * ctf-types.c (ctf_variable_iter): Fix error return. 383*56bb7041Schristos 384*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 385*56bb7041Schristos 386*56bb7041Schristos * ctf-open.c (ctf_bufopen_internal): Diagnose invalid flags. 387*56bb7041Schristos 388*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 389*56bb7041Schristos 390*56bb7041Schristos ctf-decls.h (ctf_qsort_compar_thunk): Fix arg passing. 391*56bb7041Schristos 392*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 393*56bb7041Schristos 394*56bb7041Schristos * ctf-impl.h (ctf_next_hkv_t): New, kv-pairs passed to 395*56bb7041Schristos sorting functions. 396*56bb7041Schristos (ctf_next_t) <u.ctn_sorted_hkv>: New, sorted kv-pairs for 397*56bb7041Schristos ctf_dynhash_next_sorted. 398*56bb7041Schristos <cu.ctn_h>: New, pointer to the dynhash under iteration. 399*56bb7041Schristos <cu.ctn_s>: New, pointer to the dynset under iteration. 400*56bb7041Schristos (ctf_hash_sort_f): Sorting function passed to... 401*56bb7041Schristos (ctf_dynhash_next_sorted): ... this new function. 402*56bb7041Schristos (ctf_dynhash_next): New. 403*56bb7041Schristos (ctf_dynset_next): New. 404*56bb7041Schristos * ctf-inlines.h (ctf_dynhash_cnext_sorted): New. 405*56bb7041Schristos (ctf_dynhash_cnext): New. 406*56bb7041Schristos (ctf_dynset_cnext): New. 407*56bb7041Schristos * ctf-hash.c (ctf_dynhash_next_sorted): New. 408*56bb7041Schristos (ctf_dynhash_next): New. 409*56bb7041Schristos (ctf_dynset_next): New. 410*56bb7041Schristos * ctf-util.c (ctf_next_destroy): Free the u.ctn_sorted_hkv if 411*56bb7041Schristos needed. 412*56bb7041Schristos (ctf_next_copy): Alloc-and-copy the u.ctn_sorted_hkv if needed. 413*56bb7041Schristos 414*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 415*56bb7041Schristos 416*56bb7041Schristos * ctf-impl.h (ctf_next): New. 417*56bb7041Schristos (ctf_get_dict): New prototype. 418*56bb7041Schristos * ctf-lookup.c (ctf_get_dict): New, split out of... 419*56bb7041Schristos (ctf_lookup_by_id): ... here. 420*56bb7041Schristos * ctf-util.c (ctf_next_create): New. 421*56bb7041Schristos (ctf_next_destroy): New. 422*56bb7041Schristos (ctf_next_copy): New. 423*56bb7041Schristos * ctf-types.c (includes): Add <assert.h>. 424*56bb7041Schristos (ctf_member_next): New. 425*56bb7041Schristos (ctf_enum_next): New. 426*56bb7041Schristos (ctf_type_iter): Document the lack of iteration over parent 427*56bb7041Schristos types. 428*56bb7041Schristos (ctf_type_next): New. 429*56bb7041Schristos (ctf_variable_next): New. 430*56bb7041Schristos * ctf-archive.c (ctf_archive_next): New. 431*56bb7041Schristos * libctf.ver: Add new public functions. 432*56bb7041Schristos 433*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 434*56bb7041Schristos 435*56bb7041Schristos * libctf.ver (ctf_ref): New. 436*56bb7041Schristos * ctf-open.c (ctf_ref): Implement it. 437*56bb7041Schristos 438*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 439*56bb7041Schristos 440*56bb7041Schristos * ctf-inlines.h (ctf_forwardable_kind): New. 441*56bb7041Schristos * ctf-create.c (ctf_add_forward): Use it. 442*56bb7041Schristos 443*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 444*56bb7041Schristos 445*56bb7041Schristos * ctf-impl.h (ctf_get_ctt_size): Move definition from here... 446*56bb7041Schristos * ctf-inlines.h (ctf_get_ctt_size): ... to here. 447*56bb7041Schristos 448*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 449*56bb7041Schristos 450*56bb7041Schristos * ctf-hash.c (ctf_dynset_eq_string): New. 451*56bb7041Schristos (ctf_dynset_create): New. 452*56bb7041Schristos (DYNSET_EMPTY_ENTRY_REPLACEMENT): New. 453*56bb7041Schristos (DYNSET_DELETED_ENTRY_REPLACEMENT): New. 454*56bb7041Schristos (key_to_internal): New. 455*56bb7041Schristos (internal_to_key): New. 456*56bb7041Schristos (ctf_dynset_insert): New. 457*56bb7041Schristos (ctf_dynset_remove): New. 458*56bb7041Schristos (ctf_dynset_destroy): New. 459*56bb7041Schristos (ctf_dynset_lookup): New. 460*56bb7041Schristos (ctf_dynset_exists): New. 461*56bb7041Schristos (ctf_dynset_lookup_any): New. 462*56bb7041Schristos (ctf_hash_insert_type): Coding style. 463*56bb7041Schristos (ctf_hash_define_type): Likewise. 464*56bb7041Schristos * ctf-impl.h (ctf_dynset_t): New. 465*56bb7041Schristos (ctf_dynset_eq_string): New. 466*56bb7041Schristos (ctf_dynset_create): New. 467*56bb7041Schristos (ctf_dynset_insert): New. 468*56bb7041Schristos (ctf_dynset_remove): New. 469*56bb7041Schristos (ctf_dynset_destroy): New. 470*56bb7041Schristos (ctf_dynset_lookup): New. 471*56bb7041Schristos (ctf_dynset_exists): New. 472*56bb7041Schristos (ctf_dynset_lookup_any): New. 473*56bb7041Schristos * ctf-inlines.h (ctf_dynset_cinsert): New. 474*56bb7041Schristos 475*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 476*56bb7041Schristos 477*56bb7041Schristos * ctf-hash.c (ctf_helem_t) <key_free>: Remove. 478*56bb7041Schristos <value_free>: Likewise. 479*56bb7041Schristos <owner>: New. 480*56bb7041Schristos (ctf_dynhash_item_free): Indirect through the owner. 481*56bb7041Schristos (ctf_dynhash_create): Only pass in ctf_dynhash_item_free and 482*56bb7041Schristos allocate space for the key_free and value_free fields fields 483*56bb7041Schristos if necessary. 484*56bb7041Schristos (ctf_hashtab_insert): Likewise. Fix OOM errno value. 485*56bb7041Schristos (ctf_dynhash_insert): Only access ctf_hashtab's key_free and 486*56bb7041Schristos value_free if they will exist. Set the slot's owner, but only 487*56bb7041Schristos if it exists. 488*56bb7041Schristos (ctf_dynhash_remove): Adjust. 489*56bb7041Schristos 490*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 491*56bb7041Schristos 492*56bb7041Schristos * ctf-hash.c (ctf_hashtab_insert): Free the key passed in if 493*56bb7041Schristos there is a key-freeing function and the key already exists. 494*56bb7041Schristos 495*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 496*56bb7041Schristos 497*56bb7041Schristos * ctf-inlines.h: New file. 498*56bb7041Schristos * ctf-impl.h: Include it. 499*56bb7041Schristos (ctf_hash_iter_find_f): New typedef. 500*56bb7041Schristos (ctf_dynhash_elements): New. 501*56bb7041Schristos (ctf_dynhash_lookup_kv): New. 502*56bb7041Schristos (ctf_dynhash_iter_find): New. 503*56bb7041Schristos * ctf-hash.c (ctf_dynhash_lookup_kv): New. 504*56bb7041Schristos (ctf_traverse_find_cb_arg_t): New. 505*56bb7041Schristos (ctf_hashtab_traverse_find): New. 506*56bb7041Schristos (ctf_dynhash_iter_find): New. 507*56bb7041Schristos (ctf_dynhash_elements): New. 508*56bb7041Schristos 509*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 510*56bb7041Schristos 511*56bb7041Schristos * ctf-impl.h [!__GNUC__] (__extension__): Define to nothing. 512*56bb7041Schristos 513*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 514*56bb7041Schristos 515*56bb7041Schristos * ctf-archive.c (ctf_archive_count): New. 516*56bb7041Schristos * libctf.ver: New public function. 517*56bb7041Schristos 518*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 519*56bb7041Schristos 520*56bb7041Schristos * ctf-types.c (ctf_member_count): New. 521*56bb7041Schristos * libctf.ver: New public function. 522*56bb7041Schristos 523*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 524*56bb7041Schristos 525*56bb7041Schristos * ctf-types.c (ctf_type_kind_forwarded): New. 526*56bb7041Schristos 527*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 528*56bb7041Schristos 529*56bb7041Schristos * ctf-types.c (ctf_type_name_raw): New. 530*56bb7041Schristos (ctf_type_aname_raw): Reimplement accordingly. 531*56bb7041Schristos 532*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 533*56bb7041Schristos 534*56bb7041Schristos * ctf-subr.c (ctf_dprintf): _libctf_debug is unlikely to be set. 535*56bb7041Schristos 536*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 537*56bb7041Schristos 538*56bb7041Schristos * ctf-impl.h (struct ctf_archive_internal) 539*56bb7041Schristos <ctfi_unmap_on_close>: New. 540*56bb7041Schristos (ctf_new_archive_internal): Adjust. 541*56bb7041Schristos * ctf-archive.c (ctf_new_archive_internal): Likewise. 542*56bb7041Schristos Initialize ctfi_unmap_on_close. Adjust error path. 543*56bb7041Schristos (ctf_arc_bufopen): Adjust ctf_new_archive_internal call 544*56bb7041Schristos (unmap_on_close is 0). 545*56bb7041Schristos (ctf_arc_close): Only unmap if ctfi_unmap_on_close. 546*56bb7041Schristos * ctf-open-bfd.c (ctf_fdopen): Adjust. 547*56bb7041Schristos 548*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 549*56bb7041Schristos 550*56bb7041Schristos * ctf-types.c (ctf_type_aname): Return ECTF_CORRUPT if 551*56bb7041Schristos ints, floats or typedefs have no name. Fix comment typo. 552*56bb7041Schristos 553*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 554*56bb7041Schristos 555*56bb7041Schristos * ctf-create.c (ctf_add_slice): Support slices of any kind that 556*56bb7041Schristos resolves to an integral type. 557*56bb7041Schristos * ctf-types.c (ctf_type_encoding): Resolve the type before 558*56bb7041Schristos fishing its encoding out. 559*56bb7041Schristos 560*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 561*56bb7041Schristos 562*56bb7041Schristos * ctf-create.c (ctf_create): Mark dirty. 563*56bb7041Schristos 564*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 565*56bb7041Schristos 566*56bb7041Schristos * ctf-create.c (membcmp) Skip nameless members. 567*56bb7041Schristos 568*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 569*56bb7041Schristos 570*56bb7041Schristos * ctf-create.c (ctf_add_member_offset): Support names of "" 571*56bb7041Schristos as if they were the null pointer. 572*56bb7041Schristos 573*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 574*56bb7041Schristos 575*56bb7041Schristos * ctf-open.c (init_types): Remove typeless CTF_K_FORWARD 576*56bb7041Schristos special-casing. 577*56bb7041Schristos 578*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 579*56bb7041Schristos 580*56bb7041Schristos * ctf-types.c (ctf_type_reference): Add support for dynamic slices. 581*56bb7041Schristos 582*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 583*56bb7041Schristos 584*56bb7041Schristos * ctf-create.c (ctf_serialize): Add cast. 585*56bb7041Schristos (ctf_add_slice): Likewise. 586*56bb7041Schristos 587*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 588*56bb7041Schristos 589*56bb7041Schristos * ctf-impl.h (ctf_dtdef_t) <dtu_argv>: Fix type. 590*56bb7041Schristos * ctf-create.c (ctf_add_function): Check for unimplemented type 591*56bb7041Schristos and populate at the same time. Populate one-by-one, not via 592*56bb7041Schristos memcpy. 593*56bb7041Schristos (ctf_serialize): Remove unnecessary cast. 594*56bb7041Schristos * ctf-types.c (ctf_func_type_info): Likewise. 595*56bb7041Schristos (ctf_func_type_args): Likewise. Fix comment typo. 596*56bb7041Schristos 597*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 598*56bb7041Schristos 599*56bb7041Schristos * ctf-create.c (ctf_add_reftype): Support refs to type zero. 600*56bb7041Schristos (ctf_add_array): Support array contents of type zero. 601*56bb7041Schristos (ctf_add_function): Support arguments and return types of 602*56bb7041Schristos type zero. 603*56bb7041Schristos (ctf_add_typedef): Support typedefs to type zero. 604*56bb7041Schristos (ctf_add_member_offset): Support members of type zero, 605*56bb7041Schristos unless added at unspecified (naturally-aligned) offset. 606*56bb7041Schristos 607*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 608*56bb7041Schristos 609*56bb7041Schristos * ctf-error.c: Include <stddef.h>, for offsetof. 610*56bb7041Schristos (_ctf_errlist): Migrate to... 611*56bb7041Schristos (_ctf_errlist_t): ... this. 612*56bb7041Schristos (_ctf_erridx): New, indexes into _ctf_errlist_t. 613*56bb7041Schristos (_ctf_nerr): Remove. 614*56bb7041Schristos (ctf_errmsg): Adjust accordingly. 615*56bb7041Schristos * Makefile.am (BUILT_SOURCES): Note... 616*56bb7041Schristos (ctf-error.h): ... this new rule. 617*56bb7041Schristos * Makefile.in: Regenerate. 618*56bb7041Schristos * mkerrors.sed: New, process ctf-api.h to generate ctf-error.h. 619*56bb7041Schristos * .gitignore: New, ignore ctf-error.h. 620*56bb7041Schristos 621*56bb7041Schristos2020-07-22 Nick Alcock <nick.alcock@oracle.com> 622*56bb7041Schristos 623*56bb7041Schristos * ctf-impl.h: Fix typos in comments. 624*56bb7041Schristos 625*56bb7041Schristos2020-07-22 Nick Clifton <nickc@redhat.com> 626*56bb7041Schristos 627*56bb7041Schristos * ctf-archive.c (ctf_arc_write): Avoid calling close twice on the 628*56bb7041Schristos same file descriptor. 629*56bb7041Schristos 630*56bb7041Schristos2020-07-04 Nick Clifton <nickc@redhat.com> 631*56bb7041Schristos 632*56bb7041Schristos Binutils 2.35 branch created. 633*56bb7041Schristos 634*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 635*56bb7041Schristos 636*56bb7041Schristos * aclocal.m4: Add config/gettext-sister.m4: Shuffle into 637*56bb7041Schristos alphabetical order. 638*56bb7041Schristos * configure.ac: Add ZW_GNU_GETTEXT_SISTER_DIR. 639*56bb7041Schristos * config.h.in: Regenerated. 640*56bb7041Schristos * Makefile.in: Likewise. 641*56bb7041Schristos * configure: Likewise. 642*56bb7041Schristos 643*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 644*56bb7041Schristos 645*56bb7041Schristos * ctf-create.c: Include <unistd.h>. 646*56bb7041Schristos * ctf-open-bfd.c: Likewise. 647*56bb7041Schristos 648*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 649*56bb7041Schristos 650*56bb7041Schristos PR libctf/25120 651*56bb7041Schristos * configure.ac: Check for bswap_16, bswap_32, and bswap_64 decls. 652*56bb7041Schristos * swap.h (bswap_16): Do not assume that presence of <byteswap.h> 653*56bb7041Schristos means this is declared. 654*56bb7041Schristos (bswap_32): Likewise. 655*56bb7041Schristos (bswap_64): Likewise. 656*56bb7041Schristos (bswap_identity_64): Remove, unused. 657*56bb7041Schristos * configure: Regenerated. 658*56bb7041Schristos * config.h.in: Likewise. 659*56bb7041Schristos 660*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 661*56bb7041Schristos 662*56bb7041Schristos PR libctf/25120 663*56bb7041Schristos * ctf-impl.h (_libctf_printflike_): Add non-GNU-C fallback. 664*56bb7041Schristos (_libctf_unlikely_): Likewise. 665*56bb7041Schristos (_libctf_unused): Likewise. 666*56bb7041Schristos (_libctf_malloc_): Likewise. 667*56bb7041Schristos 668*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 669*56bb7041Schristos 670*56bb7041Schristos PR libctf/25120 671*56bb7041Schristos * ctf-archive.c (search_nametbl): No longer global: declare... 672*56bb7041Schristos (ctf_arc_open_by_name_internal): ... here. Use bsearch_r. 673*56bb7041Schristos (search_modent_by_name): Take and use ARG for the nametbl. 674*56bb7041Schristos 675*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 676*56bb7041Schristos 677*56bb7041Schristos * ctf-impl.h (ctf_new_archive_internal): Declare. 678*56bb7041Schristos (ctf_arc_bufopen): Remove. 679*56bb7041Schristos (ctf_archive_internal) <ctfi_free_symsect>: New. 680*56bb7041Schristos * ctf-archive.c (ctf_arc_close): Use it. 681*56bb7041Schristos (ctf_arc_bufopen): Fuse into... 682*56bb7041Schristos (ctf_new_archive_internal): ... this, moved across from... 683*56bb7041Schristos * ctf-open-bfd.c: ... here. 684*56bb7041Schristos (ctf_bfdopen_ctfsect): Use ctf_arc_bufopen. 685*56bb7041Schristos * libctf.ver: Add it. 686*56bb7041Schristos 687*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 688*56bb7041Schristos 689*56bb7041Schristos * ctf-create.c (ctf_add_forward): Intern in the right namespace. 690*56bb7041Schristos (ctf_dtd_delete): Remove correspondingly. 691*56bb7041Schristos (ctf_rollback): Likewise. 692*56bb7041Schristos 693*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 694*56bb7041Schristos 695*56bb7041Schristos * ctf-create.c (ctf_add_type_internal): Hand back existing types 696*56bb7041Schristos unchanged. 697*56bb7041Schristos 698*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 699*56bb7041Schristos 700*56bb7041Schristos * ctf-create.c (ctf_add_forward): Don't add forwards to 701*56bb7041Schristos types that already exist. 702*56bb7041Schristos 703*56bb7041Schristos2020-06-26 Nick Alcock <nick.alcock@oracle.com> 704*56bb7041Schristos 705*56bb7041Schristos * ctf-open.c (init_types): Only intern root-visible types. 706*56bb7041Schristos * ctf-create.c (ctf_dtd_insert): Likewise. 707*56bb7041Schristos (ctf_dtd_delete): Only remove root-visible types. 708*56bb7041Schristos (ctf_rollback): Likewise. 709*56bb7041Schristos (ctf_add_generic): Adjust. 710*56bb7041Schristos (ctf_add_struct_sized): Adjust comment. 711*56bb7041Schristos (ctf_add_union_sized): Likewise. 712*56bb7041Schristos (ctf_add_enum): Likewise. 713*56bb7041Schristos * ctf-impl.h (ctf_dtd_insert): Adjust prototype. 714*56bb7041Schristos 715*56bb7041Schristos2020-03-11 John Baldwin <jhb@FreeBSD.org> 716*56bb7041Schristos 717*56bb7041Schristos * swap.h (bswap_identity_64): Make static. 718*56bb7041Schristos 719*56bb7041Schristos2020-01-18 Nick Clifton <nickc@redhat.com> 720*56bb7041Schristos 721*56bb7041Schristos Binutils 2.34 branch created. 722*56bb7041Schristos 723*56bb7041Schristos2020-01-05 Joel Brobecker <brobecker@adacore.com> 724*56bb7041Schristos 725*56bb7041Schristos PR binutils/25155: 726*56bb7041Schristos * configure.ac: Add AC_CHECK_DECLS([asprintf]). 727*56bb7041Schristos * configure, config.h.in: Regenerate. 728*56bb7041Schristos 729*56bb7041Schristos2020-01-01 Alan Modra <amodra@gmail.com> 730*56bb7041Schristos 731*56bb7041Schristos Update year range in copyright notice of all files. 732*56bb7041Schristos 733*56bb7041Schristos2019-10-16 Simon Marchi <simon.marchi@polymtl.ca> 734*56bb7041Schristos 735*56bb7041Schristos * swap.h (bswap_16, bswap_32, bswap_64): Make static. 736*56bb7041Schristos 737*56bb7041Schristos2019-09-30 Nick Alcock <nick.alcock@oracle.com> 738*56bb7041Schristos 739*56bb7041Schristos * ctf-open.c (ctf_bufopen_internal): Fix tabdamage. 740*56bb7041Schristos * ctf-types.c (ctf_type_lname): Likewise. 741*56bb7041Schristos 742*56bb7041Schristos2019-09-23 Nick Alcock <nick.alcock@oracle.com> 743*56bb7041Schristos 744*56bb7041Schristos * ctf-open.c (ctf_import): Do not leak a ctf_file_t ref on every 745*56bb7041Schristos ctf_import after the first for a given file. 746*56bb7041Schristos 747*56bb7041Schristos2019-09-23 Nick Alcock <nick.alcock@oracle.com> 748*56bb7041Schristos 749*56bb7041Schristos * ctf-impl.h (ctf_str_append_noerr): Declare. 750*56bb7041Schristos * ctf-util.c (ctf_str_append_noerr): Define in terms of 751*56bb7041Schristos ctf_str_append. 752*56bb7041Schristos * ctf-dump.c (str_append): New, call it. 753*56bb7041Schristos (ctf_dump_format_type): Use str_append, not ctf_str_append. 754*56bb7041Schristos (ctf_dump_label): Likewise. 755*56bb7041Schristos (ctf_dump_objts): Likewise. 756*56bb7041Schristos (ctf_dump_funcs): Likewise. 757*56bb7041Schristos (ctf_dump_var): Likewise. 758*56bb7041Schristos (ctf_dump_member): Likewise. 759*56bb7041Schristos (ctf_dump_type): Likewise. 760*56bb7041Schristos (ctf_dump): Likewise. 761*56bb7041Schristos 762*56bb7041Schristos2019-09-23 Nick Alcock <nick.alcock@oracle.com> 763*56bb7041Schristos 764*56bb7041Schristos * ctf-impl.h (ctf_alloc): Remove. 765*56bb7041Schristos (ctf_free): Likewise. 766*56bb7041Schristos (ctf_strdup): Likewise. 767*56bb7041Schristos * ctf-subr.c (ctf_alloc): Remove. 768*56bb7041Schristos (ctf_free): Likewise. 769*56bb7041Schristos * ctf-util.c (ctf_strdup): Remove. 770*56bb7041Schristos 771*56bb7041Schristos * ctf-create.c (ctf_serialize): Use malloc, not ctf_alloc; free, not 772*56bb7041Schristos ctf_free; strdup, not ctf_strdup. 773*56bb7041Schristos (ctf_dtd_delete): Likewise. 774*56bb7041Schristos (ctf_dvd_delete): Likewise. 775*56bb7041Schristos (ctf_add_generic): Likewise. 776*56bb7041Schristos (ctf_add_function): Likewise. 777*56bb7041Schristos (ctf_add_enumerator): Likewise. 778*56bb7041Schristos (ctf_add_member_offset): Likewise. 779*56bb7041Schristos (ctf_add_variable): Likewise. 780*56bb7041Schristos (membadd): Likewise. 781*56bb7041Schristos (ctf_compress_write): Likewise. 782*56bb7041Schristos (ctf_write_mem): Likewise. 783*56bb7041Schristos * ctf-decl.c (ctf_decl_push): Likewise. 784*56bb7041Schristos (ctf_decl_fini): Likewise. 785*56bb7041Schristos (ctf_decl_sprintf): Likewise. Check for OOM. 786*56bb7041Schristos * ctf-dump.c (ctf_dump_append): Use malloc, not ctf_alloc; free, not 787*56bb7041Schristos ctf_free; strdup, not ctf_strdup. 788*56bb7041Schristos (ctf_dump_free): Likewise. 789*56bb7041Schristos (ctf_dump): Likewise. 790*56bb7041Schristos * ctf-open.c (upgrade_types_v1): Likewise. 791*56bb7041Schristos (init_types): Likewise. 792*56bb7041Schristos (ctf_file_close): Likewise. 793*56bb7041Schristos (ctf_bufopen_internal): Likewise. Check for OOM. 794*56bb7041Schristos (ctf_parent_name_set): Likewise: report the OOM to the caller. 795*56bb7041Schristos (ctf_cuname_set): Likewise. 796*56bb7041Schristos (ctf_import): Likewise. 797*56bb7041Schristos * ctf-string.c (ctf_str_purge_atom_refs): Use malloc, not ctf_alloc; 798*56bb7041Schristos free, not ctf_free; strdup, not ctf_strdup. 799*56bb7041Schristos (ctf_str_free_atom): Likewise. 800*56bb7041Schristos (ctf_str_create_atoms): Likewise. 801*56bb7041Schristos (ctf_str_add_ref_internal): Likewise. 802*56bb7041Schristos (ctf_str_remove_ref): Likewise. 803*56bb7041Schristos (ctf_str_write_strtab): Likewise. 804*56bb7041Schristos 805*56bb7041Schristos2019-08-09 Nick Alcock <nick.alcock@oracle.com> 806*56bb7041Schristos 807*56bb7041Schristos * ctf-types.c (ctf_type_encoding): Fix the dynamic case to 808*56bb7041Schristos work right for non-int/fps. 809*56bb7041Schristos 810*56bb7041Schristos2019-08-08 Nick Alcock <nick.alcock@oracle.com> 811*56bb7041Schristos 812*56bb7041Schristos * ctf-types.c (ctf_type_name): Don't strlen a potentially- 813*56bb7041Schristos null pointer. 814*56bb7041Schristos 815*56bb7041Schristos2019-08-07 Nick Alcock <nick.alcock@oracle.com> 816*56bb7041Schristos 817*56bb7041Schristos * ctf-impl.h (ctf_file_t) <ctf_add_processing>: New. 818*56bb7041Schristos * ctf-open.c (ctf_file_close): Free it. 819*56bb7041Schristos * ctf-create.c (ctf_serialize): Adjust. 820*56bb7041Schristos (membcmp): When reporting a conflict due to an error, report the 821*56bb7041Schristos error. 822*56bb7041Schristos (ctf_add_type): Turn into a ctf_add_processing wrapper. Rename to... 823*56bb7041Schristos (ctf_add_type_internal): ... this. Hand back types we are already 824*56bb7041Schristos in the middle of adding immediately. Hand back structs/unions with 825*56bb7041Schristos the same number of members immediately. Do not walk the dynamic 826*56bb7041Schristos list. Call ctf_add_type_internal, not ctf_add_type. Handle 827*56bb7041Schristos forwards promoted to other types and the inverse case identically. 828*56bb7041Schristos Add structs to the mapping as soon as we intern them, before they 829*56bb7041Schristos gain any members. 830*56bb7041Schristos 831*56bb7041Schristos2019-08-09 Nick Alcock <nick.alcock@oracle.com> 832*56bb7041Schristos 833*56bb7041Schristos * ctf-impl.h (ctf_names_t): New. 834*56bb7041Schristos (ctf_lookup_t) <ctf_hash>: Now a ctf_names_t, not a ctf_hash_t. 835*56bb7041Schristos (ctf_file_t) <ctf_structs>: Likewise. 836*56bb7041Schristos <ctf_unions>: Likewise. 837*56bb7041Schristos <ctf_enums>: Likewise. 838*56bb7041Schristos <ctf_names>: Likewise. 839*56bb7041Schristos <ctf_lookups>: Improve comment. 840*56bb7041Schristos <ctf_ptrtab_len>: New. 841*56bb7041Schristos <ctf_prov_strtab>: New. 842*56bb7041Schristos <ctf_str_prov_offset>: New. 843*56bb7041Schristos <ctf_dtbyname>: Remove, redundant to the names hashes. 844*56bb7041Schristos <ctf_dtnextid>: Remove, redundant to ctf_typemax. 845*56bb7041Schristos (ctf_dtdef_t) <dtd_name>: Remove. 846*56bb7041Schristos <dtd_data>: Note that the ctt_name is now populated. 847*56bb7041Schristos (ctf_str_atom_t) <csa_offset>: This is now the strtab 848*56bb7041Schristos offset for internal strings too. 849*56bb7041Schristos <csa_external_offset>: New, the external strtab offset. 850*56bb7041Schristos (CTF_INDEX_TO_TYPEPTR): Handle the LCTF_RDWR case. 851*56bb7041Schristos (ctf_name_table): New declaration. 852*56bb7041Schristos (ctf_lookup_by_rawname): Likewise. 853*56bb7041Schristos (ctf_lookup_by_rawhash): Likewise. 854*56bb7041Schristos (ctf_set_ctl_hashes): Likewise. 855*56bb7041Schristos (ctf_serialize): Likewise. 856*56bb7041Schristos (ctf_dtd_insert): Adjust. 857*56bb7041Schristos (ctf_simple_open_internal): Likewise. 858*56bb7041Schristos (ctf_bufopen_internal): Likewise. 859*56bb7041Schristos (ctf_list_empty_p): Likewise. 860*56bb7041Schristos (ctf_str_remove_ref): Likewise. 861*56bb7041Schristos (ctf_str_add): Returns uint32_t now. 862*56bb7041Schristos (ctf_str_add_ref): Likewise. 863*56bb7041Schristos (ctf_str_add_external): Now returns a boolean (int). 864*56bb7041Schristos * ctf-string.c (ctf_strraw_explicit): Check the ctf_prov_strtab 865*56bb7041Schristos for strings in the appropriate range. 866*56bb7041Schristos (ctf_str_create_atoms): Create the ctf_prov_strtab. Detect OOM 867*56bb7041Schristos when adding the null string to the new strtab. 868*56bb7041Schristos (ctf_str_free_atoms): Destroy the ctf_prov_strtab. 869*56bb7041Schristos (ctf_str_add_ref_internal): Add make_provisional argument. If 870*56bb7041Schristos make_provisional, populate the offset and fill in the 871*56bb7041Schristos ctf_prov_strtab accordingly. 872*56bb7041Schristos (ctf_str_add): Return the offset, not the string. 873*56bb7041Schristos (ctf_str_add_ref): Likewise. 874*56bb7041Schristos (ctf_str_add_external): Return a success integer. 875*56bb7041Schristos (ctf_str_remove_ref): New, remove a single ref. 876*56bb7041Schristos (ctf_str_count_strtab): Do not count the initial null string's 877*56bb7041Schristos length or the existence or length of any unreferenced internal 878*56bb7041Schristos atoms. 879*56bb7041Schristos (ctf_str_populate_sorttab): Skip atoms with no refs. 880*56bb7041Schristos (ctf_str_write_strtab): Populate the nullstr earlier. Add one 881*56bb7041Schristos to the cts_len for the null string, since it is no longer done 882*56bb7041Schristos in ctf_str_count_strtab. Adjust for csa_external_offset rename. 883*56bb7041Schristos Populate the csa_offset for both internal and external cases. 884*56bb7041Schristos Flush the ctf_prov_strtab afterwards, and reset the 885*56bb7041Schristos ctf_str_prov_offset. 886*56bb7041Schristos * ctf-create.c (ctf_grow_ptrtab): New. 887*56bb7041Schristos (ctf_create): Call it. Initialize new fields rather than old 888*56bb7041Schristos ones. Tell ctf_bufopen_internal that this is a writable dictionary. 889*56bb7041Schristos Set the ctl hashes and data model. 890*56bb7041Schristos (ctf_update): Rename to... 891*56bb7041Schristos (ctf_serialize): ... this. Leave a compatibility function behind. 892*56bb7041Schristos Tell ctf_simple_open_internal that this is a writable dictionary. 893*56bb7041Schristos Pass the new fields along from the old dictionary. Drop 894*56bb7041Schristos ctf_dtnextid and ctf_dtbyname. Use ctf_strraw, not dtd_name. 895*56bb7041Schristos Do not zero out the DTD's ctt_name. 896*56bb7041Schristos (ctf_prefixed_name): Rename to... 897*56bb7041Schristos (ctf_name_table): ... this. No longer return a prefixed name: return 898*56bb7041Schristos the applicable name table instead. 899*56bb7041Schristos (ctf_dtd_insert): Use it, and use the right name table. Pass in the 900*56bb7041Schristos kind we're adding. Migrate away from dtd_name. 901*56bb7041Schristos (ctf_dtd_delete): Adjust similarly. Remove the ref to the 902*56bb7041Schristos deleted ctt_name. 903*56bb7041Schristos (ctf_dtd_lookup_type_by_name): Remove. 904*56bb7041Schristos (ctf_dynamic_type): Always return NULL on read-only dictionaries. 905*56bb7041Schristos No longer check ctf_dtnextid: check ctf_typemax instead. 906*56bb7041Schristos (ctf_snapshot): No longer use ctf_dtnextid: use ctf_typemax instead. 907*56bb7041Schristos (ctf_rollback): Likewise. No longer fail with ECTF_OVERROLLBACK. Use 908*56bb7041Schristos ctf_name_table and the right name table, and migrate away from 909*56bb7041Schristos dtd_name as in ctf_dtd_delete. 910*56bb7041Schristos (ctf_add_generic): Pass in the kind explicitly and pass it to 911*56bb7041Schristos ctf_dtd_insert. Use ctf_typemax, not ctf_dtnextid. Migrate away 912*56bb7041Schristos from dtd_name to using ctf_str_add_ref to populate the ctt_name. 913*56bb7041Schristos Grow the ptrtab if needed. 914*56bb7041Schristos (ctf_add_encoded): Pass in the kind. 915*56bb7041Schristos (ctf_add_slice): Likewise. 916*56bb7041Schristos (ctf_add_array): Likewise. 917*56bb7041Schristos (ctf_add_function): Likewise. 918*56bb7041Schristos (ctf_add_typedef): Likewise. 919*56bb7041Schristos (ctf_add_reftype): Likewise. Initialize the ctf_ptrtab, checking 920*56bb7041Schristos ctt_name rather than dtd_name. 921*56bb7041Schristos (ctf_add_struct_sized): Pass in the kind. Use 922*56bb7041Schristos ctf_lookup_by_rawname, not ctf_hash_lookup_type / 923*56bb7041Schristos ctf_dtd_lookup_type_by_name. 924*56bb7041Schristos (ctf_add_union_sized): Likewise. 925*56bb7041Schristos (ctf_add_enum): Likewise. 926*56bb7041Schristos (ctf_add_enum_encoded): Likewise. 927*56bb7041Schristos (ctf_add_forward): Likewise. 928*56bb7041Schristos (ctf_add_type): Likewise. 929*56bb7041Schristos (ctf_compress_write): Call ctf_serialize: adjust for ctf_size not 930*56bb7041Schristos being initialized until after the call. 931*56bb7041Schristos (ctf_write_mem): Likewise. 932*56bb7041Schristos (ctf_write): Likewise. 933*56bb7041Schristos * ctf-archive.c (arc_write_one_ctf): Likewise. 934*56bb7041Schristos * ctf-lookup.c (ctf_lookup_by_name): Use ctf_lookuup_by_rawhash, not 935*56bb7041Schristos ctf_hash_lookup_type. 936*56bb7041Schristos (ctf_lookup_by_id): No longer check the readonly types if the 937*56bb7041Schristos dictionary is writable. 938*56bb7041Schristos * ctf-open.c (init_types): Assert that this dictionary is not 939*56bb7041Schristos writable. Adjust to use the new name hashes, ctf_name_table, 940*56bb7041Schristos and ctf_ptrtab_len. GNU style fix for the final ptrtab scan. 941*56bb7041Schristos (ctf_bufopen_internal): New 'writable' parameter. Flip on LCTF_RDWR 942*56bb7041Schristos if set. Drop out early when dictionary is writable. Split the 943*56bb7041Schristos ctf_lookups initialization into... 944*56bb7041Schristos (ctf_set_cth_hashes): ... this new function. 945*56bb7041Schristos (ctf_simple_open_internal): Adjust. New 'writable' parameter. 946*56bb7041Schristos (ctf_simple_open): Adjust accordingly. 947*56bb7041Schristos (ctf_bufopen): Likewise. 948*56bb7041Schristos (ctf_file_close): Destroy the appropriate name hashes. No longer 949*56bb7041Schristos destroy ctf_dtbyname, which is gone. 950*56bb7041Schristos (ctf_getdatasect): Remove spurious "extern". 951*56bb7041Schristos * ctf-types.c (ctf_lookup_by_rawname): New, look up types in the 952*56bb7041Schristos specified name table, given a kind. 953*56bb7041Schristos (ctf_lookup_by_rawhash): Likewise, given a ctf_names_t *. 954*56bb7041Schristos (ctf_member_iter): Add support for iterating over the 955*56bb7041Schristos dynamic type list. 956*56bb7041Schristos (ctf_enum_iter): Likewise. 957*56bb7041Schristos (ctf_variable_iter): Likewise. 958*56bb7041Schristos (ctf_type_rvisit): Likewise. 959*56bb7041Schristos (ctf_member_info): Add support for types in the dynamic type list. 960*56bb7041Schristos (ctf_enum_name): Likewise. 961*56bb7041Schristos (ctf_enum_value): Likewise. 962*56bb7041Schristos (ctf_func_type_info): Likewise. 963*56bb7041Schristos (ctf_func_type_args): Likewise. 964*56bb7041Schristos * ctf-link.c (ctf_accumulate_archive_names): No longer call 965*56bb7041Schristos ctf_update. 966*56bb7041Schristos (ctf_link_write): Likewise. 967*56bb7041Schristos (ctf_link_intern_extern_string): Adjust for new 968*56bb7041Schristos ctf_str_add_external return value. 969*56bb7041Schristos (ctf_link_add_strtab): Likewise. 970*56bb7041Schristos * ctf-util.c (ctf_list_empty_p): New. 971*56bb7041Schristos 972*56bb7041Schristos2019-08-05 Nick Alcock <nick.alcock@oracle.com> 973*56bb7041Schristos 974*56bb7041Schristos * ctf-types.c (ctf_type_resolve): Return ECTF_NONREPRESENTABLE on 975*56bb7041Schristos type zero. 976*56bb7041Schristos * ctf-create.c (ctf_add_type): Detect and skip nonrepresentable 977*56bb7041Schristos members and types. 978*56bb7041Schristos (ctf_add_variable): Likewise for variables pointing to them. 979*56bb7041Schristos * ctf-link.c (ctf_link_one_type): Do not warn for nonrepresentable 980*56bb7041Schristos type link failure, but do warn for others. 981*56bb7041Schristos * ctf-dump.c (ctf_dump_format_type): Likewise. Do not assume all 982*56bb7041Schristos errors to be ENOMEM. 983*56bb7041Schristos (ctf_dump_member): Likewise. 984*56bb7041Schristos (ctf_dump_type): Likewise. 985*56bb7041Schristos (ctf_dump_header_strfield): Do not assume all errors to be ENOMEM. 986*56bb7041Schristos (ctf_dump_header_sectfield): Do not assume all errors to be ENOMEM. 987*56bb7041Schristos (ctf_dump_header): Likewise. 988*56bb7041Schristos (ctf_dump_label): likewise. 989*56bb7041Schristos (ctf_dump_objts): likewise. 990*56bb7041Schristos (ctf_dump_funcs): likewise. 991*56bb7041Schristos (ctf_dump_var): likewise. 992*56bb7041Schristos (ctf_dump_str): Likewise. 993*56bb7041Schristos 994*56bb7041Schristos2019-09-30 Nick Alcock <nick.alcock@oracle.com> 995*56bb7041Schristos 996*56bb7041Schristos * configure.ac (AC_DISABLE_SHARED): New, like opcodes/. 997*56bb7041Schristos (LT_INIT): Likewise. 998*56bb7041Schristos (AM_INSTALL_LIBBFD): Likewise. 999*56bb7041Schristos (dlopen): Note why this is necessary in a comment. 1000*56bb7041Schristos (SHARED_LIBADD): Initialize for possibly-PIC libiberty: derived from 1001*56bb7041Schristos opcodes/. 1002*56bb7041Schristos (SHARED_LDFLAGS): Likewise. 1003*56bb7041Schristos (BFD_LIBADD): Likewise, for libbfd. 1004*56bb7041Schristos (BFD_DEPENDENCIES): Likewise. 1005*56bb7041Schristos (VERSION_FLAGS): Initialize, using a version script if ld supports 1006*56bb7041Schristos one, or libtool -export-symbols-regex otherwise. 1007*56bb7041Schristos (AC_CONFIG_MACRO_DIR): Add ../BFD. 1008*56bb7041Schristos * Makefile.am (ACLOCAL_AMFLAGS): Likewise. 1009*56bb7041Schristos (INCDIR): New. 1010*56bb7041Schristos (AM_CPPFLAGS): Use $(srcdir), not $(top_srcdir). 1011*56bb7041Schristos (noinst_LIBRARIES): Replace with... 1012*56bb7041Schristos [INSTALL_LIBBFD] (lib_LTLIBRARIES): This, or... 1013*56bb7041Schristos [!INSTALL_LIBBFD] (noinst_LTLIBRARIES): ... this, mentioning new 1014*56bb7041Schristos libctf-nobfd.la as well. 1015*56bb7041Schristos [INSTALL_LIBCTF] (include_HEADERS): Add the CTF headers. 1016*56bb7041Schristos [!INSTALL_LIBCTF] (include_HEADERS): New, empty. 1017*56bb7041Schristos (libctf_a_SOURCES): Rename to... 1018*56bb7041Schristos (libctf_nobfd_la_SOURCES): ... this, all of libctf other than 1019*56bb7041Schristos ctf-open-bfd.c. 1020*56bb7041Schristos (libctf_la_SOURCES): Now derived from libctf_nobfd_la_SOURCES, 1021*56bb7041Schristos with ctf-open-bfd.c added. 1022*56bb7041Schristos (libctf_nobfd_la_LIBADD): New, using @SHARED_LIBADD@. 1023*56bb7041Schristos (libctf_la_LIBADD): New, using @BFD_LIBADD@ as well. 1024*56bb7041Schristos (libctf_la_DEPENDENCIES): New, using @BFD_DEPENDENCIES@. 1025*56bb7041Schristos * Makefile.am [INSTALL_LIBCTF]: Use it. 1026*56bb7041Schristos * aclocal.m4: Add ../bfd/acinclude.m4, ../config/acx.m4, and the 1027*56bb7041Schristos libtool macros. 1028*56bb7041Schristos * libctf.ver: New, everything is version LIBCTF_1.0 currently (even 1029*56bb7041Schristos the unstable components). 1030*56bb7041Schristos * Makefile.in: Regenerated. 1031*56bb7041Schristos * config.h.in: Likewise. 1032*56bb7041Schristos * configure: Likewise. 1033*56bb7041Schristos 1034*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1035*56bb7041Schristos 1036*56bb7041Schristos * configure.ac (INSTALL_LIBCTF): New, controlled by 1037*56bb7041Schristos --enable-install-libctf. 1038*56bb7041Schristos [INSTALL_LIBCTF] (lib_LIBRARIES): Add libctf.a. 1039*56bb7041Schristos * Makefile.in: Regenerated. 1040*56bb7041Schristos * configure: Regenerated. 1041*56bb7041Schristos 1042*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1043*56bb7041Schristos 1044*56bb7041Schristos * ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set. 1045*56bb7041Schristos * ctf-open-bfd.c (ctf_bfdclose): Fix comment. 1046*56bb7041Schristos 1047*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1048*56bb7041Schristos 1049*56bb7041Schristos * ctf-open-bfd.c (ctf_fdopen): Call bfd_set_cacheable. 1050*56bb7041Schristos 1051*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1052*56bb7041Schristos 1053*56bb7041Schristos * ctf-impl.h (includes): Include <sys/param.h> here. 1054*56bb7041Schristos 1055*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1056*56bb7041Schristos 1057*56bb7041Schristos * ctf-open.c (flip_lbls): Eschew for-loop initial declarations. 1058*56bb7041Schristos (flip_objts): Likewise. 1059*56bb7041Schristos (flip_vars): Likewise. 1060*56bb7041Schristos (flip_types): Likewise. 1061*56bb7041Schristos 1062*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1063*56bb7041Schristos 1064*56bb7041Schristos * ctf-hash.c (ctf_hashtab_insert): Pass in the key and value 1065*56bb7041Schristos freeing functions: if set, free the key and value if the slot 1066*56bb7041Schristos already exists. Always reassign the key. 1067*56bb7041Schristos (ctf_dynhash_insert): Adjust call appropriately. 1068*56bb7041Schristos (ctf_hash_insert_type): Likewise. 1069*56bb7041Schristos 1070*56bb7041Schristos2019-08-03 Nick Alcock <nick.alcock@oracle.com> 1071*56bb7041Schristos 1072*56bb7041Schristos * ctf-create.c (ctf_add_type): Look up and use the forwarded-to 1073*56bb7041Schristos type kind. Allow forwards to unify with pre-existing structs/ 1074*56bb7041Schristos unions/enums. 1075*56bb7041Schristos 1076*56bb7041Schristos2019-07-30 Nick Alcock <nick.alcock@oracle.com> 1077*56bb7041Schristos 1078*56bb7041Schristos * ctf-impl.h (ctf_file_t) <ctf_link_cu_mappping>: New. 1079*56bb7041Schristos <ctf_link_memb_name_changer>: Likewise. 1080*56bb7041Schristos <ctf_link_memb_name_changer_arg>: Likewise. 1081*56bb7041Schristos * ctf-create.c (ctf_update): Update accordingly. 1082*56bb7041Schristos * ctf-open.c (ctf_file_close): Likewise. 1083*56bb7041Schristos * ctf-link.c (ctf_create_per_cu): Apply the cu mapping. 1084*56bb7041Schristos (ctf_link_add_cu_mapping): New. 1085*56bb7041Schristos (ctf_link_set_memb_name_changer): Likewise. 1086*56bb7041Schristos (ctf_change_parent_name): New. 1087*56bb7041Schristos (ctf_name_list_accum_cb_arg_t) <dynames>: New, storage for names 1088*56bb7041Schristos allocated by the caller's ctf_link_memb_name_changer. 1089*56bb7041Schristos <ndynames>: Likewise. 1090*56bb7041Schristos (ctf_accumulate_archive_names): Call the ctf_link_memb_name_changer. 1091*56bb7041Schristos (ctf_link_write): Likewise (for _CTF_SECTION only): also call 1092*56bb7041Schristos ctf_change_parent_name. Free any resulting names. 1093*56bb7041Schristos 1094*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1095*56bb7041Schristos 1096*56bb7041Schristos * ctf-link.c (ctf_create_per_cu): New, refactored out of... 1097*56bb7041Schristos (ctf_link_one_type): ... here, with parent-name setting added. 1098*56bb7041Schristos (check_variable): New. 1099*56bb7041Schristos (ctf_link_one_variable): Likewise. 1100*56bb7041Schristos (ctf_link_one_input_archive_member): Call it. 1101*56bb7041Schristos * ctf-error.c (_ctf_errlist): Updated with new errors. 1102*56bb7041Schristos 1103*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1104*56bb7041Schristos 1105*56bb7041Schristos * ctf-impl.h (ctf_file_t): New field ctf_link_type_mapping. 1106*56bb7041Schristos (struct ctf_link_type_mapping_key): New. 1107*56bb7041Schristos (ctf_hash_type_mapping_key): Likewise. 1108*56bb7041Schristos (ctf_hash_eq_type_mapping_key): Likewise. 1109*56bb7041Schristos (ctf_add_type_mapping): Likewise. 1110*56bb7041Schristos (ctf_type_mapping): Likewise. 1111*56bb7041Schristos (ctf_dynhash_empty): Likewise. 1112*56bb7041Schristos * ctf-open.c (ctf_file_close): Update accordingly. 1113*56bb7041Schristos * ctf-create.c (ctf_update): Likewise. 1114*56bb7041Schristos (ctf_add_type): Populate the mapping. 1115*56bb7041Schristos * ctf-hash.c (ctf_hash_type_mapping_key): Hash a type mapping key. 1116*56bb7041Schristos (ctf_hash_eq_type_mapping_key): Check the key for equality. 1117*56bb7041Schristos (ctf_dynhash_insert): Fix comment typo. 1118*56bb7041Schristos (ctf_dynhash_empty): New. 1119*56bb7041Schristos * ctf-link.c (ctf_add_type_mapping): New. 1120*56bb7041Schristos (ctf_type_mapping): Likewise. 1121*56bb7041Schristos (empty_link_type_mapping): New. 1122*56bb7041Schristos (ctf_link_one_input_archive): Call it. 1123*56bb7041Schristos 1124*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1125*56bb7041Schristos 1126*56bb7041Schristos * ctf-link.c: New file, linking of the string and type sections. 1127*56bb7041Schristos * Makefile.am (libctf_a_SOURCES): Add it. 1128*56bb7041Schristos * Makefile.in: Regenerate. 1129*56bb7041Schristos 1130*56bb7041Schristos * ctf-impl.h (ctf_file_t): New fields ctf_link_inputs, 1131*56bb7041Schristos ctf_link_outputs. 1132*56bb7041Schristos * ctf-create.c (ctf_update): Update accordingly. 1133*56bb7041Schristos * ctf-open.c (ctf_file_close): Likewise. 1134*56bb7041Schristos * ctf-error.c (_ctf_errlist): Updated with new errors. 1135*56bb7041Schristos 1136*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1137*56bb7041Schristos 1138*56bb7041Schristos * ctf-dump.c (ctf_dump_funcs): Check the right error value. 1139*56bb7041Schristos 1140*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1141*56bb7041Schristos 1142*56bb7041Schristos * ctf-dump.c (ctf_dump): Use ctf_type_iter_all to dump types, not 1143*56bb7041Schristos ctf_type_iter. 1144*56bb7041Schristos (ctf_dump_type): Pass down the flag from ctf_type_iter_all. 1145*56bb7041Schristos (ctf_dump_format_type): Add non-root-type { } notation. 1146*56bb7041Schristos Add root flag to prototype. 1147*56bb7041Schristos (ctf_dump_label): Adjust accordingly. 1148*56bb7041Schristos (ctf_dump_objts): Likewise. 1149*56bb7041Schristos (ctf_dump_var): Likewise. 1150*56bb7041Schristos 1151*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1152*56bb7041Schristos 1153*56bb7041Schristos * ctf-create.c (ctf_compress_write): Fix double-free. 1154*56bb7041Schristos 1155*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1156*56bb7041Schristos 1157*56bb7041Schristos * ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms 1158*56bb7041Schristos of... 1159*56bb7041Schristos (ctf_arc_write_fd): ... this new function. 1160*56bb7041Schristos * ctf-create.c (ctf_write_mem): New. 1161*56bb7041Schristos 1162*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1163*56bb7041Schristos 1164*56bb7041Schristos * ctf-impl.h (ctf_str_atom_t) <csa_offset>: New field. 1165*56bb7041Schristos (ctf_file_t) <ctf_syn_ext_strtab>: Likewise. 1166*56bb7041Schristos (ctf_str_add_ref): Name the last arg. 1167*56bb7041Schristos (ctf_str_add_external) New. 1168*56bb7041Schristos (ctf_str_add_strraw_explicit): Likewise. 1169*56bb7041Schristos (ctf_simple_open_internal): Likewise. 1170*56bb7041Schristos (ctf_bufopen_internal): Likewise. 1171*56bb7041Schristos 1172*56bb7041Schristos * ctf-string.c (ctf_strraw_explicit): Split from... 1173*56bb7041Schristos (ctf_strraw): ... here, with new support for ctf_syn_ext_strtab. 1174*56bb7041Schristos (ctf_str_add_ref_internal): Return the atom, not the 1175*56bb7041Schristos string. 1176*56bb7041Schristos (ctf_str_add): Adjust accordingly. 1177*56bb7041Schristos (ctf_str_add_ref): Likewise. Move up in the file. 1178*56bb7041Schristos (ctf_str_add_external): New: update the csa_offset. 1179*56bb7041Schristos (ctf_str_count_strtab): Only account for strings with no csa_offset 1180*56bb7041Schristos in the internal strtab length. 1181*56bb7041Schristos (ctf_str_write_strtab): If the csa_offset is set, update the 1182*56bb7041Schristos string's refs without writing the string out, and update the 1183*56bb7041Schristos ctf_syn_ext_strtab. Make OOM handling less ugly. 1184*56bb7041Schristos * ctf-create.c (struct ctf_sort_var_arg_cb): New. 1185*56bb7041Schristos (ctf_update): Handle failure to populate the strtab. Pass in the 1186*56bb7041Schristos new ctf_sort_var arg. Adjust for ctf_syn_ext_strtab addition. 1187*56bb7041Schristos Call ctf_simple_open_internal, not ctf_simple_open. 1188*56bb7041Schristos (ctf_sort_var): Call ctf_strraw_explicit rather than looking up 1189*56bb7041Schristos strings by hand. 1190*56bb7041Schristos * ctf-hash.c (ctf_hash_insert_type): Likewise (but using 1191*56bb7041Schristos ctf_strraw). Adjust to diagnose ECTF_STRTAB nonetheless. 1192*56bb7041Schristos * ctf-open.c (init_types): No longer filter out ECTF_STRTAB. 1193*56bb7041Schristos (ctf_file_close): Destroy the ctf_syn_ext_strtab. 1194*56bb7041Schristos (ctf_simple_open): Rename to, and reimplement as a wrapper around... 1195*56bb7041Schristos (ctf_simple_open_internal): ... this new function, which calls 1196*56bb7041Schristos ctf_bufopen_internal. 1197*56bb7041Schristos (ctf_bufopen): Rename to, and reimplement as a wrapper around... 1198*56bb7041Schristos (ctf_bufopen_internal): ... this new function, which sets 1199*56bb7041Schristos ctf_syn_ext_strtab. 1200*56bb7041Schristos 1201*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1202*56bb7041Schristos 1203*56bb7041Schristos * ctf_types.c (ctf_type_iter_all): New. 1204*56bb7041Schristos 1205*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1206*56bb7041Schristos 1207*56bb7041Schristos * ctf-open.c (init_symtab): Check for overflow against the right 1208*56bb7041Schristos section. 1209*56bb7041Schristos (upgrade_header): Set cth_objtidxoff, cth_funcidxoff to zero-length. 1210*56bb7041Schristos (upgrade_types_v1): Note that these sections are not checked. 1211*56bb7041Schristos (flip_header): Endian-swap the header fields. 1212*56bb7041Schristos (flip_ctf): Endian-swap the sections. 1213*56bb7041Schristos (flip_objts): Update comment. 1214*56bb7041Schristos (ctf_bufopen): Check header offsets and alignment for validity. 1215*56bb7041Schristos 1216*56bb7041Schristos2019-07-13 Nick Alcock <nick.alcock@oracle.com> 1217*56bb7041Schristos 1218*56bb7041Schristos * ctf-open-bfd.c: Add <assert.h>. 1219*56bb7041Schristos (ctf_bfdopen_ctfsect): Open string and symbol tables using 1220*56bb7041Schristos techniques borrowed from bfd_elf_sym_name. 1221*56bb7041Schristos (ctf_new_archive_internal): Improve comment. 1222*56bb7041Schristos * ctf-archive.c (ctf_arc_close): Do not free the ctfi_strsect. 1223*56bb7041Schristos * ctf-open.c (ctf_bufopen): Allow opening with a string section but 1224*56bb7041Schristos no symbol section, but not vice versa. 1225*56bb7041Schristos 1226*56bb7041Schristos2019-07-08 Nick Alcock <nick.alcock@oracle.com> 1227*56bb7041Schristos 1228*56bb7041Schristos * ctf-impl.h (ctf_file_t): New field ctf_openflags. 1229*56bb7041Schristos * ctf-open.c (ctf_bufopen): Set it. No longer dump header offsets. 1230*56bb7041Schristos * ctf-dump.c (dump_header): New function, dump the CTF header. 1231*56bb7041Schristos (ctf_dump): Call it. 1232*56bb7041Schristos (ctf_dump_header_strfield): New function. 1233*56bb7041Schristos (ctf_dump_header_sectfield): Likewise. 1234*56bb7041Schristos 1235*56bb7041Schristos2019-07-06 Nick Alcock <nick.alcock@oracle.com> 1236*56bb7041Schristos 1237*56bb7041Schristos * ctf-impl.h (ctf_file_t): New fields ctf_header, ctf_dynbase, 1238*56bb7041Schristos ctf_cuname, ctf_dyncuname: ctf_base and ctf_buf are no longer const. 1239*56bb7041Schristos * ctf-open.c (ctf_set_base): Preserve the gap between ctf_buf and 1240*56bb7041Schristos ctf_base: do not assume that it is always sizeof (ctf_header_t). 1241*56bb7041Schristos Print out ctf_cuname: only print out ctf_parname if set. 1242*56bb7041Schristos (ctf_free_base): Removed, ctf_base is no longer freed: free 1243*56bb7041Schristos ctf_dynbase instead. 1244*56bb7041Schristos (ctf_set_version): Fix spacing. 1245*56bb7041Schristos (upgrade_header): New, in-place header upgrading. 1246*56bb7041Schristos (upgrade_types): Rename to... 1247*56bb7041Schristos (upgrade_types_v1): ... this. Free ctf_dynbase, not ctf_base. No 1248*56bb7041Schristos longer track old and new headers separately. No longer allow for 1249*56bb7041Schristos header sizes explicitly: squeeze the headers out on upgrade (they 1250*56bb7041Schristos are preserved in fp->ctf_header). Set ctf_dynbase, ctf_base and 1251*56bb7041Schristos ctf_buf explicitly. Use ctf_free, not ctf_free_base. 1252*56bb7041Schristos (upgrade_types): New, also handle ctf_parmax updating. 1253*56bb7041Schristos (flip_header): Flip ctf_cuname. 1254*56bb7041Schristos (flip_types): Flip BUF explicitly rather than deriving BUF from 1255*56bb7041Schristos BASE. 1256*56bb7041Schristos (ctf_bufopen): Store the header in fp->ctf_header. Correct minimum 1257*56bb7041Schristos required alignment of objtoff and funcoff. No longer store it in 1258*56bb7041Schristos the ctf_buf unless that buf is derived unmodified from the input. 1259*56bb7041Schristos Set ctf_dynbase where ctf_base is dynamically allocated. Drop locals 1260*56bb7041Schristos that duplicate fields in ctf_file: move allocation of ctf_file 1261*56bb7041Schristos further up instead. Call upgrade_header as needed. Move 1262*56bb7041Schristos version-specific ctf_parmax initialization into upgrade_types. More 1263*56bb7041Schristos concise error handling. 1264*56bb7041Schristos (ctf_file_close): No longer test for null pointers before freeing. 1265*56bb7041Schristos Free ctf_dyncuname, ctf_dynbase, and ctf_header. Do not call 1266*56bb7041Schristos ctf_free_base. 1267*56bb7041Schristos (ctf_cuname): New. 1268*56bb7041Schristos (ctf_cuname_set): New. 1269*56bb7041Schristos * ctf-create.c (ctf_update): Populate ctf_cuname. 1270*56bb7041Schristos (ctf_gzwrite): Write out the header explicitly. Remove obsolescent 1271*56bb7041Schristos comment. 1272*56bb7041Schristos (ctf_write): Likewise. 1273*56bb7041Schristos (ctf_compress_write): Get the header from ctf_header, not ctf_base. 1274*56bb7041Schristos Fix the compression length: fp->ctf_size never counted the CTF 1275*56bb7041Schristos header. Simplify the compress call accordingly. 1276*56bb7041Schristos 1277*56bb7041Schristos2019-07-11 Hans-Peter Nilsson <hp@bitrange.com> 1278*56bb7041Schristos 1279*56bb7041Schristos * ctf-endian.h: Don't assume htole64 and le64toh are always 1280*56bb7041Schristos present if HAVE_ENDIAN_H; also check if htole64 is defined. 1281*56bb7041Schristos [!WORDS_BIGENDIAN] (htole64, le64toh): Define as identity, 1282*56bb7041Schristos not bswap_identity_64. 1283*56bb7041Schristos 1284*56bb7041Schristos2019-09-18 Alan Modra <amodra@gmail.com> 1285*56bb7041Schristos 1286*56bb7041Schristos * ctf-open-bfd.c: Update throughout for bfd section macro changes. 1287*56bb7041Schristos 1288*56bb7041Schristos2019-09-09 Phil Blundell <pb@pbcl.net> 1289*56bb7041Schristos 1290*56bb7041Schristos binutils 2.33 branch created. 1291*56bb7041Schristos 1292*56bb7041Schristos2019-07-18 Nick Alcock <nick.alcock@oracle.com> 1293*56bb7041Schristos 1294*56bb7041Schristos * ctf-types.c (ctf_type_aname_raw): New. 1295*56bb7041Schristos (ctf_func_type_info): Likewise. 1296*56bb7041Schristos (ctf_func_type_args): Likewise. 1297*56bb7041Schristos * ctf-error.c (_ctf_errlist): Fix description. 1298*56bb7041Schristos * ctf-lookup.c: Fix file description. 1299*56bb7041Schristos 1300*56bb7041Schristos2019-06-28 Nick Alcock <nick.alcock@oracle.com> 1301*56bb7041Schristos 1302*56bb7041Schristos * ctf-create.c (ctf_create): Fix off-by-one error. 1303*56bb7041Schristos 1304*56bb7041Schristos2019-06-28 Nick Alcock <nick.alcock@oracle.com> 1305*56bb7041Schristos 1306*56bb7041Schristos * ctf-impl.h: (struct ctf_strs_writable): New, non-const version of 1307*56bb7041Schristos struct ctf_strs. 1308*56bb7041Schristos (struct ctf_dtdef): Note that dtd_data.ctt_name is unpopulated. 1309*56bb7041Schristos (struct ctf_str_atom): New, disambiguated single string. 1310*56bb7041Schristos (struct ctf_str_atom_ref): New, points to some other location that 1311*56bb7041Schristos references this string's offset. 1312*56bb7041Schristos (struct ctf_file): New members ctf_str_atoms and ctf_str_num_refs. 1313*56bb7041Schristos Remove member ctf_dtvstrlen: we no longer track the total strlen 1314*56bb7041Schristos as we add strings. 1315*56bb7041Schristos (ctf_str_create_atoms): Declare new function in ctf-string.c. 1316*56bb7041Schristos (ctf_str_free_atoms): Likewise. 1317*56bb7041Schristos (ctf_str_add): Likewise. 1318*56bb7041Schristos (ctf_str_add_ref): Likewise. 1319*56bb7041Schristos (ctf_str_rollback): Likewise. 1320*56bb7041Schristos (ctf_str_purge_refs): Likewise. 1321*56bb7041Schristos (ctf_str_write_strtab): Likewise. 1322*56bb7041Schristos (ctf_realloc): Declare new function in ctf-util.c. 1323*56bb7041Schristos 1324*56bb7041Schristos * ctf-open.c (ctf_bufopen): Create the atoms table. 1325*56bb7041Schristos (ctf_file_close): Destroy it. 1326*56bb7041Schristos * ctf-create.c (ctf_update): Copy-and-free it on update. No longer 1327*56bb7041Schristos special-case the position of the parname string. Construct the 1328*56bb7041Schristos strtab by calling ctf_str_add_ref and ctf_str_write_strtab after the 1329*56bb7041Schristos rest of each buffer element is constructed, not via open-coding: 1330*56bb7041Schristos realloc the CTF buffer and append the strtab to it. No longer 1331*56bb7041Schristos maintain ctf_dtvstrlen. Sort the variable entry table later, after 1332*56bb7041Schristos strtab construction. 1333*56bb7041Schristos (ctf_copy_membnames): Remove: integrated into ctf_copy_{s,l,e}members. 1334*56bb7041Schristos (ctf_copy_smembers): Drop the string offset: call ctf_str_add_ref 1335*56bb7041Schristos after buffer element construction instead. 1336*56bb7041Schristos (ctf_copy_lmembers): Likewise. 1337*56bb7041Schristos (ctf_copy_emembers): Likewise. 1338*56bb7041Schristos (ctf_create): No longer maintain the ctf_dtvstrlen. 1339*56bb7041Schristos (ctf_dtd_delete): Likewise. 1340*56bb7041Schristos (ctf_dvd_delete): Likewise. 1341*56bb7041Schristos (ctf_add_generic): Likewise. 1342*56bb7041Schristos (ctf_add_enumerator): Likewise. 1343*56bb7041Schristos (ctf_add_member_offset): Likewise. 1344*56bb7041Schristos (ctf_add_variable): Likewise. 1345*56bb7041Schristos (membadd): Likewise. 1346*56bb7041Schristos * ctf-util.c (ctf_realloc): New, wrapper around realloc that aborts 1347*56bb7041Schristos if there are active ctf_str_num_refs. 1348*56bb7041Schristos (ctf_strraw): Move to ctf-string.c. 1349*56bb7041Schristos (ctf_strptr): Likewise. 1350*56bb7041Schristos * ctf-string.c: New file, strtab manipulation. 1351*56bb7041Schristos 1352*56bb7041Schristos * Makefile.am (libctf_a_SOURCES): Add it. 1353*56bb7041Schristos * Makefile.in: Regenerate. 1354*56bb7041Schristos 1355*56bb7041Schristos2019-06-28 Nick Alcock <nick.alcock@oracle.com> 1356*56bb7041Schristos 1357*56bb7041Schristos * ctf-impl.h (ctf_hash_iter_f): New. 1358*56bb7041Schristos (ctf_dynhash_iter): New declaration. 1359*56bb7041Schristos (ctf_dynhash_iter_remove): New declaration. 1360*56bb7041Schristos * ctf-hash.c (ctf_dynhash_iter): Define. 1361*56bb7041Schristos (ctf_dynhash_iter_remove): Likewise. 1362*56bb7041Schristos (ctf_hashtab_traverse): New. 1363*56bb7041Schristos (ctf_hashtab_traverse_remove): Likewise. 1364*56bb7041Schristos (struct ctf_traverse_cb_arg): Likewise. 1365*56bb7041Schristos (struct ctf_traverse_remove_cb_arg): Likewise. 1366*56bb7041Schristos 1367*56bb7041Schristos2019-06-28 Nick Alcock <nick.alcock@oracle.com> 1368*56bb7041Schristos 1369*56bb7041Schristos * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element. 1370*56bb7041Schristos 1371*56bb7041Schristos2019-06-28 Nick Alcock <nick.alcock@oracle.com> 1372*56bb7041Schristos 1373*56bb7041Schristos * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x. 1374*56bb7041Schristos (ctf_dump_funcs): Likewise. 1375*56bb7041Schristos 1376*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1377*56bb7041Schristos 1378*56bb7041Schristos * ctf-open-bfd.c: Add swap.h and ctf-endian.h. 1379*56bb7041Schristos (ctf_fdopen): Check for endian-swapped raw CTF magic, and 1380*56bb7041Schristos little-endian CTF archive magic. Do not check the CTF version: 1381*56bb7041Schristos ctf_simple_open does that in endian-safe ways. Do not dereference 1382*56bb7041Schristos null pointers on open failure. 1383*56bb7041Schristos 1384*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1385*56bb7041Schristos 1386*56bb7041Schristos * ctf-open.c (get_vbytes_common): Return the new slice size. 1387*56bb7041Schristos (ctf_bufopen): Flip the endianness of the CTF-section header copy. 1388*56bb7041Schristos Remember to copy in the CTF data when opening an uncompressed 1389*56bb7041Schristos foreign-endian CTF file. Prune useless variable manipulation. 1390*56bb7041Schristos 1391*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1392*56bb7041Schristos 1393*56bb7041Schristos * ctf-open.c (ctf_types): Fail when unidentified type kinds are 1394*56bb7041Schristos seen. 1395*56bb7041Schristos 1396*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1397*56bb7041Schristos 1398*56bb7041Schristos * ctf-open.c (ctf_bufopen): Dump header offsets into the debugging 1399*56bb7041Schristos output. 1400*56bb7041Schristos 1401*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1402*56bb7041Schristos 1403*56bb7041Schristos * ctf-subr.c (_PAGESIZE): Remove. 1404*56bb7041Schristos (ctf_data_alloc): Likewise. 1405*56bb7041Schristos (ctf_data_free): Likewise. 1406*56bb7041Schristos (ctf_data_protect): Likewise. 1407*56bb7041Schristos * ctf-impl.h: Remove declarations. 1408*56bb7041Schristos * ctf-create.c (ctf_update): No longer call ctf_data_protect: use 1409*56bb7041Schristos ctf_free, not ctf_data_free. 1410*56bb7041Schristos (ctf_compress_write): Use ctf_data_alloc, not ctf_alloc. Free 1411*56bb7041Schristos the buffer again on compression error. 1412*56bb7041Schristos * ctf-open.c (ctf_set_base): No longer track the size: call 1413*56bb7041Schristos ctf_free, not ctf_data_free. 1414*56bb7041Schristos (upgrade_types): Likewise. Call ctf_alloc, not ctf_data_alloc. 1415*56bb7041Schristos (ctf_bufopen): Likewise. No longer call ctf_data_protect. 1416*56bb7041Schristos 1417*56bb7041Schristos2019-06-19 Nick Alcock <nick.alcock@oracle.com> 1418*56bb7041Schristos 1419*56bb7041Schristos * ctf-create.c (ctf_dtd_insert): Pass on error returns from 1420*56bb7041Schristos ctf_dynhash_insert. 1421*56bb7041Schristos (ctf_dvd_insert): Likewise. 1422*56bb7041Schristos (ctf_add_generic): Likewise. 1423*56bb7041Schristos (ctf_add_variable): Likewise. 1424*56bb7041Schristos * ctf-impl.h: Adjust declarations. 1425*56bb7041Schristos 1426*56bb7041Schristos2019-06-14 Alan Modra <amodra@gmail.com> 1427*56bb7041Schristos 1428*56bb7041Schristos * configure: Regenerate. 1429*56bb7041Schristos 1430*56bb7041Schristos2019-06-06 Nick Alcock <nick.alcock@oracle.com> 1431*56bb7041Schristos 1432*56bb7041Schristos * ctf-decls.h: Include <libiberty.h>. 1433*56bb7041Schristos * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup(). 1434*56bb7041Schristos 1435*56bb7041Schristos2019-06-06 Nick Alcock <nick.alcock@oracle.com> 1436*56bb7041Schristos 1437*56bb7041Schristos * ctf-dump.c (ctf_dump_format_type): Cast size_t's used in printf()s. 1438*56bb7041Schristos (ctf_dump_objts): Likewise. 1439*56bb7041Schristos (ctf_dump_funcs): Likewise. 1440*56bb7041Schristos (ctf_dump_member): Likewise. 1441*56bb7041Schristos (ctf_dump_str): Likewise. 1442*56bb7041Schristos 1443*56bb7041Schristos2019-06-06 Nick Alcock <nick.alcock@oracle.com> 1444*56bb7041Schristos 1445*56bb7041Schristos * ctf-archive.c (arc_mmap_header): Mark fd as potentially unused. 1446*56bb7041Schristos * ctf-subr.c (ctf_data_protect): Mark both args as potentially unused. 1447*56bb7041Schristos 1448*56bb7041Schristos2019-06-05 Nick Alcock <nick.alcock@oracle.com> 1449*56bb7041Schristos 1450*56bb7041Schristos * ctf-archive.c (ctf_arc_write): Eschew %zi format specifier. 1451*56bb7041Schristos (ctf_arc_open_by_offset): Likewise. 1452*56bb7041Schristos * ctf-create.c (ctf_add_type): Likewise. 1453*56bb7041Schristos 1454*56bb7041Schristos2019-06-04 Tom Tromey <tromey@adacore.com> 1455*56bb7041Schristos 1456*56bb7041Schristos * ctf-create.c (ctf_add_encoded, ctf_add_slice) 1457*56bb7041Schristos (ctf_add_member_offset): Use CHAR_BIT, not NBBY. 1458*56bb7041Schristos 1459*56bb7041Schristos2019-06-04 Nick Alcock <nick.alcock@oracle.com> 1460*56bb7041Schristos 1461*56bb7041Schristos * configure.ac: Check for O_CLOEXEC. 1462*56bb7041Schristos * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be. 1463*56bb7041Schristos * config.h.in: Regenerate. 1464*56bb7041Schristos * configure: Likewise. 1465*56bb7041Schristos 1466*56bb7041Schristos2019-06-04 Nick Alcock <nick.alcock@oracle.com> 1467*56bb7041Schristos 1468*56bb7041Schristos * qsort_r.c: Rename to... 1469*56bb7041Schristos * ctf-qsort_r.c: ... this. 1470*56bb7041Schristos (_quicksort): Define to ctf_qsort_r. 1471*56bb7041Schristos * ctf-decls.h (qsort_r): Remove. 1472*56bb7041Schristos (ctf_qsort_r): Add. 1473*56bb7041Schristos (struct ctf_qsort_arg): New, transport the real ARG and COMPAR. 1474*56bb7041Schristos (ctf_qsort_compar_thunk): Rearrange the arguments to COMPAR. 1475*56bb7041Schristos * Makefile.am (libctf_a_LIBADD): Remove. 1476*56bb7041Schristos (libctf_a_SOURCES): New, add ctf-qsort_r.c. 1477*56bb7041Schristos * ctf-archive.c (ctf_arc_write): Call ctf_qsort_r, not qsort_r. 1478*56bb7041Schristos * ctf-create.c (ctf_update): Likewise. 1479*56bb7041Schristos * configure.ac: Check for BSD versus GNU qsort_r signature. 1480*56bb7041Schristos * Makefile.in: Regenerate. 1481*56bb7041Schristos * config.h.in: Likewise. 1482*56bb7041Schristos * configure: Likewise. 1483*56bb7041Schristos 1484*56bb7041Schristos2019-06-03 Nick Alcock <nick.alcock@oracle.com> 1485*56bb7041Schristos 1486*56bb7041Schristos * ctf-dump.c (ctf_dump_funcs): Free in the right place. 1487*56bb7041Schristos 1488*56bb7041Schristos2019-05-29 Nick Alcock <nick.alcock@oracle.com> 1489*56bb7041Schristos 1490*56bb7041Schristos * Makefile.am (ZLIB): New. 1491*56bb7041Schristos (ZLIBINC): Likewise. 1492*56bb7041Schristos (AM_CFLAGS): Use them. 1493*56bb7041Schristos (libctf_a_LIBADD): New, for LIBOBJS. 1494*56bb7041Schristos * configure.ac: Check for zlib, endian.h, and qsort_r. 1495*56bb7041Schristos * ctf-endian.h: New, providing htole64 and le64toh. 1496*56bb7041Schristos * swap.h: Code style fixes. 1497*56bb7041Schristos (bswap_identity_64): New. 1498*56bb7041Schristos * qsort_r.c: New, from gnulib (with one added #include). 1499*56bb7041Schristos * ctf-decls.h: New, providing a conditional qsort_r declaration, 1500*56bb7041Schristos and unconditional definitions of MIN and MAX. 1501*56bb7041Schristos * ctf-impl.h: Use it. Do not use <sys/errno.h>. 1502*56bb7041Schristos (ctf_set_errno): Now returns unsigned long. 1503*56bb7041Schristos * ctf-util.c (ctf_set_errno): Adjust here too. 1504*56bb7041Schristos * ctf-archive.c: Use ctf-endian.h. 1505*56bb7041Schristos (ctf_arc_open_by_offset): Use memset, not bzero. Drop cts_type, 1506*56bb7041Schristos cts_flags and cts_offset. 1507*56bb7041Schristos (ctf_arc_write): Drop debugging dependent on the size of off_t. 1508*56bb7041Schristos * ctf-create.c: Provide a definition of roundup if not defined. 1509*56bb7041Schristos (ctf_create): Drop cts_type, cts_flags and cts_offset. 1510*56bb7041Schristos (ctf_add_reftype): Do not check if type IDs are below zero. 1511*56bb7041Schristos (ctf_add_slice): Likewise. 1512*56bb7041Schristos (ctf_add_typedef): Likewise. 1513*56bb7041Schristos (ctf_add_member_offset): Cast error-returning ssize_t's to size_t 1514*56bb7041Schristos when known error-free. Drop CTF_ERR usage for functions returning 1515*56bb7041Schristos int. 1516*56bb7041Schristos (ctf_add_member_encoded): Drop CTF_ERR usage for functions returning 1517*56bb7041Schristos int. 1518*56bb7041Schristos (ctf_add_variable): Likewise. 1519*56bb7041Schristos (enumcmp): Likewise. 1520*56bb7041Schristos (enumadd): Likewise. 1521*56bb7041Schristos (membcmp): Likewise. 1522*56bb7041Schristos (ctf_add_type): Likewise. Cast error-returning ssize_t's to size_t 1523*56bb7041Schristos when known error-free. 1524*56bb7041Schristos * ctf-dump.c (ctf_is_slice): Drop CTF_ERR usage for functions 1525*56bb7041Schristos returning int: use CTF_ERR for functions returning ctf_type_id. 1526*56bb7041Schristos (ctf_dump_label): Likewise. 1527*56bb7041Schristos (ctf_dump_objts): Likewise. 1528*56bb7041Schristos * ctf-labels.c (ctf_label_topmost): Likewise. 1529*56bb7041Schristos (ctf_label_iter): Likewise. 1530*56bb7041Schristos (ctf_label_info): Likewise. 1531*56bb7041Schristos * ctf-lookup.c (ctf_func_args): Likewise. 1532*56bb7041Schristos * ctf-open.c (upgrade_types): Cast to size_t where appropriate. 1533*56bb7041Schristos (ctf_bufopen): Likewise. Use zlib types as needed. 1534*56bb7041Schristos * ctf-types.c (ctf_member_iter): Drop CTF_ERR usage for functions 1535*56bb7041Schristos returning int. 1536*56bb7041Schristos (ctf_enum_iter): Likewise. 1537*56bb7041Schristos (ctf_type_size): Likewise. 1538*56bb7041Schristos (ctf_type_align): Likewise. Cast to size_t where appropriate. 1539*56bb7041Schristos (ctf_type_kind_unsliced): Likewise. 1540*56bb7041Schristos (ctf_type_kind): Likewise. 1541*56bb7041Schristos (ctf_type_encoding): Likewise. 1542*56bb7041Schristos (ctf_member_info): Likewise. 1543*56bb7041Schristos (ctf_array_info): Likewise. 1544*56bb7041Schristos (ctf_enum_value): Likewise. 1545*56bb7041Schristos (ctf_type_rvisit): Likewise. 1546*56bb7041Schristos * ctf-open-bfd.c (ctf_bfdopen): Drop cts_type, cts_flags and 1547*56bb7041Schristos cts_offset. 1548*56bb7041Schristos (ctf_simple_open): Likewise. 1549*56bb7041Schristos (ctf_bfdopen_ctfsect): Likewise. Set cts_size properly. 1550*56bb7041Schristos * Makefile.in: Regenerate. 1551*56bb7041Schristos * aclocal.m4: Likewise. 1552*56bb7041Schristos * config.h: Likewise. 1553*56bb7041Schristos * configure: Likewise. 1554*56bb7041Schristos 1555*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1556*56bb7041Schristos 1557*56bb7041Schristos * configure.in: Check for bfd_section_from_elf_index. 1558*56bb7041Schristos * configure: Regenerate. 1559*56bb7041Schristos * config.h.in [HAVE_BFD_ELF]: Likewise. 1560*56bb7041Schristos * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it. 1561*56bb7041Schristos abfd is potentially unused now. 1562*56bb7041Schristos 1563*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1564*56bb7041Schristos 1565*56bb7041Schristos * Makefile.am: New. 1566*56bb7041Schristos * Makefile.in: Regenerated. 1567*56bb7041Schristos * config.h.in: Likewise. 1568*56bb7041Schristos * aclocal.m4: Likewise. 1569*56bb7041Schristos * configure: Likewise. 1570*56bb7041Schristos 1571*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1572*56bb7041Schristos 1573*56bb7041Schristos * ctf-dump.c: New. 1574*56bb7041Schristos 1575*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1576*56bb7041Schristos 1577*56bb7041Schristos * ctf-labels.c: New. 1578*56bb7041Schristos 1579*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1580*56bb7041Schristos 1581*56bb7041Schristos * ctf-impl.h (_libctf_version): New declaration. 1582*56bb7041Schristos * ctf-subr.c (_libctf_version): Define it. 1583*56bb7041Schristos (ctf_version): New. 1584*56bb7041Schristos 1585*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1586*56bb7041Schristos 1587*56bb7041Schristos * ctf-create.c (enumcmp): New. 1588*56bb7041Schristos (enumadd): Likewise. 1589*56bb7041Schristos (membcmp): Likewise. 1590*56bb7041Schristos (membadd): Likewise. 1591*56bb7041Schristos (ctf_add_type): Likewise. 1592*56bb7041Schristos 1593*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1594*56bb7041Schristos 1595*56bb7041Schristos * ctf-lookup.c (isqualifier): New. 1596*56bb7041Schristos (ctf_lookup_by_name): Likewise. 1597*56bb7041Schristos (struct ctf_lookup_var_key): Likewise. 1598*56bb7041Schristos (ctf_lookup_var): Likewise. 1599*56bb7041Schristos (ctf_lookup_variable): Likewise. 1600*56bb7041Schristos (ctf_lookup_symbol_name): Likewise. 1601*56bb7041Schristos (ctf_lookup_by_symbol): Likewise. 1602*56bb7041Schristos (ctf_func_info): Likewise. 1603*56bb7041Schristos (ctf_func_args): Likewise. 1604*56bb7041Schristos 1605*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1606*56bb7041Schristos 1607*56bb7041Schristos * ctf-decl.c: New file. 1608*56bb7041Schristos * ctf-types.c: Likewise. 1609*56bb7041Schristos * ctf-impl.h: New declarations. 1610*56bb7041Schristos 1611*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1612*56bb7041Schristos 1613*56bb7041Schristos * ctf-open-bfd.c: New file. 1614*56bb7041Schristos * ctf-open.c (ctf_close): New. 1615*56bb7041Schristos * ctf-impl.h: Include bfd.h. 1616*56bb7041Schristos (ctf_file): New members ctf_data_mmapped, ctf_data_mmapped_len. 1617*56bb7041Schristos (ctf_archive_internal): New members ctfi_abfd, ctfi_data, 1618*56bb7041Schristos ctfi_bfd_close. 1619*56bb7041Schristos (ctf_bfdopen_ctfsect): New declaration. 1620*56bb7041Schristos (_CTF_SECTION): likewise. 1621*56bb7041Schristos 1622*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1623*56bb7041Schristos 1624*56bb7041Schristos * ctf-archive.c: New. 1625*56bb7041Schristos * ctf-impl.h (ctf_archive_internal): New type. 1626*56bb7041Schristos (ctf_arc_open_internal): New declaration. 1627*56bb7041Schristos (ctf_arc_bufopen): Likewise. 1628*56bb7041Schristos (ctf_arc_close_internal): Likewise. 1629*56bb7041Schristos 1630*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1631*56bb7041Schristos 1632*56bb7041Schristos * ctf-open.c: New file. 1633*56bb7041Schristos * swap.h: Likewise. 1634*56bb7041Schristos 1635*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1636*56bb7041Schristos 1637*56bb7041Schristos * ctf-create.c: New file. 1638*56bb7041Schristos * ctf-lookup.c: New file. 1639*56bb7041Schristos 1640*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1641*56bb7041Schristos 1642*56bb7041Schristos * ctf-impl.h: New definitions and declarations for type creation 1643*56bb7041Schristos and lookup. 1644*56bb7041Schristos 1645*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1646*56bb7041Schristos 1647*56bb7041Schristos * ctf-hash.c: New file. 1648*56bb7041Schristos * ctf-impl.h: New declarations. 1649*56bb7041Schristos 1650*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1651*56bb7041Schristos 1652*56bb7041Schristos * ctf-error.c: New file. 1653*56bb7041Schristos 1654*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1655*56bb7041Schristos 1656*56bb7041Schristos * ctf-util.c: New file. 1657*56bb7041Schristos * elf.h: Likewise. 1658*56bb7041Schristos * ctf-impl.h: Include it, and add declarations. 1659*56bb7041Schristos 1660*56bb7041Schristos2019-05-28 Nick Alcock <nick.alcock@oracle.com> 1661*56bb7041Schristos 1662*56bb7041Schristos * ctf-impl.h: New file. 1663*56bb7041Schristos * ctf-subr.c: New file. 1664*56bb7041Schristos 1665*56bb7041Schristos 1666*56bb7041SchristosLocal Variables: 1667*56bb7041Schristosmode: change-log 1668*56bb7041Schristosleft-margin: 8 1669*56bb7041Schristosfill-column: 76 1670*56bb7041Schristosversion-control: never 1671*56bb7041SchristosEnd: 1672