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