mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
libctf, link: add the ability to filter out variables from the link
The CTF variables section (containing variables that have no corresponding symtab entries) can cause the string table to get very voluminous if the names of variables are long. Some callers want to filter out particular variables they know they won't need. So add a "variable filter" callback that does that: it's passed the name of the variable and a corresponding ctf_file_t / ctf_id_t pair, and should return 1 to filter it out. ld doesn't use this machinery yet, but we could easily add it later if desired. (But see later for a commit that turns off CTF variable- section linking in ld entirely by default.) include/ * ctf-api.h (ctf_link_variable_filter_t): New. (ctf_link_set_variable_filter): Likewise. libctf/ * libctf.ver (ctf_link_set_variable_filter): Add. * ctf-impl.h (ctf_file_t) <ctf_link_variable_filter>: New. <ctf_link_variable_filter_arg>: Likewise. * ctf-create.c (ctf_serialize): Adjust. * ctf-link.c (ctf_link_set_variable_filter): New, set it. (ctf_link_one_variable): Call it if set.
This commit is contained in:
@@ -458,6 +458,12 @@ extern int ctf_compress_write (ctf_file_t * fp, int fd);
|
||||
extern unsigned char *ctf_write_mem (ctf_file_t *, size_t *, size_t threshold);
|
||||
|
||||
extern int ctf_link_add_ctf (ctf_file_t *, ctf_archive_t *, const char *);
|
||||
/* The variable filter should return nonzero if a variable should not
|
||||
appear in the output. */
|
||||
typedef int ctf_link_variable_filter_f (ctf_file_t *, const char *, ctf_id_t,
|
||||
void *);
|
||||
extern int ctf_link_set_variable_filter (ctf_file_t *,
|
||||
ctf_link_variable_filter_f *, void *);
|
||||
extern int ctf_link (ctf_file_t *, int flags);
|
||||
typedef const char *ctf_link_strtab_string_f (uint32_t *offset, void *arg);
|
||||
extern int ctf_link_add_strtab (ctf_file_t *, ctf_link_strtab_string_f *,
|
||||
|
||||
Reference in New Issue
Block a user