libctf, bfd: fix ctf_bfdopen_ctfsect opening symbol and string sections
[deliverable/binutils-gdb.git] / libctf / ChangeLog
1 2019-07-13 Nick Alcock <nick.alcock@oracle.com>
2
3 * ctf-open-bfd.c: Add <assert.h>.
4 (ctf_bfdopen_ctfsect): Open string and symbol tables using
5 techniques borrowed from bfd_elf_sym_name.
6 (ctf_new_archive_internal): Improve comment.
7 * ctf-archive.c (ctf_arc_close): Do not free the ctfi_strsect.
8 * ctf-open.c (ctf_bufopen): Allow opening with a string section but
9 no symbol section, but not vice versa.
10
11 2019-07-08 Nick Alcock <nick.alcock@oracle.com>
12
13 * ctf-impl.h (ctf_file_t): New field ctf_openflags.
14 * ctf-open.c (ctf_bufopen): Set it. No longer dump header offsets.
15 * ctf-dump.c (dump_header): New function, dump the CTF header.
16 (ctf_dump): Call it.
17 (ctf_dump_header_strfield): New function.
18 (ctf_dump_header_sectfield): Likewise.
19
20 2019-07-06 Nick Alcock <nick.alcock@oracle.com>
21
22 * ctf-impl.h (ctf_file_t): New fields ctf_header, ctf_dynbase,
23 ctf_cuname, ctf_dyncuname: ctf_base and ctf_buf are no longer const.
24 * ctf-open.c (ctf_set_base): Preserve the gap between ctf_buf and
25 ctf_base: do not assume that it is always sizeof (ctf_header_t).
26 Print out ctf_cuname: only print out ctf_parname if set.
27 (ctf_free_base): Removed, ctf_base is no longer freed: free
28 ctf_dynbase instead.
29 (ctf_set_version): Fix spacing.
30 (upgrade_header): New, in-place header upgrading.
31 (upgrade_types): Rename to...
32 (upgrade_types_v1): ... this. Free ctf_dynbase, not ctf_base. No
33 longer track old and new headers separately. No longer allow for
34 header sizes explicitly: squeeze the headers out on upgrade (they
35 are preserved in fp->ctf_header). Set ctf_dynbase, ctf_base and
36 ctf_buf explicitly. Use ctf_free, not ctf_free_base.
37 (upgrade_types): New, also handle ctf_parmax updating.
38 (flip_header): Flip ctf_cuname.
39 (flip_types): Flip BUF explicitly rather than deriving BUF from
40 BASE.
41 (ctf_bufopen): Store the header in fp->ctf_header. Correct minimum
42 required alignment of objtoff and funcoff. No longer store it in
43 the ctf_buf unless that buf is derived unmodified from the input.
44 Set ctf_dynbase where ctf_base is dynamically allocated. Drop locals
45 that duplicate fields in ctf_file: move allocation of ctf_file
46 further up instead. Call upgrade_header as needed. Move
47 version-specific ctf_parmax initialization into upgrade_types. More
48 concise error handling.
49 (ctf_file_close): No longer test for null pointers before freeing.
50 Free ctf_dyncuname, ctf_dynbase, and ctf_header. Do not call
51 ctf_free_base.
52 (ctf_cuname): New.
53 (ctf_cuname_set): New.
54 * ctf-create.c (ctf_update): Populate ctf_cuname.
55 (ctf_gzwrite): Write out the header explicitly. Remove obsolescent
56 comment.
57 (ctf_write): Likewise.
58 (ctf_compress_write): Get the header from ctf_header, not ctf_base.
59 Fix the compression length: fp->ctf_size never counted the CTF
60 header. Simplify the compress call accordingly.
61
62 2019-07-11 Hans-Peter Nilsson <hp@bitrange.com>
63
64 * ctf-endian.h: Don't assume htole64 and le64toh are always
65 present if HAVE_ENDIAN_H; also check if htole64 is defined.
66 [!WORDS_BIGENDIAN] (htole64, le64toh): Define as identity,
67 not bswap_identity_64.
68
69 2019-09-18 Alan Modra <amodra@gmail.com>
70
71 * ctf-open-bfd.c: Update throughout for bfd section macro changes.
72
73 2019-09-09 Phil Blundell <pb@pbcl.net>
74
75 binutils 2.33 branch created.
76
77 2019-07-18 Nick Alcock <nick.alcock@oracle.com>
78
79 * ctf-types.c (ctf_type_aname_raw): New.
80 (ctf_func_type_info): Likewise.
81 (ctf_func_type_args): Likewise.
82 * ctf-error.c (_ctf_errlist): Fix description.
83 * ctf-lookup.c: Fix file description.
84
85 2019-06-28 Nick Alcock <nick.alcock@oracle.com>
86
87 * ctf-create.c (ctf_create): Fix off-by-one error.
88
89 2019-06-28 Nick Alcock <nick.alcock@oracle.com>
90
91 * ctf-impl.h: (struct ctf_strs_writable): New, non-const version of
92 struct ctf_strs.
93 (struct ctf_dtdef): Note that dtd_data.ctt_name is unpopulated.
94 (struct ctf_str_atom): New, disambiguated single string.
95 (struct ctf_str_atom_ref): New, points to some other location that
96 references this string's offset.
97 (struct ctf_file): New members ctf_str_atoms and ctf_str_num_refs.
98 Remove member ctf_dtvstrlen: we no longer track the total strlen
99 as we add strings.
100 (ctf_str_create_atoms): Declare new function in ctf-string.c.
101 (ctf_str_free_atoms): Likewise.
102 (ctf_str_add): Likewise.
103 (ctf_str_add_ref): Likewise.
104 (ctf_str_rollback): Likewise.
105 (ctf_str_purge_refs): Likewise.
106 (ctf_str_write_strtab): Likewise.
107 (ctf_realloc): Declare new function in ctf-util.c.
108
109 * ctf-open.c (ctf_bufopen): Create the atoms table.
110 (ctf_file_close): Destroy it.
111 * ctf-create.c (ctf_update): Copy-and-free it on update. No longer
112 special-case the position of the parname string. Construct the
113 strtab by calling ctf_str_add_ref and ctf_str_write_strtab after the
114 rest of each buffer element is constructed, not via open-coding:
115 realloc the CTF buffer and append the strtab to it. No longer
116 maintain ctf_dtvstrlen. Sort the variable entry table later, after
117 strtab construction.
118 (ctf_copy_membnames): Remove: integrated into ctf_copy_{s,l,e}members.
119 (ctf_copy_smembers): Drop the string offset: call ctf_str_add_ref
120 after buffer element construction instead.
121 (ctf_copy_lmembers): Likewise.
122 (ctf_copy_emembers): Likewise.
123 (ctf_create): No longer maintain the ctf_dtvstrlen.
124 (ctf_dtd_delete): Likewise.
125 (ctf_dvd_delete): Likewise.
126 (ctf_add_generic): Likewise.
127 (ctf_add_enumerator): Likewise.
128 (ctf_add_member_offset): Likewise.
129 (ctf_add_variable): Likewise.
130 (membadd): Likewise.
131 * ctf-util.c (ctf_realloc): New, wrapper around realloc that aborts
132 if there are active ctf_str_num_refs.
133 (ctf_strraw): Move to ctf-string.c.
134 (ctf_strptr): Likewise.
135 * ctf-string.c: New file, strtab manipulation.
136
137 * Makefile.am (libctf_a_SOURCES): Add it.
138 * Makefile.in: Regenerate.
139
140 2019-06-28 Nick Alcock <nick.alcock@oracle.com>
141
142 * ctf-impl.h (ctf_hash_iter_f): New.
143 (ctf_dynhash_iter): New declaration.
144 (ctf_dynhash_iter_remove): New declaration.
145 * ctf-hash.c (ctf_dynhash_iter): Define.
146 (ctf_dynhash_iter_remove): Likewise.
147 (ctf_hashtab_traverse): New.
148 (ctf_hashtab_traverse_remove): Likewise.
149 (struct ctf_traverse_cb_arg): Likewise.
150 (struct ctf_traverse_remove_cb_arg): Likewise.
151
152 2019-06-28 Nick Alcock <nick.alcock@oracle.com>
153
154 * ctf-hash.c (ctf_dynhash_remove): Call with a mocked-up element.
155
156 2019-06-28 Nick Alcock <nick.alcock@oracle.com>
157
158 * ctf-dump.c (ctf_dump_format_type): Prefix hex strings with 0x.
159 (ctf_dump_funcs): Likewise.
160
161 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
162
163 * ctf-open-bfd.c: Add swap.h and ctf-endian.h.
164 (ctf_fdopen): Check for endian-swapped raw CTF magic, and
165 little-endian CTF archive magic. Do not check the CTF version:
166 ctf_simple_open does that in endian-safe ways. Do not dereference
167 null pointers on open failure.
168
169 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
170
171 * ctf-open.c (get_vbytes_common): Return the new slice size.
172 (ctf_bufopen): Flip the endianness of the CTF-section header copy.
173 Remember to copy in the CTF data when opening an uncompressed
174 foreign-endian CTF file. Prune useless variable manipulation.
175
176 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
177
178 * ctf-open.c (ctf_types): Fail when unidentified type kinds are
179 seen.
180
181 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
182
183 * ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
184 output.
185
186 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
187
188 * ctf-subr.c (_PAGESIZE): Remove.
189 (ctf_data_alloc): Likewise.
190 (ctf_data_free): Likewise.
191 (ctf_data_protect): Likewise.
192 * ctf-impl.h: Remove declarations.
193 * ctf-create.c (ctf_update): No longer call ctf_data_protect: use
194 ctf_free, not ctf_data_free.
195 (ctf_compress_write): Use ctf_data_alloc, not ctf_alloc. Free
196 the buffer again on compression error.
197 * ctf-open.c (ctf_set_base): No longer track the size: call
198 ctf_free, not ctf_data_free.
199 (upgrade_types): Likewise. Call ctf_alloc, not ctf_data_alloc.
200 (ctf_bufopen): Likewise. No longer call ctf_data_protect.
201
202 2019-06-19 Nick Alcock <nick.alcock@oracle.com>
203
204 * ctf-create.c (ctf_dtd_insert): Pass on error returns from
205 ctf_dynhash_insert.
206 (ctf_dvd_insert): Likewise.
207 (ctf_add_generic): Likewise.
208 (ctf_add_variable): Likewise.
209 * ctf-impl.h: Adjust declarations.
210
211 2019-06-14 Alan Modra <amodra@gmail.com>
212
213 * configure: Regenerate.
214
215 2019-06-06 Nick Alcock <nick.alcock@oracle.com>
216
217 * ctf-decls.h: Include <libiberty.h>.
218 * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup().
219
220 2019-06-06 Nick Alcock <nick.alcock@oracle.com>
221
222 * ctf-dump.c (ctf_dump_format_type): Cast size_t's used in printf()s.
223 (ctf_dump_objts): Likewise.
224 (ctf_dump_funcs): Likewise.
225 (ctf_dump_member): Likewise.
226 (ctf_dump_str): Likewise.
227
228 2019-06-06 Nick Alcock <nick.alcock@oracle.com>
229
230 * ctf-archive.c (arc_mmap_header): Mark fd as potentially unused.
231 * ctf-subr.c (ctf_data_protect): Mark both args as potentially unused.
232
233 2019-06-05 Nick Alcock <nick.alcock@oracle.com>
234
235 * ctf-archive.c (ctf_arc_write): Eschew %zi format specifier.
236 (ctf_arc_open_by_offset): Likewise.
237 * ctf-create.c (ctf_add_type): Likewise.
238
239 2019-06-04 Tom Tromey <tromey@adacore.com>
240
241 * ctf-create.c (ctf_add_encoded, ctf_add_slice)
242 (ctf_add_member_offset): Use CHAR_BIT, not NBBY.
243
244 2019-06-04 Nick Alcock <nick.alcock@oracle.com>
245
246 * configure.ac: Check for O_CLOEXEC.
247 * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be.
248 * config.h.in: Regenerate.
249 * configure: Likewise.
250
251 2019-06-04 Nick Alcock <nick.alcock@oracle.com>
252
253 * qsort_r.c: Rename to...
254 * ctf-qsort_r.c: ... this.
255 (_quicksort): Define to ctf_qsort_r.
256 * ctf-decls.h (qsort_r): Remove.
257 (ctf_qsort_r): Add.
258 (struct ctf_qsort_arg): New, transport the real ARG and COMPAR.
259 (ctf_qsort_compar_thunk): Rearrange the arguments to COMPAR.
260 * Makefile.am (libctf_a_LIBADD): Remove.
261 (libctf_a_SOURCES): New, add ctf-qsort_r.c.
262 * ctf-archive.c (ctf_arc_write): Call ctf_qsort_r, not qsort_r.
263 * ctf-create.c (ctf_update): Likewise.
264 * configure.ac: Check for BSD versus GNU qsort_r signature.
265 * Makefile.in: Regenerate.
266 * config.h.in: Likewise.
267 * configure: Likewise.
268
269 2019-06-03 Nick Alcock <nick.alcock@oracle.com>
270
271 * ctf-dump.c (ctf_dump_funcs): Free in the right place.
272
273 2019-05-29 Nick Alcock <nick.alcock@oracle.com>
274
275 * Makefile.am (ZLIB): New.
276 (ZLIBINC): Likewise.
277 (AM_CFLAGS): Use them.
278 (libctf_a_LIBADD): New, for LIBOBJS.
279 * configure.ac: Check for zlib, endian.h, and qsort_r.
280 * ctf-endian.h: New, providing htole64 and le64toh.
281 * swap.h: Code style fixes.
282 (bswap_identity_64): New.
283 * qsort_r.c: New, from gnulib (with one added #include).
284 * ctf-decls.h: New, providing a conditional qsort_r declaration,
285 and unconditional definitions of MIN and MAX.
286 * ctf-impl.h: Use it. Do not use <sys/errno.h>.
287 (ctf_set_errno): Now returns unsigned long.
288 * ctf-util.c (ctf_set_errno): Adjust here too.
289 * ctf-archive.c: Use ctf-endian.h.
290 (ctf_arc_open_by_offset): Use memset, not bzero. Drop cts_type,
291 cts_flags and cts_offset.
292 (ctf_arc_write): Drop debugging dependent on the size of off_t.
293 * ctf-create.c: Provide a definition of roundup if not defined.
294 (ctf_create): Drop cts_type, cts_flags and cts_offset.
295 (ctf_add_reftype): Do not check if type IDs are below zero.
296 (ctf_add_slice): Likewise.
297 (ctf_add_typedef): Likewise.
298 (ctf_add_member_offset): Cast error-returning ssize_t's to size_t
299 when known error-free. Drop CTF_ERR usage for functions returning
300 int.
301 (ctf_add_member_encoded): Drop CTF_ERR usage for functions returning
302 int.
303 (ctf_add_variable): Likewise.
304 (enumcmp): Likewise.
305 (enumadd): Likewise.
306 (membcmp): Likewise.
307 (ctf_add_type): Likewise. Cast error-returning ssize_t's to size_t
308 when known error-free.
309 * ctf-dump.c (ctf_is_slice): Drop CTF_ERR usage for functions
310 returning int: use CTF_ERR for functions returning ctf_type_id.
311 (ctf_dump_label): Likewise.
312 (ctf_dump_objts): Likewise.
313 * ctf-labels.c (ctf_label_topmost): Likewise.
314 (ctf_label_iter): Likewise.
315 (ctf_label_info): Likewise.
316 * ctf-lookup.c (ctf_func_args): Likewise.
317 * ctf-open.c (upgrade_types): Cast to size_t where appropriate.
318 (ctf_bufopen): Likewise. Use zlib types as needed.
319 * ctf-types.c (ctf_member_iter): Drop CTF_ERR usage for functions
320 returning int.
321 (ctf_enum_iter): Likewise.
322 (ctf_type_size): Likewise.
323 (ctf_type_align): Likewise. Cast to size_t where appropriate.
324 (ctf_type_kind_unsliced): Likewise.
325 (ctf_type_kind): Likewise.
326 (ctf_type_encoding): Likewise.
327 (ctf_member_info): Likewise.
328 (ctf_array_info): Likewise.
329 (ctf_enum_value): Likewise.
330 (ctf_type_rvisit): Likewise.
331 * ctf-open-bfd.c (ctf_bfdopen): Drop cts_type, cts_flags and
332 cts_offset.
333 (ctf_simple_open): Likewise.
334 (ctf_bfdopen_ctfsect): Likewise. Set cts_size properly.
335 * Makefile.in: Regenerate.
336 * aclocal.m4: Likewise.
337 * config.h: Likewise.
338 * configure: Likewise.
339
340 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
341
342 * configure.in: Check for bfd_section_from_elf_index.
343 * configure: Regenerate.
344 * config.h.in [HAVE_BFD_ELF]: Likewise.
345 * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it.
346 abfd is potentially unused now.
347
348 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
349
350 * Makefile.am: New.
351 * Makefile.in: Regenerated.
352 * config.h.in: Likewise.
353 * aclocal.m4: Likewise.
354 * configure: Likewise.
355
356 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
357
358 * ctf-dump.c: New.
359
360 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
361
362 * ctf-labels.c: New.
363
364 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
365
366 * ctf-impl.h (_libctf_version): New declaration.
367 * ctf-subr.c (_libctf_version): Define it.
368 (ctf_version): New.
369
370 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
371
372 * ctf-create.c (enumcmp): New.
373 (enumadd): Likewise.
374 (membcmp): Likewise.
375 (membadd): Likewise.
376 (ctf_add_type): Likewise.
377
378 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
379
380 * ctf-lookup.c (isqualifier): New.
381 (ctf_lookup_by_name): Likewise.
382 (struct ctf_lookup_var_key): Likewise.
383 (ctf_lookup_var): Likewise.
384 (ctf_lookup_variable): Likewise.
385 (ctf_lookup_symbol_name): Likewise.
386 (ctf_lookup_by_symbol): Likewise.
387 (ctf_func_info): Likewise.
388 (ctf_func_args): Likewise.
389
390 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
391
392 * ctf-decl.c: New file.
393 * ctf-types.c: Likewise.
394 * ctf-impl.h: New declarations.
395
396 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
397
398 * ctf-open-bfd.c: New file.
399 * ctf-open.c (ctf_close): New.
400 * ctf-impl.h: Include bfd.h.
401 (ctf_file): New members ctf_data_mmapped, ctf_data_mmapped_len.
402 (ctf_archive_internal): New members ctfi_abfd, ctfi_data,
403 ctfi_bfd_close.
404 (ctf_bfdopen_ctfsect): New declaration.
405 (_CTF_SECTION): likewise.
406
407 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
408
409 * ctf-archive.c: New.
410 * ctf-impl.h (ctf_archive_internal): New type.
411 (ctf_arc_open_internal): New declaration.
412 (ctf_arc_bufopen): Likewise.
413 (ctf_arc_close_internal): Likewise.
414
415 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
416
417 * ctf-open.c: New file.
418 * swap.h: Likewise.
419
420 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
421
422 * ctf-create.c: New file.
423 * ctf-lookup.c: New file.
424
425 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
426
427 * ctf-impl.h: New definitions and declarations for type creation
428 and lookup.
429
430 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
431
432 * ctf-hash.c: New file.
433 * ctf-impl.h: New declarations.
434
435 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
436
437 * ctf-error.c: New file.
438
439 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
440
441 * ctf-util.c: New file.
442 * elf.h: Likewise.
443 * ctf-impl.h: Include it, and add declarations.
444
445 2019-05-28 Nick Alcock <nick.alcock@oracle.com>
446
447 * ctf-impl.h: New file.
448 * ctf-subr.c: New file.
449
450 \f
451 Local Variables:
452 mode: change-log
453 left-margin: 8
454 fill-column: 76
455 version-control: never
456 End:
This page took 0.039675 seconds and 4 git commands to generate.