libctf: minor error-handling fixes
[deliverable/binutils-gdb.git] / libctf / ChangeLog
1 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
2
3 * ctf-dedup.c (ctf_dedup): Pass on errors from ctf_dedup_hash_type.
4 Call ctf_dedup_fini properly on other errors.
5 (ctf_dedup_emit_type): Set the errno on dynhash insertion failure.
6 * ctf-link.c (ctf_link_deduplicating_per_cu): Close outputs beyond
7 output 0 when asserting because >1 output is found.
8 (ctf_link_deduplicating): Likewise, when asserting because the
9 shared output is not the same as the passed-in fp.
10
11 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
12
13 * ctf-impl.h (ctf_dict_t) <ctf_link_type_mapping>: No longer used
14 by the nondeduplicating linker.
15 (ctf_add_type_mapping): Removed, now static.
16 (ctf_type_mapping): Likewise.
17 (ctf_dedup_type_mapping): New.
18 (ctf_dedup_t) <cd_input_nums>: New.
19 * ctf-dedup.c (ctf_dedup_init): Populate it.
20 (ctf_dedup_fini): Free it again. Emphasise that this has to be
21 the last thing called.
22 (ctf_dedup): Populate it.
23 (ctf_dedup_populate_type_mapping): Removed.
24 (ctf_dedup_populate_type_mappings): Likewise.
25 (ctf_dedup_emit): No longer call it. No longer call
26 ctf_dedup_fini either.
27 (ctf_dedup_type_mapping): New.
28 * ctf-link.c (ctf_unnamed_cuname): New.
29 (ctf_create_per_cu): Arguments must be non-null now.
30 (ctf_in_member_cb_arg): Removed.
31 (ctf_link): No longer populate it. No longer discard the
32 mapping table.
33 (ctf_link_deduplicating_one_symtypetab): Use
34 ctf_dedup_type_mapping, not ctf_type_mapping. Use
35 ctf_unnamed_cuname.
36 (ctf_link_one_variable): Likewise. Pass in args individually: no
37 longer a ctf_variable_iter callback.
38 (empty_link_type_mapping): Removed.
39 (ctf_link_deduplicating_variables): Use ctf_variable_next, not
40 ctf_variable_iter. No longer pack arguments to
41 ctf_link_one_variable into a struct.
42 (ctf_link_deduplicating_per_cu): Call ctf_dedup_fini once
43 all link phases are done.
44 (ctf_link_deduplicating): Likewise.
45 (ctf_link_intern_extern_string): Improve comment.
46 (ctf_add_type_mapping): Migrate...
47 (ctf_type_mapping): ... these functions...
48 * ctf-create.c (ctf_add_type_mapping): ... here...
49 (ctf_type_mapping): ... and make static, for the sole use of
50 ctf_add_type.
51
52 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
53
54 * ctf-link.c (ctf_link_one_variable): Remove reference to
55 "unconflicted link mode".
56
57 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
58
59 * ctf-link.c (ctf_create_per_cu): Drop FILENAME now that it is
60 always identical to CUNAME.
61 (ctf_link_deduplicating_one_symtypetab): Adjust.
62 (ctf_link_one_type): Remove.
63 (ctf_link_one_input_archive_member): Likewise.
64 (ctf_link_close_one_input_archive): Likewise.
65 (ctf_link_one_input_archive): Likewise.
66 (ctf_link): No longer call it. Drop CTF_LINK_NONDEDUP path.
67 Improve header comment a bit (dicts, not files). Adjust
68 ctf_create_per_cu call.
69 (ctf_link_deduplicating_variables): Simplify.
70 (ctf_link_in_member_cb_arg_t) <cu_name>: Remove.
71 <in_input_cu_file>: Likewise.
72 <in_fp_parent>: Likewise.
73 <done_parent>: Likewise.
74 (ctf_link_one_variable): Turn uses of in_file_name to in_cuname.
75
76 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
77
78 * ctf-types.c (ctf_member_iter): Move 'rc' to an inner scope.
79 (ctf_enum_iter): Reimplement in terms of ctf_enum_next.
80 (ctf_type_iter): Reimplement in terms of ctf_type_next.
81 (ctf_type_iter_all): Likewise.
82 (ctf_variable_iter): Reimplement in terms of ctf_variable_next.
83 * ctf-archive.c (ctf_archive_iter_internal): Remove.
84 (ctf_archive_iter): Reimplement in terms of ctf_archive_next.
85
86 2021-03-02 Nick Alcock <nick.alcock@oracle.com>
87
88 * ctf-archive.c (ctf_archive_next): Set the name of parents in
89 single-member archives.
90
91 2021-02-26 Alan Modra <amodra@gmail.com>
92
93 * Makefile.in: Regenerate.
94
95 2021-02-21 Alan Modra <amodra@gmail.com>
96
97 * configure.ac: Invoke AC_CANONICAL_TARGET, AC_CANONICAL_HOST
98 and AC_CANONICAL_BUILD.
99 * configure: Regenerate.
100 * Makefile.in: Regenerate.
101
102 2021-02-20 Nick Alcock <nick.alcock@oracle.com>
103
104 * ctf-impl.h (ctf_dict_t) <ctf_symhash>: New.
105 <ctf_symhash_latest>: Likewise.
106 (struct ctf_archive_internal) <ctfi_crossdict_cache>: New.
107 <ctfi_symnamedicts>: New.
108 <ctfi_syms>: Remove.
109 (ctf_lookup_symbol_name): Remove.
110 * ctf-lookup.c (ctf_lookup_symbol_name): Propagate errors from
111 parent properly. Make static.
112 (ctf_lookup_symbol_idx): New, linear search for the symbol name,
113 cached in the crossdict cache's ctf_symhash (if available), or
114 this dict's (otherwise).
115 (ctf_try_lookup_indexed): Allow the symname to be passed in.
116 (ctf_lookup_by_symbol): Turn into a wrapper around...
117 (ctf_lookup_by_sym_or_name): ... this, supporting name lookup too,
118 using ctf_lookup_symbol_idx in non-writable dicts. Special-case
119 name lookup in dynamic dicts without reported symbols, which have
120 no symtab or dynsymidx but where name lookup should still work.
121 (ctf_lookup_by_symbol_name): New, another wrapper.
122 * ctf-archive.c (enosym): Note that this is present in
123 ctfi_symnamedicts too.
124 (ctf_arc_close): Adjust for removal of ctfi_syms. Free the
125 ctfi_symnamedicts.
126 (ctf_arc_flush_caches): Likewise.
127 (ctf_dict_open_cached): Memoize the first cached dict in the
128 crossdict cache.
129 (ctf_arc_lookup_symbol): Turn into a wrapper around...
130 (ctf_arc_lookup_sym_or_name): ... this. No longer cache
131 ctf_id_t lookups: just call ctf_lookup_by_symbol as needed (but
132 still cache the dicts those lookups succeed in). Add
133 lookup-by-name support, with dicts of successful lookups cached in
134 ctfi_symnamedicts. Refactor the caching code a bit.
135 (ctf_arc_lookup_symbol_name): New, another wrapper.
136 * ctf-open.c (ctf_dict_close): Free the ctf_symhash.
137 * libctf.ver (LIBCTF_1.2): New version. Add
138 ctf_lookup_by_symbol_name, ctf_arc_lookup_symbol_name.
139 * testsuite/libctf-lookup/enum-symbol.c (main): Use
140 ctf_arc_lookup_symbol rather than looking up the name ourselves.
141 Fish it out repeatedly, to make sure that symbol caching isn't
142 broken.
143 (symidx_64): Remove.
144 (symidx_32): Remove.
145 * testsuite/libctf-lookup/enum-symbol-obj.lk: Test symbol lookup
146 in an unlinked object file (indexed symtypetab sections only).
147 * testsuite/libctf-writable/symtypetab-nonlinker-writeout.c
148 (try_maybe_reporting): Check symbol types via
149 ctf_lookup_by_symbol_name as well as ctf_symbol_next.
150 * testsuite/libctf-lookup/conflicting-type-syms.*: New test of
151 lookups in a multi-dict archive.
152
153 2021-02-20 Alan Modra <amodra@gmail.com>
154
155 * testsuite/config/default.exp (ld_L_opt): Define.
156 * testsuite/lib/ctf-lib.exp (load_common_lib): Delete. Instead load
157 ld-lib.exp.
158 (run_host_cmd, run_host_cmd_yesno, check_compiler_available): Delete.
159 (compile_one_cc, check_ctf_available): Delete.
160
161 2021-02-03 Nick Alcock <nick.alcock@oracle.com>
162
163 * configure.ac (ac_cv_libctf_bfd_elf): Include string.h.
164 * configure: Regenerated.
165
166 2021-02-03 Nick Alcock <nick.alcock@oracle.com>
167
168 * configure.ac (EXPECT): Check for, in order to define...
169 (TCL_TRY): ... this, if Tcl supports try/catch.
170 * Makefile.am (TCL_TRY): Run the testsuite only if set.
171 * configure: Regenerated.
172 * Makefile.in: Likewise.
173
174 2021-02-02 Nick Alcock <nick.alcock@oracle.com>
175
176 * configure.ac (CTF_LIBADD): Remove explicit -lintl population in
177 favour of LIBINTL.
178 * Makefile.am (libctf_nobfd_la_LIBADD): No longer explicitly
179 include $(LIBINTL).
180 (check-DEJAGNU): Pass down to tests as well.
181 * configure: Regenerated.
182 * Makefile.in: Likewise.
183
184 2021-01-27 Nick Alcock <nick.alcock@oracle.com>
185
186 * ctf-string.c (ctf_str_add): Treat adding a NULL as adding "".
187 (ctf_str_add_ref): Likewise.
188 (ctf_str_add_external): Likewise.
189 * ctf-types.c (ctf_type_name_raw): Always return "" for offset 0.
190 * ctf-dedup.c (ctf_dedup_multiple_input_dicts): Don't armour
191 against NULL name.
192 (ctf_dedup_maybe_synthesize_forward): Likewise.
193
194 2021-01-27 Nick Alcock <nick.alcock@oracle.com>
195
196 * ctf-create.c (ctf_serialize): Fix shadowing.
197
198 2021-01-27 Nick Alcock <nick.alcock@oracle.com>
199
200 * ctf-create.c (ctf_add_encoded): Add check for non-empty name.
201 (ctf_add_forward): Likewise.
202 (ctf_add_typedef): Likewise.
203
204 2021-01-27 Nick Alcock <nick.alcock@oracle.com>
205
206 * ctf-open.c (init_types): Rip out code to check anonymous typedef
207 nodes.
208 * ctf-create.c (ctf_add_reftype): Likewise.
209 * ctf-lookup.c (refresh_pptrtab): Likewise.
210
211 2021-01-27 Nick Alcock <nick.alcock@oracle.com>
212
213 * ctf-impl.c (_libctf_nonnull_): Add parameters.
214 (LCTF_LINKING): New flag.
215 (ctf_dict_t) <ctf_link_flags>: Mention it.
216 * ctf-link.c (ctf_link): Keep LCTF_LINKING set across call.
217 (ctf_write): Likewise, including in child dictionaries.
218 (ctf_link_shuffle_syms): Make sure ctf_dynsyms is NULL if there
219 are no reported symbols.
220 * ctf-create.c (symtypetab_delete_nonstatic_vars): Make sure
221 the variable has been reported as a symbol by the linker.
222 (symtypetab_skippable): Mention relationship between SYMFP and the
223 flags.
224 (symtypetab_density): Adjust nonnullity. Exit early if no symbols
225 were reported and force-indexing is off (i.e., we are doing a
226 final link).
227 (ctf_serialize): Handle the !LCTF_LINKING case by writing out an
228 indexed, sorted symtypetab (and allow SYMFP to be NULL in this
229 case). Turn sorting off if this is a non-final link. Only delete
230 nonstatic vars if we are filtering symbols and the linker has
231 reported some.
232 * testsuite/libctf-regression/nonstatic-var-section-ld-r*:
233 New test of variable and symtypetab section population when
234 ld -r is used.
235 * testsuite/libctf-regression/nonstatic-var-section-ld-executable.lk:
236 Likewise, when ld of an executable is used.
237 * testsuite/libctf-regression/nonstatic-var-section-ld.lk:
238 Likewise, when ld -shared alone is used.
239 * testsuite/libctf-regression/nonstatic-var-section-ld*.c:
240 Lookup programs for the above.
241 * testsuite/libctf-writable/symtypetab-nonlinker-writeout.*: New
242 test, testing survival of symbols across ctf_write paths.
243 * testsuite/lib/ctf-lib.exp (run_lookup_test): New option,
244 nonshared, suppressing linking of the SOURCE with -shared.
245
246 2021-01-19 Nick Alcock <nick.alcock@oracle.com>
247
248 * ctf-create.c (membadd): Transform ""-named members into
249 NULL-named ones.
250 * testsuite/libctf-regression/type-add-unnamed-struct*: New test.
251
252 2021-01-19 Nick Alcock <nick.alcock@oracle.com>
253
254 * ctf-lookup.c (ctf_lookup_by_name_internal): Do not return the
255 base type if looking up a nonexistent pointer type.
256 * testsuite/libctf-regression/pptrtab*: Test it.
257
258 2021-01-13 Alan Modra <amodra@gmail.com>
259
260 * Makefile.in: Regenerate.
261
262 2021-01-12 H.J. Lu <hongjiu.lu@intel.com>
263
264 PR binutils/26792
265 * configure.ac: Use GNU_MAKE_JOBSERVER.
266 * aclocal.m4: Regenerated.
267 * configure: Likewise.
268
269 2021-01-11 H.J. Lu <hongjiu.lu@intel.com>
270
271 PR ld/27173
272 * configure: Regenerated.
273
274 2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
275
276 * configure: Regenerated.
277
278 2021-01-09 Nick Clifton <nickc@redhat.com>
279
280 * 2.36 release branch crated.
281
282 2021-01-09 Alan Modra <amodra@gmail.com>
283
284 * configure: Regenerate.
285
286 2021-01-07 Samuel Thibault <samuel.thibault@gnu.org>
287
288 * configure: Regenerate.
289
290 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
291
292 * testsuite/libctf-lookup/struct-iteration.c (main):
293 ctf_member_count returns an int.
294
295 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
296
297 * Makefile.am (BASEDIR): New.
298 (BFDDIR): Likewise.
299 (check-DEJAGNU): Add development.exp to prerequisites.
300 (development.exp): New.
301 (CONFIG_STATUS_DEPENDENCIES): New.
302 (EXTRA_DEJAGNU_SITE_CONFIG): Likewise.
303 (DISTCLEANFILES): Likewise.
304 * Makefile.in: Regenerated.
305 * testsuite/lib/ctf-lib.exp (check_ctf_available): Return boolean.
306 * testsuite/libctf-lookup/lookup.exp: Call check_ctf_available.
307 * testsuite/libctf-regression/regression.exp: Likewise.
308
309 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
310
311 * ctf-types.c (ctf_type_aname): Print forwards to unions and enums
312 properly.
313
314 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
315
316 * ctf-impl.h (ctf_dict_t) <ctf_pptrtab>: New.
317 <ctf_pptrtab_len>: New.
318 <ctf_pptrtab_typemax>: New.
319 * ctf-create.c (ctf_serialize): Update accordingly.
320 (ctf_add_reftype): Note that we don't need to update pptrtab here,
321 despite updating ptrtab.
322 * ctf-open.c (ctf_dict_close): Destroy the pptrtab.
323 (ctf_import): Likewise.
324 (ctf_import_unref): Likewise.
325 * ctf-lookup.c (grow_pptrtab): New.
326 (refresh_pptrtab): New, update a pptrtab.
327 (ctf_lookup_by_name): Turn into a wrapper around (and rename to)...
328 (ctf_lookup_by_name_internal): ... this: construct the pptrtab, and
329 use it in addition to the parent's ptrtab when parent dicts are
330 searched.
331 * testsuite/libctf-regression/regression.exp: New testsuite for
332 regression tests.
333 * testsuite/libctf-regression/pptrtab*: New test.
334 * testsuite/libctf-writable/writable.exp: New testsuite for tests of
335 writable CTF dicts.
336 * testsuite/libctf-writable/pptrtab*: New test.
337
338 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
339
340 * ctf-archive.c (ctf_archive_iter): Remove outdated comment.
341
342 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
343
344 * ctf-impl.h (struct ctf_next) <u.ctn_next>: Move to...
345 <ctn_next>: ... here.
346 * ctf-util.c (ctf_next_destroy): Unconditionally destroy it.
347 * ctf-lookup.c (ctf_symbol_next): Adjust accordingly.
348 * ctf-types.c (ctf_member_iter): Reimplement in terms of...
349 (ctf_member_next): ... this. Support recursive unnamed member
350 iteration (off by default).
351 (ctf_member_info): Look up members in unnamed sub-structs.
352 * ctf-dedup.c (ctf_dedup_rhash_type): Adjust ctf_member_next call.
353 (ctf_dedup_emit_struct_members): Likewise.
354 * testsuite/libctf-lookup/struct-iteration-ctf.c: Test empty unnamed
355 members, and a normal member after the end.
356 * testsuite/libctf-lookup/struct-iteration.c: Verify that
357 ctf_member_count is consistent with the number of successful returns
358 from a non-recursive ctf_member_next.
359 * testsuite/libctf-lookup/struct-iteration-*: New, test iteration
360 over struct members.
361 * testsuite/libctf-lookup/struct-lookup.c: New test.
362 * testsuite/libctf-lookup/struct-lookup.lk: New test.
363
364 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
365
366 * ctf-link.c (ctf_link_warn_outdated_inputs): New.
367 (ctf_link_write): Call it.
368
369 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
370
371 * testsuite/libctf-lookup/enum-symbol.lk: New symbol-lookup test.
372 * testsuite/libctf-lookup/enum-symbol-ctf.c: New CTF input.
373 * testsuite/libctf-lookup/enum-symbol.c: New lookup test.
374
375 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
376
377 * Makefile.am (EXPECT): New.
378 (RUNTEST): Likewise.
379 (RUNTESTFLAGS): Likewise.
380 (CC_FOR_TARGET): Likewise.
381 (check-DEJAGNU): Likewise.
382 (AUTOMAKE_OPTIONS): Add dejagnu.
383 * Makefile.in: Regenerated.
384 * testsuite/config/default.exp: New.
385 * testsuite/lib/ctf-lib.exp: Likewise.
386 * testsuite/libctf-lookup/enum.lk: New test.
387 * testsuite/libctf-lookup/enum-ctf.c: New CTF input.
388 * testsuite/libctf-lookup/enum.c: New lookup test.
389 * testsuite/libctf-lookup/ambiguous-struct*.c: New test.
390 * testsuite/libctf-lookup/lookup.exp: New.
391
392 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
393
394 * configure.ac (BFD_LIBADD): Remove.
395 (BFD_DEPENDENCIES): Likewise. Remove associated cases.
396 (SHARED_LIBADD): Rename to...
397 (CTF_LIBADD): ... this. Stick in a suitable libiberty even when
398 linking statically.
399 * Makefile.am (libctf_nobfd_la_LIBADD): Adjust accordingly.
400 libctf uses libintl.
401 (libctf_la_LIBADD): Reference libbfd.la directly, not via
402 BFD_LIBADD.
403 (libctf_la_DEPENDENCIES): Remove.
404 * Makefile.in: Regenerate.
405 * configure: Likewise.
406
407 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
408
409 * ctf-decl.c (ctf_decl_push): Exclude slices from the decl stack.
410 * ctf-types.c (ctf_type_aname): No longer deal with slices here.
411 * ctf-dump.c (ctf_dump_membstate_t) <cdm_toplevel_indent>: Constify.
412 (CTF_FT_REFS): New.
413 (CTF_FT_BITFIELD): Likewise.
414 (CTF_FT_ID): Likewise.
415 (ctf_dump_member): Do not do indentation here. Migrate the
416 type-printing parts of this into...
417 (ctf_dump_format_type): ... here, to be shared by all type printers.
418 Get the errno value for non-representable types right. Do not print
419 bitfield info for non-bitfields. Improve the format and indentation
420 of other type output. Shuffle spacing around to make all indentation
421 either 'width of column' or 4 chars.
422 (ctf_dump_label): Pass CTF_FT_REFS to ctf_dump_format_type.
423 (ctf_dump_objts): Likewise. Spacing shuffle.
424 (ctf_dump_var): Likewise.
425 (type_hex_digits): Migrate down in the file, to above its new user.
426 (ctf_dump_type): Indent here instead. Pass CTF_FT_REFS to
427 ctf_dump_format_type. Don't trim off excess linefeeds now we no
428 longer generate them. Dump enumerated types.
429
430 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
431
432 * ctf-types.c (ctf_type_resolve): Improve comment.
433 (ctf_type_size): Yield ECTF_INCOMPLETE when applied to forwards.
434 Emit errors into the right dict.
435 (ctf_type_align): Likewise.
436 * ctf-create.c (ctf_add_member_offset): Yield ECTF_INCOMPLETE
437 when adding a member without explicit offset when this member, or
438 the previous member, is incomplete.
439 * ctf-dump.c (ctf_dump_format_type): Do not try to print the size of
440 forwards.
441 (ctf_dump_member): Do not try to print their alignment.
442
443 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
444
445 * ctf-dump.c (ctf_dump_objts): Dump by calling ctf_dump_format_type.
446 (ctf_dump_format_type): Don't emit the size for function objects.
447 Dump the element type of arrays like we dump the pointed-to type of
448 pointers, etc.
449
450 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
451
452 * ctf-dump.c (ctf_dump_format_type): Add 0x to hex type IDs.
453 (ctf_dump_header): Add 0x to the hex magic number.
454 (ctf_dump_str): Add 0x to the hex string offsets.
455 (ctf_dump_membstate_t) <cdm_toplevel_indent>: New.
456 (ctf_dump_type): Adjust. Free it when we're done.
457 (type_hex_digits): New.
458 (ctf_dump_member): Align output depending on the width of the type
459 ID being generated. Use printf padding, not a loop, to generate
460 indentation.
461
462 2021-01-05 Nick Alcock <nick.alcock@oracle.com>
463
464 * ctf-decl.c (ctf_decl_push): Don't print array decls backwards.
465
466 2021-01-04 Nicolas Boulenguez <nicolas@debian.org>
467
468 PR 27117
469 * configure.ac: Make AC_CONFIG_MACRO_DIR consistent with
470 ACLOCAL_AMFLAGS -I dirs.
471 * configure: Regenerate.
472
473 2021-01-01 Alan Modra <amodra@gmail.com>
474
475 Update year range in copyright notice of all files.
476
477 For older changes see ChangeLog-2020
478 \f
479 Copyright (C) 2021 Free Software Foundation, Inc.
480
481 Copying and distribution of this file, with or without modification,
482 are permitted in any medium without royalty provided the copyright
483 notice and this notice are preserved.
484
485 Local Variables:
486 mode: change-log
487 left-margin: 8
488 fill-column: 74
489 version-control: never
490 End:
This page took 0.046383 seconds and 5 git commands to generate.