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