libctf: unidentified type kinds on open are a sign of file corruption
[external/binutils.git] / libctf / ChangeLog
1 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
2
3         * ctf-open.c (ctf_types): Fail when unidentified type kinds are
4         seen.
5
6 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
7
8         * ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
9         output.
10
11 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
12
13         * ctf-subr.c (_PAGESIZE): Remove.
14         (ctf_data_alloc): Likewise.
15         (ctf_data_free): Likewise.
16         (ctf_data_protect): Likewise.
17         * ctf-impl.h: Remove declarations.
18         * ctf-create.c (ctf_update): No longer call ctf_data_protect: use
19         ctf_free, not ctf_data_free.
20         (ctf_compress_write): Use ctf_data_alloc, not ctf_alloc.  Free
21         the buffer again on compression error.
22         * ctf-open.c (ctf_set_base): No longer track the size: call
23         ctf_free, not ctf_data_free.
24         (upgrade_types): Likewise.  Call ctf_alloc, not ctf_data_alloc.
25         (ctf_bufopen): Likewise.  No longer call ctf_data_protect.
26
27 2019-06-19  Nick Alcock <nick.alcock@oracle.com>
28
29         * ctf-create.c (ctf_dtd_insert): Pass on error returns from
30         ctf_dynhash_insert.
31         (ctf_dvd_insert): Likewise.
32         (ctf_add_generic): Likewise.
33         (ctf_add_variable): Likewise.
34         * ctf-impl.h: Adjust declarations.
35
36 2019-06-14  Alan Modra  <amodra@gmail.com>
37
38         * configure: Regenerate.
39
40 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
41
42         * ctf-decls.h: Include <libiberty.h>.
43         * ctf-lookup.c (ctf_lookup_by_name): Call xstrndup(), not strndup().
44
45 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
46
47         * ctf-dump.c (ctf_dump_format_type): Cast size_t's used in printf()s.
48         (ctf_dump_objts): Likewise.
49         (ctf_dump_funcs): Likewise.
50         (ctf_dump_member): Likewise.
51         (ctf_dump_str): Likewise.
52
53 2019-06-06  Nick Alcock  <nick.alcock@oracle.com>
54
55         * ctf-archive.c (arc_mmap_header): Mark fd as potentially unused.
56         * ctf-subr.c (ctf_data_protect): Mark both args as potentially unused.
57
58 2019-06-05  Nick Alcock  <nick.alcock@oracle.com>
59
60         * ctf-archive.c (ctf_arc_write): Eschew %zi format specifier.
61         (ctf_arc_open_by_offset): Likewise.
62         * ctf-create.c (ctf_add_type): Likewise.
63
64 2019-06-04  Tom Tromey  <tromey@adacore.com>
65
66         * ctf-create.c (ctf_add_encoded, ctf_add_slice)
67         (ctf_add_member_offset): Use CHAR_BIT, not NBBY.
68
69 2019-06-04  Nick Alcock  <nick.alcock@oracle.com>
70
71         * configure.ac: Check for O_CLOEXEC.
72         * ctf-decls.h (O_CLOEXEC): Define (to 0), if need be.
73         * config.h.in: Regenerate.
74         * configure: Likewise.
75
76 2019-06-04  Nick Alcock  <nick.alcock@oracle.com>
77
78         * qsort_r.c: Rename to...
79         * ctf-qsort_r.c: ... this.
80         (_quicksort): Define to ctf_qsort_r.
81         * ctf-decls.h (qsort_r): Remove.
82         (ctf_qsort_r): Add.
83         (struct ctf_qsort_arg): New, transport the real ARG and COMPAR.
84         (ctf_qsort_compar_thunk): Rearrange the arguments to COMPAR.
85         * Makefile.am (libctf_a_LIBADD): Remove.
86         (libctf_a_SOURCES): New, add ctf-qsort_r.c.
87         * ctf-archive.c (ctf_arc_write): Call ctf_qsort_r, not qsort_r.
88         * ctf-create.c (ctf_update): Likewise.
89         * configure.ac: Check for BSD versus GNU qsort_r signature.
90         * Makefile.in: Regenerate.
91         * config.h.in: Likewise.
92         * configure: Likewise.
93
94 2019-06-03  Nick Alcock  <nick.alcock@oracle.com>
95
96         * ctf-dump.c (ctf_dump_funcs): Free in the right place.
97
98 2019-05-29  Nick Alcock  <nick.alcock@oracle.com>
99
100         * Makefile.am (ZLIB): New.
101         (ZLIBINC): Likewise.
102         (AM_CFLAGS): Use them.
103         (libctf_a_LIBADD): New, for LIBOBJS.
104         * configure.ac: Check for zlib, endian.h, and qsort_r.
105         * ctf-endian.h: New, providing htole64 and le64toh.
106         * swap.h: Code style fixes.
107         (bswap_identity_64): New.
108         * qsort_r.c: New, from gnulib (with one added #include).
109         * ctf-decls.h: New, providing a conditional qsort_r declaration,
110         and unconditional definitions of MIN and MAX.
111         * ctf-impl.h: Use it.  Do not use <sys/errno.h>.
112         (ctf_set_errno): Now returns unsigned long.
113         * ctf-util.c (ctf_set_errno): Adjust here too.
114         * ctf-archive.c: Use ctf-endian.h.
115         (ctf_arc_open_by_offset): Use memset, not bzero.  Drop cts_type,
116         cts_flags and cts_offset.
117         (ctf_arc_write): Drop debugging dependent on the size of off_t.
118         * ctf-create.c: Provide a definition of roundup if not defined.
119         (ctf_create): Drop cts_type, cts_flags and cts_offset.
120         (ctf_add_reftype): Do not check if type IDs are below zero.
121         (ctf_add_slice): Likewise.
122         (ctf_add_typedef): Likewise.
123         (ctf_add_member_offset): Cast error-returning ssize_t's to size_t
124         when known error-free.  Drop CTF_ERR usage for functions returning
125         int.
126         (ctf_add_member_encoded): Drop CTF_ERR usage for functions returning
127         int.
128         (ctf_add_variable): Likewise.
129         (enumcmp): Likewise.
130         (enumadd): Likewise.
131         (membcmp): Likewise.
132         (ctf_add_type): Likewise.  Cast error-returning ssize_t's to size_t
133         when known error-free.
134         * ctf-dump.c (ctf_is_slice): Drop CTF_ERR usage for functions
135         returning int: use CTF_ERR for functions returning ctf_type_id.
136         (ctf_dump_label): Likewise.
137         (ctf_dump_objts): Likewise.
138         * ctf-labels.c (ctf_label_topmost): Likewise.
139         (ctf_label_iter): Likewise.
140         (ctf_label_info): Likewise.
141         * ctf-lookup.c (ctf_func_args): Likewise.
142         * ctf-open.c (upgrade_types): Cast to size_t where appropriate.
143         (ctf_bufopen): Likewise.  Use zlib types as needed.
144         * ctf-types.c (ctf_member_iter): Drop CTF_ERR usage for functions
145         returning int.
146         (ctf_enum_iter): Likewise.
147         (ctf_type_size): Likewise.
148         (ctf_type_align): Likewise.  Cast to size_t where appropriate.
149         (ctf_type_kind_unsliced): Likewise.
150         (ctf_type_kind): Likewise.
151         (ctf_type_encoding): Likewise.
152         (ctf_member_info): Likewise.
153         (ctf_array_info): Likewise.
154         (ctf_enum_value): Likewise.
155         (ctf_type_rvisit): Likewise.
156         * ctf-open-bfd.c (ctf_bfdopen): Drop cts_type, cts_flags and
157         cts_offset.
158         (ctf_simple_open): Likewise.
159         (ctf_bfdopen_ctfsect): Likewise.  Set cts_size properly.
160         * Makefile.in: Regenerate.
161         * aclocal.m4: Likewise.
162         * config.h: Likewise.
163         * configure: Likewise.
164
165 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
166
167         * configure.in: Check for bfd_section_from_elf_index.
168         * configure: Regenerate.
169         * config.h.in [HAVE_BFD_ELF]: Likewise.
170         * libctf/ctf_open_bfd (ctf_bfdopen_ctfsect): Use it.
171         abfd is potentially unused now.
172
173 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
174
175         * Makefile.am: New.
176         * Makefile.in: Regenerated.
177         * config.h.in: Likewise.
178         * aclocal.m4: Likewise.
179         * configure: Likewise.
180
181 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
182
183         * ctf-dump.c: New.
184
185 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
186
187         * ctf-labels.c: New.
188
189 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
190
191         * ctf-impl.h (_libctf_version): New declaration.
192         * ctf-subr.c (_libctf_version): Define it.
193         (ctf_version): New.
194
195 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
196
197         * ctf-create.c (enumcmp): New.
198         (enumadd): Likewise.
199         (membcmp): Likewise.
200         (membadd): Likewise.
201         (ctf_add_type): Likewise.
202
203 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
204
205         * ctf-lookup.c (isqualifier): New.
206         (ctf_lookup_by_name): Likewise.
207         (struct ctf_lookup_var_key): Likewise.
208         (ctf_lookup_var): Likewise.
209         (ctf_lookup_variable): Likewise.
210         (ctf_lookup_symbol_name): Likewise.
211         (ctf_lookup_by_symbol): Likewise.
212         (ctf_func_info): Likewise.
213         (ctf_func_args): Likewise.
214
215 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
216
217         * ctf-decl.c: New file.
218         * ctf-types.c: Likewise.
219         * ctf-impl.h: New declarations.
220
221 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
222
223         * ctf-open-bfd.c: New file.
224         * ctf-open.c (ctf_close): New.
225         * ctf-impl.h: Include bfd.h.
226         (ctf_file): New members ctf_data_mmapped, ctf_data_mmapped_len.
227         (ctf_archive_internal): New members ctfi_abfd, ctfi_data,
228         ctfi_bfd_close.
229         (ctf_bfdopen_ctfsect): New declaration.
230         (_CTF_SECTION): likewise.
231
232 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
233
234         * ctf-archive.c: New.
235         * ctf-impl.h (ctf_archive_internal): New type.
236         (ctf_arc_open_internal): New declaration.
237         (ctf_arc_bufopen): Likewise.
238         (ctf_arc_close_internal): Likewise.
239
240 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
241
242         * ctf-open.c: New file.
243         * swap.h: Likewise.
244
245 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
246
247         * ctf-create.c: New file.
248         * ctf-lookup.c: New file.
249
250 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
251
252         * ctf-impl.h: New definitions and declarations for type creation
253         and lookup.
254
255 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
256
257         * ctf-hash.c: New file.
258         * ctf-impl.h: New declarations.
259
260 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
261
262         * ctf-error.c: New file.
263
264 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
265
266         * ctf-util.c: New file.
267         * elf.h: Likewise.
268         * ctf-impl.h: Include it, and add declarations.
269
270 2019-05-28  Nick Alcock  <nick.alcock@oracle.com>
271
272         * ctf-impl.h: New file.
273         * ctf-subr.c: New file.
274
275 \f
276 Local Variables:
277 mode: change-log
278 left-margin: 8
279 fill-column: 76
280 version-control: never
281 End: