xref: /dflybsd-src/contrib/gcc-4.7/gcc/lto/lto.h (revision 04febcfb30580676d3e95f58a16c5137ee478b32)
1*e4b17023SJohn Marino /* LTO declarations.
2*e4b17023SJohn Marino    Copyright 2009, 2010 Free Software Foundation, Inc.
3*e4b17023SJohn Marino    Contributed by CodeSourcery, Inc.
4*e4b17023SJohn Marino 
5*e4b17023SJohn Marino This file is part of GCC.
6*e4b17023SJohn Marino 
7*e4b17023SJohn Marino GCC is free software; you can redistribute it and/or modify it under
8*e4b17023SJohn Marino the terms of the GNU General Public License as published by the Free
9*e4b17023SJohn Marino Software Foundation; either version 3, or (at your option) any later
10*e4b17023SJohn Marino version.
11*e4b17023SJohn Marino 
12*e4b17023SJohn Marino GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13*e4b17023SJohn Marino WARRANTY; without even the implied warranty of MERCHANTABILITY or
14*e4b17023SJohn Marino FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15*e4b17023SJohn Marino for more details.
16*e4b17023SJohn Marino 
17*e4b17023SJohn Marino You should have received a copy of the GNU General Public License
18*e4b17023SJohn Marino along with GCC; see the file COPYING3.  If not see
19*e4b17023SJohn Marino <http://www.gnu.org/licenses/>.  */
20*e4b17023SJohn Marino 
21*e4b17023SJohn Marino #ifndef LTO_H
22*e4b17023SJohn Marino #define LTO_H
23*e4b17023SJohn Marino 
24*e4b17023SJohn Marino #include "hashtab.h"
25*e4b17023SJohn Marino 
26*e4b17023SJohn Marino /* A file.  */
27*e4b17023SJohn Marino typedef struct lto_file_struct
28*e4b17023SJohn Marino {
29*e4b17023SJohn Marino   /* The name of the file.  */
30*e4b17023SJohn Marino   const char *filename;
31*e4b17023SJohn Marino   /* The offset for the object inside an ar archive file (or zero).  */
32*e4b17023SJohn Marino   off_t offset;
33*e4b17023SJohn Marino } lto_file;
34*e4b17023SJohn Marino 
35*e4b17023SJohn Marino /* In lto-lang.c  */
36*e4b17023SJohn Marino extern const char *resolution_file_name;
37*e4b17023SJohn Marino 
38*e4b17023SJohn Marino /* In lto.c  */
39*e4b17023SJohn Marino extern tree lto_eh_personality (void);
40*e4b17023SJohn Marino extern void lto_main (void);
41*e4b17023SJohn Marino extern void lto_read_all_file_options (void);
42*e4b17023SJohn Marino 
43*e4b17023SJohn Marino /* In lto-elf.c or lto-coff.c  */
44*e4b17023SJohn Marino extern lto_file *lto_obj_file_open (const char *filename, bool writable);
45*e4b17023SJohn Marino extern void lto_obj_file_close (lto_file *file);
46*e4b17023SJohn Marino struct lto_section_list;
47*e4b17023SJohn Marino extern htab_t lto_obj_build_section_table (lto_file *file, struct lto_section_list *list);
48*e4b17023SJohn Marino extern htab_t lto_obj_create_section_hash_table (void);
49*e4b17023SJohn Marino extern void lto_obj_begin_section (const char *name);
50*e4b17023SJohn Marino extern void lto_obj_append_data (const void *data, size_t len, void *block);
51*e4b17023SJohn Marino extern void lto_obj_end_section (void);
52*e4b17023SJohn Marino extern lto_file *lto_set_current_out_file (lto_file *file);
53*e4b17023SJohn Marino extern lto_file *lto_get_current_out_file (void);
54*e4b17023SJohn Marino 
55*e4b17023SJohn Marino /* Hash table entry to hold the start offset and length of an LTO
56*e4b17023SJohn Marino    section in a .o file.  */
57*e4b17023SJohn Marino struct lto_section_slot
58*e4b17023SJohn Marino {
59*e4b17023SJohn Marino   const char *name;
60*e4b17023SJohn Marino   intptr_t start;
61*e4b17023SJohn Marino   size_t len;
62*e4b17023SJohn Marino   struct lto_section_slot *next;
63*e4b17023SJohn Marino };
64*e4b17023SJohn Marino 
65*e4b17023SJohn Marino /* A list of section slots */
66*e4b17023SJohn Marino struct lto_section_list
67*e4b17023SJohn Marino {
68*e4b17023SJohn Marino   struct lto_section_slot *first, *last;
69*e4b17023SJohn Marino };
70*e4b17023SJohn Marino 
71*e4b17023SJohn Marino #endif /* LTO_H */
72