]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - libctf/ChangeLog
libctf: remove ctf_malloc, ctf_free and ctf_strdup
[thirdparty/binutils-gdb.git] / libctf / ChangeLog
CommitLineData
de07e349
NA
12019-09-23 Nick Alcock <nick.alcock@oracle.com>
2
3 * ctf-impl.h (ctf_alloc): Remove.
4 (ctf_free): Likewise.
5 (ctf_strdup): Likewise.
6 * ctf-subr.c (ctf_alloc): Remove.
7 (ctf_free): Likewise.
8 * ctf-util.c (ctf_strdup): Remove.
9
10 * ctf-create.c (ctf_serialize): Use malloc, not ctf_alloc; free, not
11 ctf_free; strdup, not ctf_strdup.
12 (ctf_dtd_delete): Likewise.
13 (ctf_dvd_delete): Likewise.
14 (ctf_add_generic): Likewise.
15 (ctf_add_function): Likewise.
16 (ctf_add_enumerator): Likewise.
17 (ctf_add_member_offset): Likewise.
18 (ctf_add_variable): Likewise.
19 (membadd): Likewise.
20 (ctf_compress_write): Likewise.
21 (ctf_write_mem): Likewise.
22 * ctf-decl.c (ctf_decl_push): Likewise.
23 (ctf_decl_fini): Likewise.
24 (ctf_decl_sprintf): Likewise. Check for OOM.
25 * ctf-dump.c (ctf_dump_append): Use malloc, not ctf_alloc; free, not
26 ctf_free; strdup, not ctf_strdup.
27 (ctf_dump_free): Likewise.
28 (ctf_dump): Likewise.
29 * ctf-open.c (upgrade_types_v1): Likewise.
30 (init_types): Likewise.
31 (ctf_file_close): Likewise.
32 (ctf_bufopen_internal): Likewise. Check for OOM.
33 (ctf_parent_name_set): Likewise: report the OOM to the caller.
34 (ctf_cuname_set): Likewise.
35 (ctf_import): Likewise.
36 * ctf-string.c (ctf_str_purge_atom_refs): Use malloc, not ctf_alloc;
37 free, not ctf_free; strdup, not ctf_strdup.
38 (ctf_str_free_atom): Likewise.
39 (ctf_str_create_atoms): Likewise.
40 (ctf_str_add_ref_internal): Likewise.
41 (ctf_str_remove_ref): Likewise.
42 (ctf_str_write_strtab): Likewise.
43
9c1a2295
NA
442019-08-09 Nick Alcock <nick.alcock@oracle.com>
45
46 * ctf-types.c (ctf_type_encoding): Fix the dynamic case to
47 work right for non-int/fps.
48
1a6ab13e
NA
492019-08-08 Nick Alcock <nick.alcock@oracle.com>
50
51 * ctf-types.c (ctf_type_name): Don't strlen a potentially-
52 null pointer.
53
99dc3ebd
NA
542019-08-07 Nick Alcock <nick.alcock@oracle.com>
55
56 * ctf-impl.h (ctf_file_t) <ctf_add_processing>: New.
57 * ctf-open.c (ctf_file_close): Free it.
58 * ctf-create.c (ctf_serialize): Adjust.
59 (membcmp): When reporting a conflict due to an error, report the
60 error.
61 (ctf_add_type): Turn into a ctf_add_processing wrapper. Rename to...
62 (ctf_add_type_internal): ... this. Hand back types we are already
63 in the middle of adding immediately. Hand back structs/unions with
64 the same number of members immediately. Do not walk the dynamic
65 list. Call ctf_add_type_internal, not ctf_add_type. Handle
66 forwards promoted to other types and the inverse case identically.
67 Add structs to the mapping as soon as we intern them, before they
68 gain any members.
69
676c3ecb
NA
702019-08-09 Nick Alcock <nick.alcock@oracle.com>
71
72 * ctf-impl.h (ctf_names_t): New.
73 (ctf_lookup_t) <ctf_hash>: Now a ctf_names_t, not a ctf_hash_t.
74 (ctf_file_t) <ctf_structs>: Likewise.
75 <ctf_unions>: Likewise.
76 <ctf_enums>: Likewise.
77 <ctf_names>: Likewise.
78 <ctf_lookups>: Improve comment.
79 <ctf_ptrtab_len>: New.
80 <ctf_prov_strtab>: New.
81 <ctf_str_prov_offset>: New.
82 <ctf_dtbyname>: Remove, redundant to the names hashes.
83 <ctf_dtnextid>: Remove, redundant to ctf_typemax.
84 (ctf_dtdef_t) <dtd_name>: Remove.
85 <dtd_data>: Note that the ctt_name is now populated.
86 (ctf_str_atom_t) <csa_offset>: This is now the strtab
87 offset for internal strings too.
88 <csa_external_offset>: New, the external strtab offset.
89 (CTF_INDEX_TO_TYPEPTR): Handle the LCTF_RDWR case.
90 (ctf_name_table): New declaration.
91 (ctf_lookup_by_rawname): Likewise.
92 (ctf_lookup_by_rawhash): Likewise.
93 (ctf_set_ctl_hashes): Likewise.
94 (ctf_serialize): Likewise.
95 (ctf_dtd_insert): Adjust.
96 (ctf_simple_open_internal): Likewise.
97 (ctf_bufopen_internal): Likewise.
98 (ctf_list_empty_p): Likewise.
99 (ctf_str_remove_ref): Likewise.
100 (ctf_str_add): Returns uint32_t now.
101 (ctf_str_add_ref): Likewise.
102 (ctf_str_add_external): Now returns a boolean (int).
103 * ctf-string.c (ctf_strraw_explicit): Check the ctf_prov_strtab
104 for strings in the appropriate range.
105 (ctf_str_create_atoms): Create the ctf_prov_strtab. Detect OOM
106 when adding the null string to the new strtab.
107 (ctf_str_free_atoms): Destroy the ctf_prov_strtab.
108 (ctf_str_add_ref_internal): Add make_provisional argument. If
109 make_provisional, populate the offset and fill in the
110 ctf_prov_strtab accordingly.
111 (ctf_str_add): Return the offset, not the string.
112 (ctf_str_add_ref): Likewise.
113 (ctf_str_add_external): Return a success integer.
114 (ctf_str_remove_ref): New, remove a single ref.
115 (ctf_str_count_strtab): Do not count the initial null string's
116 length or the existence or length of any unreferenced internal
117 atoms.
118 (ctf_str_populate_sorttab): Skip atoms with no refs.
119 (ctf_str_write_strtab): Populate the nullstr earlier. Add one
120 to the cts_len for the null string, since it is no longer done
121 in ctf_str_count_strtab. Adjust for csa_external_offset rename.
122 Populate the csa_offset for both internal and external cases.
123 Flush the ctf_prov_strtab afterwards, and reset the
124 ctf_str_prov_offset.
125 * ctf-create.c (ctf_grow_ptrtab): New.
126 (ctf_create): Call it. Initialize new fields rather than old
127 ones. Tell ctf_bufopen_internal that this is a writable dictionary.
128 Set the ctl hashes and data model.
129 (ctf_update): Rename to...
130 (ctf_serialize): ... this. Leave a compatibility function behind.
131 Tell ctf_simple_open_internal that this is a writable dictionary.
132 Pass the new fields along from the old dictionary. Drop
133 ctf_dtnextid and ctf_dtbyname. Use ctf_strraw, not dtd_name.
134 Do not zero out the DTD's ctt_name.
135 (ctf_prefixed_name): Rename to...
136 (ctf_name_table): ... this. No longer return a prefixed name: return
137 the applicable name table instead.
138 (ctf_dtd_insert): Use it, and use the right name table. Pass in the
139 kind we're adding. Migrate away from dtd_name.
140 (ctf_dtd_delete): Adjust similarly. Remove the ref to the
141 deleted ctt_name.
142 (ctf_dtd_lookup_type_by_name): Remove.
143 (ctf_dynamic_type): Always return NULL on read-only dictionaries.
144 No longer check ctf_dtnextid: check ctf_typemax instead.
145 (ctf_snapshot): No longer use ctf_dtnextid: use ctf_typemax instead.
146 (ctf_rollback): Likewise. No longer fail with ECTF_OVERROLLBACK. Use
147 ctf_name_table and the right name table, and migrate away from
148 dtd_name as in ctf_dtd_delete.
149 (ctf_add_generic): Pass in the kind explicitly and pass it to
150 ctf_dtd_insert. Use ctf_typemax, not ctf_dtnextid. Migrate away
151 from dtd_name to using ctf_str_add_ref to populate the ctt_name.
152 Grow the ptrtab if needed.
153 (ctf_add_encoded): Pass in the kind.
154 (ctf_add_slice): Likewise.
155 (ctf_add_array): Likewise.
156 (ctf_add_function): Likewise.
157 (ctf_add_typedef): Likewise.
158 (ctf_add_reftype): Likewise. Initialize the ctf_ptrtab, checking
159 ctt_name rather than dtd_name.
160 (ctf_add_struct_sized): Pass in the kind. Use
161 ctf_lookup_by_rawname, not ctf_hash_lookup_type /
162 ctf_dtd_lookup_type_by_name.
163 (ctf_add_union_sized): Likewise.
164 (ctf_add_enum): Likewise.
165 (ctf_add_enum_encoded): Likewise.
166 (ctf_add_forward): Likewise.
167 (ctf_add_type): Likewise.
168 (ctf_compress_write): Call ctf_serialize: adjust for ctf_size not
169 being initialized until after the call.
170 (ctf_write_mem): Likewise.
171 (ctf_write): Likewise.
172 * ctf-archive.c (arc_write_one_ctf): Likewise.
173 * ctf-lookup.c (ctf_lookup_by_name): Use ctf_lookuup_by_rawhash, not
174 ctf_hash_lookup_type.
175 (ctf_lookup_by_id): No longer check the readonly types if the
176 dictionary is writable.
177 * ctf-open.c (init_types): Assert that this dictionary is not
178 writable. Adjust to use the new name hashes, ctf_name_table,
179 and ctf_ptrtab_len. GNU style fix for the final ptrtab scan.
180 (ctf_bufopen_internal): New 'writable' parameter. Flip on LCTF_RDWR
181 if set. Drop out early when dictionary is writable. Split the
182 ctf_lookups initialization into...
183 (ctf_set_cth_hashes): ... this new function.
184 (ctf_simple_open_internal): Adjust. New 'writable' parameter.
185 (ctf_simple_open): Adjust accordingly.
186 (ctf_bufopen): Likewise.
187 (ctf_file_close): Destroy the appropriate name hashes. No longer
188 destroy ctf_dtbyname, which is gone.
189 (ctf_getdatasect): Remove spurious "extern".
190 * ctf-types.c (ctf_lookup_by_rawname): New, look up types in the
191 specified name table, given a kind.
192 (ctf_lookup_by_rawhash): Likewise, given a ctf_names_t *.
193 (ctf_member_iter): Add support for iterating over the
194 dynamic type list.
195 (ctf_enum_iter): Likewise.
196 (ctf_variable_iter): Likewise.
197 (ctf_type_rvisit): Likewise.
198 (ctf_member_info): Add support for types in the dynamic type list.
199 (ctf_enum_name): Likewise.
200 (ctf_enum_value): Likewise.
201 (ctf_func_type_info): Likewise.
202 (ctf_func_type_args): Likewise.
203 * ctf-link.c (ctf_accumulate_archive_names): No longer call
204 ctf_update.
205 (ctf_link_write): Likewise.
206 (ctf_link_intern_extern_string): Adjust for new
207 ctf_str_add_external return value.
208 (ctf_link_add_strtab): Likewise.
209 * ctf-util.c (ctf_list_empty_p): New.
210
791915db
NA
2112019-08-05 Nick Alcock <nick.alcock@oracle.com>
212
213 * ctf-types.c (ctf_type_resolve): Return ECTF_NONREPRESENTABLE on
214 type zero.
215 * ctf-create.c (ctf_add_type): Detect and skip nonrepresentable
216 members and types.
217 (ctf_add_variable): Likewise for variables pointing to them.
218 * ctf-link.c (ctf_link_one_type): Do not warn for nonrepresentable
219 type link failure, but do warn for others.
220 * ctf-dump.c (ctf_dump_format_type): Likewise. Do not assume all
221 errors to be ENOMEM.
222 (ctf_dump_member): Likewise.
223 (ctf_dump_type): Likewise.
224 (ctf_dump_header_strfield): Do not assume all errors to be ENOMEM.
225 (ctf_dump_header_sectfield): Do not assume all errors to be ENOMEM.
226 (ctf_dump_header): Likewise.
227 (ctf_dump_label): likewise.
228 (ctf_dump_objts): likewise.
229 (ctf_dump_funcs): likewise.
230 (ctf_dump_var): likewise.
231 (ctf_dump_str): Likewise.
232
87279e3c
NA
2332019-09-30 Nick Alcock <nick.alcock@oracle.com>
234
235 * configure.ac (AC_DISABLE_SHARED): New, like opcodes/.
236 (LT_INIT): Likewise.
237 (AM_INSTALL_LIBBFD): Likewise.
238 (dlopen): Note why this is necessary in a comment.
239 (SHARED_LIBADD): Initialize for possibly-PIC libiberty: derived from
240 opcodes/.
241 (SHARED_LDFLAGS): Likewise.
242 (BFD_LIBADD): Likewise, for libbfd.
243 (BFD_DEPENDENCIES): Likewise.
244 (VERSION_FLAGS): Initialize, using a version script if ld supports
245 one, or libtool -export-symbols-regex otherwise.
246 (AC_CONFIG_MACRO_DIR): Add ../BFD.
247 * Makefile.am (ACLOCAL_AMFLAGS): Likewise.
248 (INCDIR): New.
249 (AM_CPPFLAGS): Use $(srcdir), not $(top_srcdir).
250 (noinst_LIBRARIES): Replace with...
251 [INSTALL_LIBBFD] (lib_LTLIBRARIES): This, or...
252 [!INSTALL_LIBBFD] (noinst_LTLIBRARIES): ... this, mentioning new
253 libctf-nobfd.la as well.
254 [INSTALL_LIBCTF] (include_HEADERS): Add the CTF headers.
255 [!INSTALL_LIBCTF] (include_HEADERS): New, empty.
256 (libctf_a_SOURCES): Rename to...
257 (libctf_nobfd_la_SOURCES): ... this, all of libctf other than
258 ctf-open-bfd.c.
259 (libctf_la_SOURCES): Now derived from libctf_nobfd_la_SOURCES,
260 with ctf-open-bfd.c added.
261 (libctf_nobfd_la_LIBADD): New, using @SHARED_LIBADD@.
262 (libctf_la_LIBADD): New, using @BFD_LIBADD@ as well.
263 (libctf_la_DEPENDENCIES): New, using @BFD_DEPENDENCIES@.
264 * Makefile.am [INSTALL_LIBCTF]: Use it.
265 * aclocal.m4: Add ../bfd/acinclude.m4, ../config/acx.m4, and the
266 libtool macros.
267 * libctf.ver: New, everything is version LIBCTF_1.0 currently (even
268 the unstable components).
269 * Makefile.in: Regenerated.
270 * config.h.in: Likewise.
271 * configure: Likewise.
272
2732019-07-30 Nick Alcock <nick.alcock@oracle.com>
274
275 * configure.ac (INSTALL_LIBCTF): New, controlled by
276 --enable-install-libctf.
277 [INSTALL_LIBCTF] (lib_LIBRARIES): Add libctf.a.
278 * Makefile.in: Regenerated.
279 * configure: Regenerated.
280
f046147d
NA
2812019-07-30 Nick Alcock <nick.alcock@oracle.com>
282
283 * ctf-archive.c (ctf_arc_close): Call ctfi_bfd_close if set.
284 * ctf-open-bfd.c (ctf_bfdclose): Fix comment.
285
edc8bbe9
NA
2862019-07-30 Nick Alcock <nick.alcock@oracle.com>
287
288 * ctf-open-bfd.c (ctf_fdopen): Call bfd_set_cacheable.
289
7e97445a
NA
2902019-07-13 Nick Alcock <nick.alcock@oracle.com>
291
292 * ctf-impl.h (includes): Include <sys/param.h> here.
293
5ae6af75
NA
2942019-07-30 Nick Alcock <nick.alcock@oracle.com>
295
296 * ctf-open.c (flip_lbls): Eschew for-loop initial declarations.
297 (flip_objts): Likewise.
298 (flip_vars): Likewise.
299 (flip_types): Likewise.
300
1820745a
NA
3012019-07-30 Nick Alcock <nick.alcock@oracle.com>
302
303 * ctf-hash.c (ctf_hashtab_insert): Pass in the key and value
304 freeing functions: if set, free the key and value if the slot
305 already exists. Always reassign the key.
306 (ctf_dynhash_insert): Adjust call appropriately.
307 (ctf_hash_insert_type): Likewise.
308
5de9eada
NA
3092019-08-03 Nick Alcock <nick.alcock@oracle.com>
310
311 * ctf-create.c (ctf_add_type): Look up and use the forwarded-to
312 type kind. Allow forwards to unify with pre-existing structs/
313 unions/enums.
314
49ea9b45
NA
3152019-07-30 Nick Alcock <nick.alcock@oracle.com>
316
317 * ctf-impl.h (ctf_file_t) <ctf_link_cu_mappping>: New.
318 <ctf_link_memb_name_changer>: Likewise.
319 <ctf_link_memb_name_changer_arg>: Likewise.
320 * ctf-create.c (ctf_update): Update accordingly.
321 * ctf-open.c (ctf_file_close): Likewise.
322 * ctf-link.c (ctf_create_per_cu): Apply the cu mapping.
323 (ctf_link_add_cu_mapping): New.
324 (ctf_link_set_memb_name_changer): Likewise.
325 (ctf_change_parent_name): New.
326 (ctf_name_list_accum_cb_arg_t) <dynames>: New, storage for names
327 allocated by the caller's ctf_link_memb_name_changer.
328 <ndynames>: Likewise.
329 (ctf_accumulate_archive_names): Call the ctf_link_memb_name_changer.
330 (ctf_link_write): Likewise (for _CTF_SECTION only): also call
331 ctf_change_parent_name. Free any resulting names.
332
eabb7154
NA
3332019-07-13 Nick Alcock <nick.alcock@oracle.com>
334
335 * ctf-link.c (ctf_create_per_cu): New, refactored out of...
336 (ctf_link_one_type): ... here, with parent-name setting added.
337 (check_variable): New.
338 (ctf_link_one_variable): Likewise.
339 (ctf_link_one_input_archive_member): Call it.
340 * ctf-error.c (_ctf_errlist): Updated with new errors.
341
886453cb
NA
3422019-07-13 Nick Alcock <nick.alcock@oracle.com>
343
344 * ctf-impl.h (ctf_file_t): New field ctf_link_type_mapping.
345 (struct ctf_link_type_mapping_key): New.
346 (ctf_hash_type_mapping_key): Likewise.
347 (ctf_hash_eq_type_mapping_key): Likewise.
348 (ctf_add_type_mapping): Likewise.
349 (ctf_type_mapping): Likewise.
350 (ctf_dynhash_empty): Likewise.
351 * ctf-open.c (ctf_file_close): Update accordingly.
352 * ctf-create.c (ctf_update): Likewise.
353 (ctf_add_type): Populate the mapping.
354 * ctf-hash.c (ctf_hash_type_mapping_key): Hash a type mapping key.
355 (ctf_hash_eq_type_mapping_key): Check the key for equality.
356 (ctf_dynhash_insert): Fix comment typo.
357 (ctf_dynhash_empty): New.
358 * ctf-link.c (ctf_add_type_mapping): New.
359 (ctf_type_mapping): Likewise.
360 (empty_link_type_mapping): New.
361 (ctf_link_one_input_archive): Call it.
362
72c83edd
NA
3632019-07-13 Nick Alcock <nick.alcock@oracle.com>
364
365 * ctf-link.c: New file, linking of the string and type sections.
366 * Makefile.am (libctf_a_SOURCES): Add it.
367 * Makefile.in: Regenerate.
368
369 * ctf-impl.h (ctf_file_t): New fields ctf_link_inputs,
370 ctf_link_outputs.
371 * ctf-create.c (ctf_update): Update accordingly.
372 * ctf-open.c (ctf_file_close): Likewise.
373 * ctf-error.c (_ctf_errlist): Updated with new errors.
374
d18f9f16
NA
3752019-07-13 Nick Alcock <nick.alcock@oracle.com>
376
377 * ctf-dump.c (ctf_dump_funcs): Check the right error value.
378
b4f0e09c
NA
3792019-07-13 Nick Alcock <nick.alcock@oracle.com>
380
381 * ctf-dump.c (ctf_dump): Use ctf_type_iter_all to dump types, not
382 ctf_type_iter.
383 (ctf_dump_type): Pass down the flag from ctf_type_iter_all.
384 (ctf_dump_format_type): Add non-root-type { } notation.
385 Add root flag to prototype.
386 (ctf_dump_label): Adjust accordingly.
387 (ctf_dump_objts): Likewise.
388 (ctf_dump_var): Likewise.
389
3dde2c91
NA
3902019-07-13 Nick Alcock <nick.alcock@oracle.com>
391
392 * ctf-create.c (ctf_compress_write): Fix double-free.
393
5537f9b9
NA
3942019-07-13 Nick Alcock <nick.alcock@oracle.com>
395
396 * ctf-archive.c (ctf_arc_write): Split off, and reimplement in terms
397 of...
398 (ctf_arc_write_fd): ... this new function.
399 * ctf-create.c (ctf_write_mem): New.
400
d851ecd3
NA
4012019-07-13 Nick Alcock <nick.alcock@oracle.com>
402
403 * ctf-impl.h (ctf_str_atom_t) <csa_offset>: New field.
404 (ctf_file_t) <ctf_syn_ext_strtab>: Likewise.
405 (ctf_str_add_ref): Name the last arg.
406 (ctf_str_add_external) New.
407 (ctf_str_add_strraw_explicit): Likewise.
408 (ctf_simple_open_internal): Likewise.
409 (ctf_bufopen_internal): Likewise.
410
411 * ctf-string.c (ctf_strraw_explicit): Split from...
412 (ctf_strraw): ... here, with new support for ctf_syn_ext_strtab.
413 (ctf_str_add_ref_internal): Return the atom, not the
414 string.
415 (ctf_str_add): Adjust accordingly.
416 (ctf_str_add_ref): Likewise. Move up in the file.
417 (ctf_str_add_external): New: update the csa_offset.
418 (ctf_str_count_strtab): Only account for strings with no csa_offset
419 in the internal strtab length.
420 (ctf_str_write_strtab): If the csa_offset is set, update the
421 string's refs without writing the string out, and update the
422 ctf_syn_ext_strtab. Make OOM handling less ugly.
423 * ctf-create.c (struct ctf_sort_var_arg_cb): New.
424 (ctf_update): Handle failure to populate the strtab. Pass in the
425 new ctf_sort_var arg. Adjust for ctf_syn_ext_strtab addition.
426 Call ctf_simple_open_internal, not ctf_simple_open.
427 (ctf_sort_var): Call ctf_strraw_explicit rather than looking up
428 strings by hand.
429 * ctf-hash.c (ctf_hash_insert_type): Likewise (but using
430 ctf_strraw). Adjust to diagnose ECTF_STRTAB nonetheless.
431 * ctf-open.c (init_types): No longer filter out ECTF_STRTAB.
432 (ctf_file_close): Destroy the ctf_syn_ext_strtab.
433 (ctf_simple_open): Rename to, and reimplement as a wrapper around...
434 (ctf_simple_open_internal): ... this new function, which calls
435 ctf_bufopen_internal.
436 (ctf_bufopen): Rename to, and reimplement as a wrapper around...
437 (ctf_bufopen_internal): ... this new function, which sets
438 ctf_syn_ext_strtab.
439
0ac62312
NA
4402019-07-13 Nick Alcock <nick.alcock@oracle.com>
441
442 * ctf_types.c (ctf_type_iter_all): New.
443
2db912ba
NA
4442019-07-13 Nick Alcock <nick.alcock@oracle.com>
445
446 * ctf-open.c (init_symtab): Check for overflow against the right
447 section.
448 (upgrade_header): Set cth_objtidxoff, cth_funcidxoff to zero-length.
449 (upgrade_types_v1): Note that these sections are not checked.
450 (flip_header): Endian-swap the header fields.
451 (flip_ctf): Endian-swap the sections.
452 (flip_objts): Update comment.
453 (ctf_bufopen): Check header offsets and alignment for validity.
454
6d5944fc
NA
4552019-07-13 Nick Alcock <nick.alcock@oracle.com>
456
457 * ctf-open-bfd.c: Add <assert.h>.
458 (ctf_bfdopen_ctfsect): Open string and symbol tables using
459 techniques borrowed from bfd_elf_sym_name.
460 (ctf_new_archive_internal): Improve comment.
461 * ctf-archive.c (ctf_arc_close): Do not free the ctfi_strsect.
462 * ctf-open.c (ctf_bufopen): Allow opening with a string section but
463 no symbol section, but not vice versa.
464
9b32cba4
NA
4652019-07-08 Nick Alcock <nick.alcock@oracle.com>
466
467 * ctf-impl.h (ctf_file_t): New field ctf_openflags.
468 * ctf-open.c (ctf_bufopen): Set it. No longer dump header offsets.
469 * ctf-dump.c (dump_header): New function, dump the CTF header.
470 (ctf_dump): Call it.
471 (ctf_dump_header_strfield): New function.
472 (ctf_dump_header_sectfield): Likewise.
473
fd55eae8
NA
4742019-07-06 Nick Alcock <nick.alcock@oracle.com>
475
476 * ctf-impl.h (ctf_file_t): New fields ctf_header, ctf_dynbase,
477 ctf_cuname, ctf_dyncuname: ctf_base and ctf_buf are no longer const.
478 * ctf-open.c (ctf_set_base): Preserve the gap between ctf_buf and
479 ctf_base: do not assume that it is always sizeof (ctf_header_t).
480 Print out ctf_cuname: only print out ctf_parname if set.
481 (ctf_free_base): Removed, ctf_base is no longer freed: free
482 ctf_dynbase instead.
483 (ctf_set_version): Fix spacing.
484 (upgrade_header): New, in-place header upgrading.
485 (upgrade_types): Rename to...
486 (upgrade_types_v1): ... this. Free ctf_dynbase, not ctf_base. No
487 longer track old and new headers separately. No longer allow for
488 header sizes explicitly: squeeze the headers out on upgrade (they
489 are preserved in fp->ctf_header). Set ctf_dynbase, ctf_base and
490 ctf_buf explicitly. Use ctf_free, not ctf_free_base.
491 (upgrade_types): New, also handle ctf_parmax updating.
492 (flip_header): Flip ctf_cuname.
493 (flip_types): Flip BUF explicitly rather than deriving BUF from
494 BASE.
495 (ctf_bufopen): Store the header in fp->ctf_header. Correct minimum
496 required alignment of objtoff and funcoff. No longer store it in
497 the ctf_buf unless that buf is derived unmodified from the input.
498 Set ctf_dynbase where ctf_base is dynamically allocated. Drop locals
499 that duplicate fields in ctf_file: move allocation of ctf_file
500 further up instead. Call upgrade_header as needed. Move
501 version-specific ctf_parmax initialization into upgrade_types. More
502 concise error handling.
503 (ctf_file_close): No longer test for null pointers before freeing.
504 Free ctf_dyncuname, ctf_dynbase, and ctf_header. Do not call
505 ctf_free_base.
506 (ctf_cuname): New.
507 (ctf_cuname_set): New.
508 * ctf-create.c (ctf_update): Populate ctf_cuname.
509 (ctf_gzwrite): Write out the header explicitly. Remove obsolescent
510 comment.
511 (ctf_write): Likewise.
512 (ctf_compress_write): Get the header from ctf_header, not ctf_base.
513 Fix the compression length: fp->ctf_size never counted the CTF
514 header. Simplify the compress call accordingly.
515
a2230b5e
HPN
5162019-07-11 Hans-Peter Nilsson <hp@bitrange.com>
517
518 * ctf-endian.h: Don't assume htole64 and le64toh are always
519 present if HAVE_ENDIAN_H; also check if htole64 is defined.
520 [!WORDS_BIGENDIAN] (htole64, le64toh): Define as identity,
521 not bswap_identity_64.
522
fd361982
AM
5232019-09-18 Alan Modra <amodra@gmail.com>
524
525 * ctf-open-bfd.c: Update throughout for bfd section macro changes.
526
60391a25
PB
5272019-09-09 Phil Blundell <pb@pbcl.net>
528
529 binutils 2.33 branch created.
530
12a0b67d
NA
5312019-07-18 Nick Alcock <nick.alcock@oracle.com>
532
533 * ctf-types.c (ctf_type_aname_raw): New.
534 (ctf_func_type_info): Likewise.
535 (ctf_func_type_args): Likewise.
536 * ctf-error.c (_ctf_errlist): Fix description.
537 * ctf-lookup.c: Fix file description.
538
083114f8 5392019-06-28 Nick Alcock <nick.alcock@oracle.com>
f57cf0e3
NA
540
541 * ctf-create.c (ctf_create): Fix off-by-one error.
542
083114f8 5432019-06-28 Nick Alcock <nick.alcock@oracle.com>
f5e9c9bd
NA
544
545 * ctf-impl.h: (struct ctf_strs_writable): New, non-const version of
546 struct ctf_strs.
547 (struct ctf_dtdef): Note that dtd_data.ctt_name is unpopulated.
548 (struct ctf_str_atom): New, disambiguated single string.
549 (struct ctf_str_atom_ref): New, points to some other location that
550 references this string's offset.
551 (struct ctf_file): New members ctf_str_atoms and ctf_str_num_refs.
552 Remove member ctf_dtvstrlen: we no longer track the total strlen
553 as we add strings.
554 (ctf_str_create_atoms): Declare new function in ctf-string.c.
555 (ctf_str_free_atoms): Likewise.
556 (ctf_str_add): Likewise.
557 (ctf_str_add_ref): Likewise.
558 (ctf_str_rollback): Likewise.
559 (ctf_str_purge_refs): Likewise.
560 (ctf_str_write_strtab): Likewise.
561 (ctf_realloc): Declare new function in ctf-util.c.
562
563 * ctf-open.c (ctf_bufopen): Create the atoms table.
564 (ctf_file_close): Destroy it.
565 * ctf-create.c (ctf_update): Copy-and-free it on update. No longer
566 special-case the position of the parname string. Construct the
567 strtab by calling ctf_str_add_ref and ctf_str_write_strtab after the
568 rest of each buffer element is constructed, not via open-coding:
569 realloc the CTF buffer and append the strtab to it. No longer
570 maintain ctf_dtvstrlen. Sort the variable entry table later, after
571 strtab construction.
572 (ctf_copy_membnames): Remove: integrated into ctf_copy_{s,l,e}members.
573 (ctf_copy_smembers): Drop the string offset: call ctf_str_add_ref
574 after buffer element construction instead.
575 (ctf_copy_lmembers): Likewise.
576 (ctf_copy_emembers): Likewise.
577 (ctf_create): No longer maintain the ctf_dtvstrlen.
578 (ctf_dtd_delete): Likewise.
579 (ctf_dvd_delete): Likewise.
580 (ctf_add_generic): Likewise.
581 (ctf_add_enumerator): Likewise.
582 (ctf_add_member_offset): Likewise.
583 (ctf_add_variable): Likewise.
584 (membadd): Likewise.
585 * ctf-util.c (ctf_realloc): New, wrapper around realloc that aborts
586 if there are active ctf_str_num_refs.
587 (ctf_strraw): Move to ctf-string.c.
588 (ctf_strptr): Likewise.
589 * ctf-string.c: New file, strtab manipulation.
590
591 * Makefile.am (libctf_a_SOURCES): Add it.
592 * Makefile.in: Regenerate.
593
083114f8 5942019-06-28 Nick Alcock <nick.alcock@oracle.com>
9658dc39
NA
595
596 * ctf-impl.h (ctf_hash_iter_f): New.
597 (ctf_dynhash_iter): New declaration.
598 (ctf_dynhash_iter_remove): New declaration.
599 * ctf-hash.c (ctf_dynhash_iter): Define.
600 (ctf_dynhash_iter_remove): Likewise.
601 (ctf_hashtab_traverse): New.
602 (ctf_hashtab_traverse_remove): Likewise.
603 (struct ctf_traverse_cb_arg): Likewise.
604 (struct ctf_traverse_remove_cb_arg): Likewise.
605
083114f8 6062019-06-28 Nick Alcock <nick.alcock@oracle.com>
3e10cffc
NA
607
608 * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
609
083114f8 6102019-06-28 Nick Alcock <nick.alcock@oracle.com>
c550e7ba
NA
611
612 * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
613 (ctf_dump_funcs): Likewise.
614
083114f8 6152019-06-19 Nick Alcock <nick.alcock@oracle.com>
cf02c44d
NA
616
617 * ctf-open-bfd.c: Add swap.h and ctf-endian.h.
618 (ctf_fdopen): Check for endian-swapped raw CTF magic, and
619 little-endian CTF archive magic. Do not check the CTF version:
620 ctf_simple_open does that in endian-safe ways. Do not dereference
621 null pointers on open failure.
622
083114f8 6232019-06-19 Nick Alcock <nick.alcock@oracle.com>
7cee1826
NA
624
625 * ctf-open.c (get_vbytes_common): Return the new slice size.
626 (ctf_bufopen): Flip the endianness of the CTF-section header copy.
627 Remember to copy in the CTF data when opening an uncompressed
628 foreign-endian CTF file. Prune useless variable manipulation.
629
083114f8 6302019-06-19 Nick Alcock <nick.alcock@oracle.com>
0b4fa56e
NA
631
632 * ctf-open.c (ctf_types): Fail when unidentified type kinds are
633 seen.
634
083114f8 6352019-06-19 Nick Alcock <nick.alcock@oracle.com>
364620bf
NA
636
637 * ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
638 output.
639
083114f8 6402019-06-19 Nick Alcock <nick.alcock@oracle.com>
65365aa8
NA
641
642 * ctf-subr.c (_PAGESIZE): Remove.
643 (ctf_data_alloc): Likewise.
644 (ctf_data_free): Likewise.
645 (ctf_data_protect): Likewise.
646 * ctf-impl.h: Remove declarations.
647 * ctf-create.c (ctf_update): No longer call ctf_data_protect: use
648 ctf_free, not ctf_data_free.
649 (ctf_compress_write): Use ctf_data_alloc, not ctf_alloc. Free
650 the buffer again on compression error.
651 * ctf-open.c (ctf_set_base): No longer track the size: call
652 ctf_free, not ctf_data_free.
653 (upgrade_types): Likewise. Call ctf_alloc, not ctf_data_alloc.
654 (ctf_bufopen): Likewise. No longer call ctf_data_protect.
655
083114f8 6562019-06-19 Nick Alcock <nick.alcock@oracle.com>
24865428
NA
657
658 * ctf-create.c (ctf_dtd_insert): Pass on error returns from
659 ctf_dynhash_insert.
660 (ctf_dvd_insert): Likewise.
661 (ctf_add_generic): Likewise.
662 (ctf_add_variable): Likewise.
663 * ctf-impl.h: Adjust declarations.
664
3a3a077c
AM
6652019-06-14 Alan Modra <amodra@gmail.com>
666
667 * configure: Regenerate.
668
942d35f7
NA
6692019-06-06 Nick Alcock <nick.alcock@oracle.com>
670
671 * ctf-decls.h: Include <libiberty.h>.
672 * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup().
673
595a4d43
NA
6742019-06-06 Nick Alcock <nick.alcock@oracle.com>
675
676 * ctf-dump.c (ctf_dump_format_type): Cast size_t's used in printf()s.
677 (ctf_dump_objts): Likewise.
678 (ctf_dump_funcs): Likewise.
679 (ctf_dump_member): Likewise.
680 (ctf_dump_str): Likewise.
681
f5e73be1
NA
6822019-06-06 Nick Alcock <nick.alcock@oracle.com>
683
684 * ctf-archive.c (arc_mmap_header): Mark fd as potentially unused.
685 * ctf-subr.c (ctf_data_protect): Mark both args as potentially unused.
686
62d8e3b7
NA
6872019-06-05 Nick Alcock <nick.alcock@oracle.com>
688
689 * ctf-archive.c (ctf_arc_write): Eschew %zi format specifier.
690 (ctf_arc_open_by_offset): Likewise.
691 * ctf-create.c (ctf_add_type): Likewise.
692
76fad999
TT
6932019-06-04 Tom Tromey <tromey@adacore.com>
694
695 * ctf-create.c (ctf_add_encoded, ctf_add_slice)
696 (ctf_add_member_offset): Use CHAR_BIT, not NBBY.
697
ad118caa
NA
6982019-06-04 Nick Alcock <nick.alcock@oracle.com>
699
700 * configure.ac: Check for O_CLOEXEC.
701 * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be.
702 * config.h.in: Regenerate.
703 * configure: Likewise.
704
6b22174f
NA
7052019-06-04 Nick Alcock <nick.alcock@oracle.com>
706
707 * qsort_r.c: Rename to...
708 * ctf-qsort_r.c: ... this.
709 (_quicksort): Define to ctf_qsort_r.
710 * ctf-decls.h (qsort_r): Remove.
711 (ctf_qsort_r): Add.
712 (struct ctf_qsort_arg): New, transport the real ARG and COMPAR.
713 (ctf_qsort_compar_thunk): Rearrange the arguments to COMPAR.
714 * Makefile.am (libctf_a_LIBADD): Remove.
715 (libctf_a_SOURCES): New, add ctf-qsort_r.c.
716 * ctf-archive.c (ctf_arc_write): Call ctf_qsort_r, not qsort_r.
717 * ctf-create.c (ctf_update): Likewise.
718 * configure.ac: Check for BSD versus GNU qsort_r signature.
719 * Makefile.in: Regenerate.
720 * config.h.in: Likewise.
721 * configure: Likewise.
722
941accce
NA
7232019-06-03 Nick Alcock <nick.alcock@oracle.com>
724
725 * ctf-dump.c (ctf_dump_funcs): Free in the right place.
726
a0486bac
JM
7272019-05-29 Nick Alcock <nick.alcock@oracle.com>
728
729 * Makefile.am (ZLIB): New.
730 (ZLIBINC): Likewise.
731 (AM_CFLAGS): Use them.
732 (libctf_a_LIBADD): New, for LIBOBJS.
733 * configure.ac: Check for zlib, endian.h, and qsort_r.
734 * ctf-endian.h: New, providing htole64 and le64toh.
735 * swap.h: Code style fixes.
736 (bswap_identity_64): New.
737 * qsort_r.c: New, from gnulib (with one added #include).
738 * ctf-decls.h: New, providing a conditional qsort_r declaration,
739 and unconditional definitions of MIN and MAX.
740 * ctf-impl.h: Use it. Do not use <sys/errno.h>.
741 (ctf_set_errno): Now returns unsigned long.
742 * ctf-util.c (ctf_set_errno): Adjust here too.
743 * ctf-archive.c: Use ctf-endian.h.
744 (ctf_arc_open_by_offset): Use memset, not bzero. Drop cts_type,
745 cts_flags and cts_offset.
746 (ctf_arc_write): Drop debugging dependent on the size of off_t.
747 * ctf-create.c: Provide a definition of roundup if not defined.
748 (ctf_create): Drop cts_type, cts_flags and cts_offset.
749 (ctf_add_reftype): Do not check if type IDs are below zero.
750 (ctf_add_slice): Likewise.
751 (ctf_add_typedef): Likewise.
752 (ctf_add_member_offset): Cast error-returning ssize_t's to size_t
753 when known error-free. Drop CTF_ERR usage for functions returning
754 int.
755 (ctf_add_member_encoded): Drop CTF_ERR usage for functions returning
756 int.
757 (ctf_add_variable): Likewise.
758 (enumcmp): Likewise.
759 (enumadd): Likewise.
760 (membcmp): Likewise.
761 (ctf_add_type): Likewise. Cast error-returning ssize_t's to size_t
762 when known error-free.
763 * ctf-dump.c (ctf_is_slice): Drop CTF_ERR usage for functions
764 returning int: use CTF_ERR for functions returning ctf_type_id.
765 (ctf_dump_label): Likewise.
766 (ctf_dump_objts): Likewise.
767 * ctf-labels.c (ctf_label_topmost): Likewise.
768 (ctf_label_iter): Likewise.
769 (ctf_label_info): Likewise.
770 * ctf-lookup.c (ctf_func_args): Likewise.
771 * ctf-open.c (upgrade_types): Cast to size_t where appropriate.
772 (ctf_bufopen): Likewise. Use zlib types as needed.
773 * ctf-types.c (ctf_member_iter): Drop CTF_ERR usage for functions
774 returning int.
775 (ctf_enum_iter): Likewise.
776 (ctf_type_size): Likewise.
777 (ctf_type_align): Likewise. Cast to size_t where appropriate.
778 (ctf_type_kind_unsliced): Likewise.
779 (ctf_type_kind): Likewise.
780 (ctf_type_encoding): Likewise.
781 (ctf_member_info): Likewise.
782 (ctf_array_info): Likewise.
783 (ctf_enum_value): Likewise.
784 (ctf_type_rvisit): Likewise.
785 * ctf-open-bfd.c (ctf_bfdopen): Drop cts_type, cts_flags and
786 cts_offset.
787 (ctf_simple_open): Likewise.
788 (ctf_bfdopen_ctfsect): Likewise. Set cts_size properly.
789 * Makefile.in: Regenerate.
790 * aclocal.m4: Likewise.
791 * config.h: Likewise.
792 * configure: Likewise.
793
9698cf9b
NA
7942019-05-28 Nick Alcock <nick.alcock@oracle.com>
795
796 * configure.in: Check for bfd_section_from_elf_index.
797 * configure: Regenerate.
798 * config.h.in [HAVE_BFD_ELF]: Likewise.
799 * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it.
800 abfd is potentially unused now.
801
0e65dfba
NA
8022019-05-28 Nick Alcock <nick.alcock@oracle.com>
803
804 * Makefile.am: New.
805 * Makefile.in: Regenerated.
806 * config.h.in: Likewise.
807 * aclocal.m4: Likewise.
808 * configure: Likewise.
809
a30b3e18
NA
8102019-05-28 Nick Alcock <nick.alcock@oracle.com>
811
812 * ctf-dump.c: New.
813
6dbf2b73
NA
8142019-05-28 Nick Alcock <nick.alcock@oracle.com>
815
816 * ctf-labels.c: New.
817
6c33b742
NA
8182019-05-28 Nick Alcock <nick.alcock@oracle.com>
819
820 * ctf-impl.h (_libctf_version): New declaration.
821 * ctf-subr.c (_libctf_version): Define it.
822 (ctf_version): New.
823
c499eb68
NA
8242019-05-28 Nick Alcock <nick.alcock@oracle.com>
825
826 * ctf-create.c (enumcmp): New.
827 (enumadd): Likewise.
828 (membcmp): Likewise.
829 (membadd): Likewise.
830 (ctf_add_type): Likewise.
831
b437bfe0
NA
8322019-05-28 Nick Alcock <nick.alcock@oracle.com>
833
834 * ctf-lookup.c (isqualifier): New.
835 (ctf_lookup_by_name): Likewise.
836 (struct ctf_lookup_var_key): Likewise.
837 (ctf_lookup_var): Likewise.
838 (ctf_lookup_variable): Likewise.
839 (ctf_lookup_symbol_name): Likewise.
840 (ctf_lookup_by_symbol): Likewise.
841 (ctf_func_info): Likewise.
842 (ctf_func_args): Likewise.
843
316afdb1
NA
8442019-05-28 Nick Alcock <nick.alcock@oracle.com>
845
846 * ctf-decl.c: New file.
847 * ctf-types.c: Likewise.
848 * ctf-impl.h: New declarations.
849
143dce84
NA
8502019-05-28 Nick Alcock <nick.alcock@oracle.com>
851
852 * ctf-open-bfd.c: New file.
853 * ctf-open.c (ctf_close): New.
854 * ctf-impl.h: Include bfd.h.
855 (ctf_file): New members ctf_data_mmapped, ctf_data_mmapped_len.
856 (ctf_archive_internal): New members ctfi_abfd, ctfi_data,
857 ctfi_bfd_close.
858 (ctf_bfdopen_ctfsect): New declaration.
859 (_CTF_SECTION): likewise.
860
9402cc59
NA
8612019-05-28 Nick Alcock <nick.alcock@oracle.com>
862
863 * ctf-archive.c: New.
864 * ctf-impl.h (ctf_archive_internal): New type.
865 (ctf_arc_open_internal): New declaration.
866 (ctf_arc_bufopen): Likewise.
867 (ctf_arc_close_internal): Likewise.
868
72f33921
NA
8692019-05-28 Nick Alcock <nick.alcock@oracle.com>
870
871 * ctf-open.c: New file.
872 * swap.h: Likewise.
873
47d546f4
NA
8742019-05-28 Nick Alcock <nick.alcock@oracle.com>
875
876 * ctf-create.c: New file.
877 * ctf-lookup.c: New file.
878
a5be9bbe
NA
8792019-05-28 Nick Alcock <nick.alcock@oracle.com>
880
881 * ctf-impl.h: New definitions and declarations for type creation
882 and lookup.
883
c0754cdd
NA
8842019-05-28 Nick Alcock <nick.alcock@oracle.com>
885
886 * ctf-hash.c: New file.
887 * ctf-impl.h: New declarations.
888
479604f4
NA
8892019-05-28 Nick Alcock <nick.alcock@oracle.com>
890
891 * ctf-error.c: New file.
892
94585e7f
NA
8932019-05-28 Nick Alcock <nick.alcock@oracle.com>
894
895 * ctf-util.c: New file.
896 * elf.h: Likewise.
897 * ctf-impl.h: Include it, and add declarations.
898
60da9d95
NA
8992019-05-28 Nick Alcock <nick.alcock@oracle.com>
900
901 * ctf-impl.h: New file.
902 * ctf-subr.c: New file.
903
904\f
905Local Variables:
906mode: change-log
907left-margin: 8
908fill-column: 76
909version-control: never
910End: