OSDN Git Service

* ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p,
[pf3gnuchains/gcc-fork.git] / lto-plugin / lto-plugin.h
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).
4
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)
8 any later version.
9
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.
14
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/>.  */
18
19 #include <stdbool.h>
20 #include "plugin-api.h"
21
22 /* LTO magic section name.  */
23
24 #define LTO_SECTION_PREFIX ".gnu.lto_.symtab"
25
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. */
29
30 struct sym_aux
31 {
32   uint32_t slot;
33   unsigned id;
34   unsigned next_conflict;
35 };
36
37 struct plugin_symtab
38 {
39   int nsyms;
40   struct sym_aux *aux;
41   struct ld_plugin_symbol *syms;
42   unsigned id;
43 };
44
45 /* All that we have to remember about a file. */
46
47 struct plugin_file_info
48 {
49   char *name;
50   void *handle;
51   struct plugin_symtab symtab;
52   struct plugin_symtab conflicts;
53 };
54
55 /* These are the methods supplied by one of the object format
56    dependent files lto-plugin-elf.c or lto-plugin-coff.c  */
57
58 extern enum ld_plugin_status claim_file_handler 
59                 (const struct ld_plugin_input_file *file, int *claimed);
60
61 extern enum ld_plugin_status onload_format_checks (struct ld_plugin_tv *tv);
62
63 /* These methods are made available to the object format
64    dependent files.  */
65
66 extern void check (bool gate, enum ld_plugin_level level, const char *text);
67
68 extern void translate (char *data, char *end, struct plugin_symtab *out);
69
70 extern char *parse_table_entry (char *p, struct ld_plugin_symbol *entry,
71                         struct sym_aux *aux);
72
73 extern void resolve_conflicts (struct plugin_symtab *t,
74                         struct plugin_symtab *conflicts);
75
76 /* And this callback function is exposed.  */
77
78 extern ld_plugin_add_symbols add_symbols;
79
80 /* Along with these two variables.  */
81
82 extern struct plugin_file_info *claimed_files;
83 extern unsigned int num_claimed_files;
84