1 /* Common declarations for LTO plugin for gold and/or GNU ld.
2 Copyright (C) 2009, 2010 Free Software Foundation, Inc.
3 Contributed by Rafael Avila de Espindola (espindola@google.com).
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; see the file COPYING3. If not see
17 <http://www.gnu.org/licenses/>. */
20 #include "plugin-api.h"
22 /* LTO magic section name. */
24 #define LTO_SECTION_PREFIX ".gnu.lto_.symtab"
26 /* The part of the symbol table the plugin has to keep track of. Note that we
27 must keep SYMS until all_symbols_read is called to give the linker time to
28 copy the symbol information. */
34 unsigned next_conflict
;
41 struct ld_plugin_symbol
*syms
;
45 /* All that we have to remember about a file. */
47 struct plugin_file_info
51 struct plugin_symtab symtab
;
52 struct plugin_symtab conflicts
;
55 /* These are the methods supplied by one of the object format
56 dependent files lto-plugin-elf.c or lto-plugin-coff.c */
58 extern enum ld_plugin_status claim_file_handler
59 (const struct ld_plugin_input_file
*file
, int *claimed
);
61 extern enum ld_plugin_status
onload_format_checks (struct ld_plugin_tv
*tv
);
63 /* These methods are made available to the object format
66 extern void check (bool gate
, enum ld_plugin_level level
, const char *text
);
68 extern void translate (char *data
, char *end
, struct plugin_symtab
*out
);
70 extern char *parse_table_entry (char *p
, struct ld_plugin_symbol
*entry
,
73 extern void resolve_conflicts (struct plugin_symtab
*t
,
74 struct plugin_symtab
*conflicts
);
76 /* And this callback function is exposed. */
78 extern ld_plugin_add_symbols add_symbols
;
80 /* Along with these two variables. */
82 extern struct plugin_file_info
*claimed_files
;
83 extern unsigned int num_claimed_files
;