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