libctf, link: add CTF_LINK_OMIT_VARIABLES_SECTION
[deliverable/binutils-gdb.git] / include / ctf-api.h
1 /* Public API to libctf.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
3
4 This file is part of libctf.
5
6 libctf is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
10
11 This program is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; see the file COPYING. If not see
18 <http://www.gnu.org/licenses/>. */
19
20 /* This header file defines the interfaces available from the CTF debugger
21 library, libctf. This API can be used by a debugger to operate on data in
22 the Compact ANSI-C Type Format (CTF). */
23
24 #ifndef _CTF_API_H
25 #define _CTF_API_H
26
27 #include <sys/types.h>
28 #include <ctf.h>
29 #include <zlib.h>
30
31 #ifdef __cplusplus
32 extern "C"
33 {
34 #endif
35
36 /* Clients can open one or more CTF containers and obtain a pointer to an
37 opaque ctf_file_t. Types are identified by an opaque ctf_id_t token.
38 They can also open or create read-only archives of CTF containers in a
39 ctf_archive_t.
40
41 These opaque definitions allow libctf to evolve without breaking clients. */
42
43 typedef struct ctf_file ctf_file_t;
44 typedef struct ctf_archive_internal ctf_archive_t;
45 typedef unsigned long ctf_id_t;
46
47 /* This opaque definition allows libctf to accept BFD data structures without
48 importing all the BFD noise into users' namespaces. */
49
50 struct bfd;
51
52 /* If the debugger needs to provide the CTF library with a set of raw buffers
53 for use as the CTF data, symbol table, and string table, it can do so by
54 filling in ctf_sect_t structures and passing them to ctf_bufopen().
55
56 The contents of this structure must always be in native endianness (no
57 byteswapping is performed). */
58
59 typedef struct ctf_sect
60 {
61 const char *cts_name; /* Section name (if any). */
62 const void *cts_data; /* Pointer to section data. */
63 size_t cts_size; /* Size of data in bytes. */
64 size_t cts_entsize; /* Size of each section entry (symtab only). */
65 } ctf_sect_t;
66
67 /* A minimal symbol extracted from a linker's internal symbol table
68 representation. */
69
70 typedef struct ctf_link_sym
71 {
72 /* The st_name will not be accessed outside the call to
73 ctf_link_shuffle_syms(). */
74
75 const char *st_name;
76 uint32_t st_shndx;
77 uint32_t st_type;
78 uint32_t st_value;
79 } ctf_link_sym_t;
80
81 /* Flags applying to this specific link. */
82
83 /* Share all types that are not in conflict. The default. */
84 #define CTF_LINK_SHARE_UNCONFLICTED 0x0
85
86 /* Share only types that are used by multiple inputs. */
87 #define CTF_LINK_SHARE_DUPLICATED 0x1
88
89 /* Create empty outputs for all registered CU mappings even if no types are
90 emitted into them. */
91 #define CTF_LINK_EMPTY_CU_MAPPINGS 0x4
92
93 /* Omit the content of the variables section. */
94 #define CTF_LINK_OMIT_VARIABLES_SECTION 0x8
95
96 /* Symbolic names for CTF sections. */
97
98 typedef enum ctf_sect_names
99 {
100 CTF_SECT_HEADER,
101 CTF_SECT_LABEL,
102 CTF_SECT_OBJT,
103 CTF_SECT_FUNC,
104 CTF_SECT_VAR,
105 CTF_SECT_TYPE,
106 CTF_SECT_STR
107 } ctf_sect_names_t;
108
109 /* Encoding information for integers, floating-point values, and certain other
110 intrinsics can be obtained by calling ctf_type_encoding(), below. The flags
111 field will contain values appropriate for the type defined in <ctf.h>. */
112
113 typedef struct ctf_encoding
114 {
115 uint32_t cte_format; /* Data format (CTF_INT_* or CTF_FP_* flags). */
116 uint32_t cte_offset; /* Offset of value in bits. */
117 uint32_t cte_bits; /* Size of storage in bits. */
118 } ctf_encoding_t;
119
120 typedef struct ctf_membinfo
121 {
122 ctf_id_t ctm_type; /* Type of struct or union member. */
123 unsigned long ctm_offset; /* Offset of member in bits. */
124 } ctf_membinfo_t;
125
126 typedef struct ctf_arinfo
127 {
128 ctf_id_t ctr_contents; /* Type of array contents. */
129 ctf_id_t ctr_index; /* Type of array index. */
130 uint32_t ctr_nelems; /* Number of elements. */
131 } ctf_arinfo_t;
132
133 typedef struct ctf_funcinfo
134 {
135 ctf_id_t ctc_return; /* Function return type. */
136 uint32_t ctc_argc; /* Number of typed arguments to function. */
137 uint32_t ctc_flags; /* Function attributes (see below). */
138 } ctf_funcinfo_t;
139
140 typedef struct ctf_lblinfo
141 {
142 ctf_id_t ctb_type; /* Last type associated with the label. */
143 } ctf_lblinfo_t;
144
145 typedef struct ctf_snapshot_id
146 {
147 unsigned long dtd_id; /* Highest DTD ID at time of snapshot. */
148 unsigned long snapshot_id; /* Snapshot id at time of snapshot. */
149 } ctf_snapshot_id_t;
150
151 #define CTF_FUNC_VARARG 0x1 /* Function arguments end with varargs. */
152
153 /* Functions that return a ctf_id_t use the following value to indicate failure.
154 ctf_errno() can be used to obtain an error code. Functions that return
155 a straight integral -1 also use ctf_errno(). */
156 #define CTF_ERR ((ctf_id_t) -1L)
157
158 #define ECTF_BASE 1000 /* Base value for libctf errnos. */
159
160
161 enum
162 {
163 ECTF_FMT = ECTF_BASE, /* File is not in CTF or ELF format. */
164 ECTF_BFDERR, /* BFD error. */
165 ECTF_CTFVERS, /* CTF dict version is too new for libctf. */
166 ECTF_BFD_AMBIGUOUS, /* Ambiguous BFD target. */
167 ECTF_SYMTAB, /* Symbol table uses invalid entry size. */
168 ECTF_SYMBAD, /* Symbol table data buffer is not valid. */
169 ECTF_STRBAD, /* String table data buffer is not valid. */
170 ECTF_CORRUPT, /* File data structure corruption detected. */
171 ECTF_NOCTFDATA, /* File does not contain CTF data. */
172 ECTF_NOCTFBUF, /* Buffer does not contain CTF data. */
173 ECTF_NOSYMTAB, /* Symbol table information is not available. */
174 ECTF_NOPARENT, /* The parent CTF dictionary is unavailable. */
175 ECTF_DMODEL, /* Data model mismatch. */
176 ECTF_LINKADDEDLATE, /* File added to link too late. */
177 ECTF_ZALLOC, /* Failed to allocate (de)compression buffer. */
178 ECTF_DECOMPRESS, /* Failed to decompress CTF data. */
179 ECTF_STRTAB, /* External string table is not available. */
180 ECTF_BADNAME, /* String name offset is corrupt. */
181 ECTF_BADID, /* Invalid type identifier. */
182 ECTF_NOTSOU, /* Type is not a struct or union. */
183 ECTF_NOTENUM, /* Type is not an enum. */
184 ECTF_NOTSUE, /* Type is not a struct, union, or enum. */
185 ECTF_NOTINTFP, /* Type is not an integer, float, or enum. */
186 ECTF_NOTARRAY, /* Type is not an array. */
187 ECTF_NOTREF, /* Type does not reference another type. */
188 ECTF_NAMELEN, /* Buffer is too small to hold type name. */
189 ECTF_NOTYPE, /* No type found corresponding to name. */
190 ECTF_SYNTAX, /* Syntax error in type name. */
191 ECTF_NOTFUNC, /* Symbol table entry or type is not a function. */
192 ECTF_NOFUNCDAT, /* No function information available for function. */
193 ECTF_NOTDATA, /* Symbol table entry does not refer to a data object. */
194 ECTF_NOTYPEDAT, /* No type information available for symbol. */
195 ECTF_NOLABEL, /* No label found corresponding to name. */
196 ECTF_NOLABELDATA, /* File does not contain any labels. */
197 ECTF_NOTSUP, /* Feature not supported. */
198 ECTF_NOENUMNAM, /* Enum element name not found. */
199 ECTF_NOMEMBNAM, /* Member name not found. */
200 ECTF_RDONLY, /* CTF container is read-only. */
201 ECTF_DTFULL, /* CTF type is full (no more members allowed). */
202 ECTF_FULL, /* CTF container is full. */
203 ECTF_DUPLICATE, /* Duplicate member or variable name. */
204 ECTF_CONFLICT, /* Conflicting type is already defined. */
205 ECTF_OVERROLLBACK, /* Attempt to roll back past a ctf_update. */
206 ECTF_COMPRESS, /* Failed to compress CTF data. */
207 ECTF_ARCREATE, /* Error creating CTF archive. */
208 ECTF_ARNNAME, /* Name not found in CTF archive. */
209 ECTF_SLICEOVERFLOW, /* Overflow of type bitness or offset in slice. */
210 ECTF_DUMPSECTUNKNOWN, /* Unknown section number in dump. */
211 ECTF_DUMPSECTCHANGED, /* Section changed in middle of dump. */
212 ECTF_NOTYET, /* Feature not yet implemented. */
213 ECTF_INTERNAL, /* Internal error: assertion failure. */
214 ECTF_NONREPRESENTABLE, /* Type not representable in CTF. */
215 ECTF_NEXT_END, /* End of iteration. */
216 ECTF_NEXT_WRONGFUN, /* Wrong iteration function called. */
217 ECTF_NEXT_WRONGFP, /* Iteration entity changed in mid-iterate. */
218 ECTF_FLAGS, /* CTF header contains flags unknown to libctf. */
219 ECTF_NEEDSBFD /* This feature needs a libctf with BFD support. */
220 };
221
222 #define ECTF_NERR (ECTF_NEEDSBFD - ECTF_BASE + 1) /* Count of CTF errors. */
223
224 /* The CTF data model is inferred to be the caller's data model or the data
225 model of the given object, unless ctf_setmodel() is explicitly called. */
226 #define CTF_MODEL_ILP32 1 /* Object data model is ILP32. */
227 #define CTF_MODEL_LP64 2 /* Object data model is LP64. */
228 #ifdef _LP64
229 # define CTF_MODEL_NATIVE CTF_MODEL_LP64
230 #else
231 # define CTF_MODEL_NATIVE CTF_MODEL_ILP32
232 #endif
233
234 /* Dynamic CTF containers can be created using ctf_create(). The ctf_add_*
235 routines can be used to add new definitions to the dynamic container.
236 New types are labeled as root or non-root to determine whether they are
237 visible at the top-level program scope when subsequently doing a lookup. */
238
239 #define CTF_ADD_NONROOT 0 /* Type only visible in nested scope. */
240 #define CTF_ADD_ROOT 1 /* Type visible at top-level scope. */
241
242 /* These typedefs are used to define the signature for callback functions that
243 can be used with the iteration and visit functions below. There is also a
244 family of iteration functions that do not require callbacks. */
245
246 typedef int ctf_visit_f (const char *name, ctf_id_t type, unsigned long offset,
247 int depth, void *arg);
248 typedef int ctf_member_f (const char *name, ctf_id_t membtype,
249 unsigned long offset, void *arg);
250 typedef int ctf_enum_f (const char *name, int val, void *arg);
251 typedef int ctf_variable_f (const char *name, ctf_id_t type, void *arg);
252 typedef int ctf_type_f (ctf_id_t type, void *arg);
253 typedef int ctf_type_all_f (ctf_id_t type, int flag, void *arg);
254 typedef int ctf_label_f (const char *name, const ctf_lblinfo_t *info,
255 void *arg);
256 typedef int ctf_archive_member_f (ctf_file_t *fp, const char *name, void *arg);
257 typedef int ctf_archive_raw_member_f (const char *name, const void *content,
258 size_t len, void *arg);
259 typedef char *ctf_dump_decorate_f (ctf_sect_names_t sect,
260 char *line, void *arg);
261
262 typedef struct ctf_dump_state ctf_dump_state_t;
263
264 /* Iteration state for the _next() functions, and allocators/copiers/freers for
265 it. (None of these are needed for the simple case of iterating to the end:
266 the _next() function allocate and free the iterators for you.) */
267
268 typedef struct ctf_next ctf_next_t;
269 extern ctf_next_t *ctf_next_create (void);
270 extern void ctf_next_destroy (ctf_next_t *);
271 extern ctf_next_t *ctf_next_copy (ctf_next_t *);
272
273 /* Opening. These mostly return an abstraction over both CTF files and CTF
274 archives: so they can be used to open both. CTF files will appear to be an
275 archive with one member named '.ctf'. The low-level functions
276 ctf_simple_open() and ctf_bufopen() return ctf_file_t's directly, and cannot
277 be used on CTF archives. */
278
279 extern ctf_archive_t *ctf_bfdopen (struct bfd *, int *);
280 extern ctf_archive_t *ctf_bfdopen_ctfsect (struct bfd *, const ctf_sect_t *,
281 int *);
282 extern ctf_archive_t *ctf_fdopen (int fd, const char *filename,
283 const char *target, int *errp);
284 extern ctf_archive_t *ctf_open (const char *filename,
285 const char *target, int *errp);
286 extern void ctf_close (ctf_archive_t *);
287 extern ctf_sect_t ctf_getdatasect (const ctf_file_t *);
288 extern ctf_archive_t *ctf_get_arc (const ctf_file_t *);
289 extern ctf_archive_t *ctf_arc_open (const char *, int *);
290 extern ctf_archive_t *ctf_arc_bufopen (const ctf_sect_t *,
291 const ctf_sect_t *,
292 const ctf_sect_t *,
293 int *);
294 extern void ctf_arc_close (ctf_archive_t *);
295 extern ctf_file_t *ctf_arc_open_by_name (const ctf_archive_t *,
296 const char *, int *);
297 extern ctf_file_t *ctf_arc_open_by_name_sections (const ctf_archive_t *,
298 const ctf_sect_t *,
299 const ctf_sect_t *,
300 const char *, int *);
301 extern size_t ctf_archive_count (const ctf_archive_t *);
302
303 /* The next functions return or close real CTF files, or write out CTF archives,
304 not opaque containers around either. */
305
306 extern ctf_file_t *ctf_simple_open (const char *, size_t, const char *, size_t,
307 size_t, const char *, size_t, int *);
308 extern ctf_file_t *ctf_bufopen (const ctf_sect_t *, const ctf_sect_t *,
309 const ctf_sect_t *, int *);
310 extern void ctf_ref (ctf_file_t *);
311 extern void ctf_file_close (ctf_file_t *);
312
313 extern int ctf_arc_write (const char *, ctf_file_t **, size_t,
314 const char **, size_t);
315 extern int ctf_arc_write_fd (int, ctf_file_t **, size_t, const char **,
316 size_t);
317
318 extern const char *ctf_cuname (ctf_file_t *);
319 extern int ctf_cuname_set (ctf_file_t *, const char *);
320 extern ctf_file_t *ctf_parent_file (ctf_file_t *);
321 extern const char *ctf_parent_name (ctf_file_t *);
322 extern int ctf_parent_name_set (ctf_file_t *, const char *);
323 extern int ctf_type_isparent (ctf_file_t *, ctf_id_t);
324 extern int ctf_type_ischild (ctf_file_t *, ctf_id_t);
325
326 extern int ctf_import (ctf_file_t *, ctf_file_t *);
327 extern int ctf_setmodel (ctf_file_t *, int);
328 extern int ctf_getmodel (ctf_file_t *);
329
330 extern void ctf_setspecific (ctf_file_t *, void *);
331 extern void *ctf_getspecific (ctf_file_t *);
332
333 extern int ctf_errno (ctf_file_t *);
334 extern const char *ctf_errmsg (int);
335 extern int ctf_version (int);
336
337 extern int ctf_func_info (ctf_file_t *, unsigned long, ctf_funcinfo_t *);
338 extern int ctf_func_args (ctf_file_t *, unsigned long, uint32_t, ctf_id_t *);
339 extern int ctf_func_type_info (ctf_file_t *, ctf_id_t, ctf_funcinfo_t *);
340 extern int ctf_func_type_args (ctf_file_t *, ctf_id_t, uint32_t, ctf_id_t *);
341
342 extern ctf_id_t ctf_lookup_by_name (ctf_file_t *, const char *);
343 extern ctf_id_t ctf_lookup_by_symbol (ctf_file_t *, unsigned long);
344 extern ctf_id_t ctf_lookup_variable (ctf_file_t *, const char *);
345
346 extern ctf_id_t ctf_type_resolve (ctf_file_t *, ctf_id_t);
347 extern char *ctf_type_aname (ctf_file_t *, ctf_id_t);
348 extern char *ctf_type_aname_raw (ctf_file_t *, ctf_id_t);
349 extern ssize_t ctf_type_lname (ctf_file_t *, ctf_id_t, char *, size_t);
350 extern char *ctf_type_name (ctf_file_t *, ctf_id_t, char *, size_t);
351 extern const char *ctf_type_name_raw (ctf_file_t *, ctf_id_t);
352 extern ssize_t ctf_type_size (ctf_file_t *, ctf_id_t);
353 extern ssize_t ctf_type_align (ctf_file_t *, ctf_id_t);
354 extern int ctf_type_kind (ctf_file_t *, ctf_id_t);
355 extern int ctf_type_kind_forwarded (ctf_file_t *, ctf_id_t);
356 extern ctf_id_t ctf_type_reference (ctf_file_t *, ctf_id_t);
357 extern ctf_id_t ctf_type_pointer (ctf_file_t *, ctf_id_t);
358 extern int ctf_type_encoding (ctf_file_t *, ctf_id_t, ctf_encoding_t *);
359 extern int ctf_type_visit (ctf_file_t *, ctf_id_t, ctf_visit_f *, void *);
360 extern int ctf_type_cmp (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
361 extern int ctf_type_compat (ctf_file_t *, ctf_id_t, ctf_file_t *, ctf_id_t);
362
363 extern int ctf_member_info (ctf_file_t *, ctf_id_t, const char *,
364 ctf_membinfo_t *);
365 extern int ctf_array_info (ctf_file_t *, ctf_id_t, ctf_arinfo_t *);
366
367 extern const char *ctf_enum_name (ctf_file_t *, ctf_id_t, int);
368 extern int ctf_enum_value (ctf_file_t *, ctf_id_t, const char *, int *);
369
370 extern void ctf_label_set (ctf_file_t *, const char *);
371 extern const char *ctf_label_get (ctf_file_t *);
372
373 extern const char *ctf_label_topmost (ctf_file_t *);
374 extern int ctf_label_info (ctf_file_t *, const char *, ctf_lblinfo_t *);
375
376 extern int ctf_member_count (ctf_file_t *, ctf_id_t);
377 extern int ctf_member_iter (ctf_file_t *, ctf_id_t, ctf_member_f *, void *);
378 extern ssize_t ctf_member_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
379 const char **name, ctf_id_t *membtype);
380 extern int ctf_enum_iter (ctf_file_t *, ctf_id_t, ctf_enum_f *, void *);
381 extern const char *ctf_enum_next (ctf_file_t *, ctf_id_t, ctf_next_t **,
382 int *);
383 extern int ctf_type_iter (ctf_file_t *, ctf_type_f *, void *);
384 extern int ctf_type_iter_all (ctf_file_t *, ctf_type_all_f *, void *);
385 extern ctf_id_t ctf_type_next (ctf_file_t *, ctf_next_t **,
386 int *flag, int want_hidden);
387 extern int ctf_label_iter (ctf_file_t *, ctf_label_f *, void *);
388 extern int ctf_label_next (ctf_file_t *, ctf_next_t **, const char **); /* TBD */
389 extern int ctf_variable_iter (ctf_file_t *, ctf_variable_f *, void *);
390 extern ctf_id_t ctf_variable_next (ctf_file_t *, ctf_next_t **,
391 const char **);
392 extern int ctf_archive_iter (const ctf_archive_t *, ctf_archive_member_f *,
393 void *);
394 extern ctf_file_t *ctf_archive_next (const ctf_archive_t *, ctf_next_t **,
395 const char **, int skip_parent, int *errp);
396
397 /* This function alone does not currently operate on CTF files masquerading
398 as archives, and returns -EINVAL: the raw data is no longer available. It is
399 expected to be used only by archiving tools, in any case, which have no need
400 to deal with non-archives at all. */
401 extern int ctf_archive_raw_iter (const ctf_archive_t *,
402 ctf_archive_raw_member_f *, void *);
403 extern char *ctf_dump (ctf_file_t *, ctf_dump_state_t **state,
404 ctf_sect_names_t sect, ctf_dump_decorate_f *,
405 void *arg);
406
407 /* Error-warning reporting: an 'iterator' that returns errors and warnings from
408 the error/warning list, in order of emission. Errors and warnings are popped
409 after return: the caller must free the returned error-text pointer. */
410 extern char *ctf_errwarning_next (ctf_file_t *, ctf_next_t **,
411 int *is_warning);
412
413 extern ctf_id_t ctf_add_array (ctf_file_t *, uint32_t,
414 const ctf_arinfo_t *);
415 extern ctf_id_t ctf_add_const (ctf_file_t *, uint32_t, ctf_id_t);
416 extern ctf_id_t ctf_add_enum_encoded (ctf_file_t *, uint32_t, const char *,
417 const ctf_encoding_t *);
418 extern ctf_id_t ctf_add_enum (ctf_file_t *, uint32_t, const char *);
419 extern ctf_id_t ctf_add_float (ctf_file_t *, uint32_t,
420 const char *, const ctf_encoding_t *);
421 extern ctf_id_t ctf_add_forward (ctf_file_t *, uint32_t, const char *,
422 uint32_t);
423 extern ctf_id_t ctf_add_function (ctf_file_t *, uint32_t,
424 const ctf_funcinfo_t *, const ctf_id_t *);
425 extern ctf_id_t ctf_add_integer (ctf_file_t *, uint32_t, const char *,
426 const ctf_encoding_t *);
427 extern ctf_id_t ctf_add_slice (ctf_file_t *, uint32_t, ctf_id_t, const ctf_encoding_t *);
428 extern ctf_id_t ctf_add_pointer (ctf_file_t *, uint32_t, ctf_id_t);
429 extern ctf_id_t ctf_add_type (ctf_file_t *, ctf_file_t *, ctf_id_t);
430 extern ctf_id_t ctf_add_typedef (ctf_file_t *, uint32_t, const char *,
431 ctf_id_t);
432 extern ctf_id_t ctf_add_restrict (ctf_file_t *, uint32_t, ctf_id_t);
433 extern ctf_id_t ctf_add_struct (ctf_file_t *, uint32_t, const char *);
434 extern ctf_id_t ctf_add_union (ctf_file_t *, uint32_t, const char *);
435 extern ctf_id_t ctf_add_struct_sized (ctf_file_t *, uint32_t, const char *,
436 size_t);
437 extern ctf_id_t ctf_add_union_sized (ctf_file_t *, uint32_t, const char *,
438 size_t);
439 extern ctf_id_t ctf_add_volatile (ctf_file_t *, uint32_t, ctf_id_t);
440
441 extern int ctf_add_enumerator (ctf_file_t *, ctf_id_t, const char *, int);
442 extern int ctf_add_member (ctf_file_t *, ctf_id_t, const char *, ctf_id_t);
443 extern int ctf_add_member_offset (ctf_file_t *, ctf_id_t, const char *,
444 ctf_id_t, unsigned long);
445 extern int ctf_add_member_encoded (ctf_file_t *, ctf_id_t, const char *,
446 ctf_id_t, unsigned long,
447 const ctf_encoding_t);
448
449 extern int ctf_add_variable (ctf_file_t *, const char *, ctf_id_t);
450
451 extern int ctf_set_array (ctf_file_t *, ctf_id_t, const ctf_arinfo_t *);
452
453 extern ctf_file_t *ctf_create (int *);
454 extern int ctf_update (ctf_file_t *);
455 extern ctf_snapshot_id_t ctf_snapshot (ctf_file_t *);
456 extern int ctf_rollback (ctf_file_t *, ctf_snapshot_id_t);
457 extern int ctf_discard (ctf_file_t *);
458 extern int ctf_write (ctf_file_t *, int);
459 extern int ctf_gzwrite (ctf_file_t *fp, gzFile fd);
460 extern int ctf_compress_write (ctf_file_t * fp, int fd);
461 extern unsigned char *ctf_write_mem (ctf_file_t *, size_t *, size_t threshold);
462
463 extern int ctf_link_add_ctf (ctf_file_t *, ctf_archive_t *, const char *);
464 /* The variable filter should return nonzero if a variable should not
465 appear in the output. */
466 typedef int ctf_link_variable_filter_f (ctf_file_t *, const char *, ctf_id_t,
467 void *);
468 extern int ctf_link_set_variable_filter (ctf_file_t *,
469 ctf_link_variable_filter_f *, void *);
470 extern int ctf_link (ctf_file_t *, int flags);
471 typedef const char *ctf_link_strtab_string_f (uint32_t *offset, void *arg);
472 extern int ctf_link_add_strtab (ctf_file_t *, ctf_link_strtab_string_f *,
473 void *);
474 typedef ctf_link_sym_t *ctf_link_iter_symbol_f (ctf_link_sym_t *dest,
475 void *arg);
476 extern int ctf_link_shuffle_syms (ctf_file_t *, ctf_link_iter_symbol_f *,
477 void *);
478 extern unsigned char *ctf_link_write (ctf_file_t *, size_t *size,
479 size_t threshold);
480
481 /* Specialist linker functions. These functions are not used by ld, but can be
482 used by other programs making use of the linker machinery for other purposes
483 to customize its output. */
484 extern int ctf_link_add_cu_mapping (ctf_file_t *, const char *from,
485 const char *to);
486 typedef char *ctf_link_memb_name_changer_f (ctf_file_t *,
487 const char *, void *);
488 extern void ctf_link_set_memb_name_changer
489 (ctf_file_t *, ctf_link_memb_name_changer_f *, void *);
490
491 extern void ctf_setdebug (int debug);
492 extern int ctf_getdebug (void);
493
494 #ifdef __cplusplus
495 }
496 #endif
497
498 #endif /* _CTF_API_H */
This page took 0.059084 seconds and 5 git commands to generate.