gcc/lto-plugin/lto-plugin.h
Dave Korn 1cd0b7167e configure.ac (build_lto_plugin): New shell variable.
ChangeLog:

2010-10-07  Dave Korn  <dave.korn.cygwin@gmail.com>

	* configure.ac (build_lto_plugin): New shell variable.
	(--enable-lto): Turn on by default for all non-ELF platforms that
	have had LTO support added so far.  Set build_lto_plugin appropriately
	for both ELF and non-ELF.
	(configdirs): Add lto-plugin or not based on build_lto_plugin.
	* configure: Regenerate.

gcc/ChangeLog:

2010-10-07  Dave Korn  <dave.korn.cygwin@gmail.com>

	* config.host (host_lto_plugin_soname): New shell variable.
	* configure.ac (LTOPLUGINSONAME): Add an AC_DEFINE for the above.
	* config.in: Regenerate.
	* configure: Regenerate.
	* gcc.c (main): Use LTOPLUGINSONAME instead of hard-coding name of
	LTO plugin shared library.

lto-plugin/ChangeLog:

2010-10-07  Dave Korn  <dave.korn.cygwin@gmail.com>

	* configure.ac: Source config.gcc to determine lto_binary_reader.
	(LTO_FORMAT): New AC_SUBST variable inferred from lto_binary_reader.
	* Makefile.am (LTO_FORMAT): Import.
	(liblto_plugin_la_SOURCES): Add object format dependent module
	defined by LTO_FORMAT.
	(liblto_plugin_la_LIBADD): Allow for both PIC and non-PIC libiberty,
	and work around libtool warning.
	* configure: Regenerate.
	* Makefile.in: Likewise.
	* lto-plugin.c (struct sym_aux): Move to new lto-plugin.h.
	(struct sym_aux): Likewise.
	(struct plugin_symtab): Likewise.
	(struct plugin_file_info): Likewise.
	(LTO_SECTION_PREFIX): Likewise.
	(add_symbols):  Make non-static.
	(claimed_files): Likewise.
	(num_claimed_files): Likewise.
	(check): Likewise.
	(parse_table_entry): Likewise.
	(translate): Likewise.
	(resolve_conflicts): Likewise.
	(process_symtab): Move to new lto-plugin-elf.c object format dependent
	source file.
	(claim_file_handler): Likewise, and make non-static.
	(onload): Call new onload_format_checks function.
	* lto-plugin.h: New file.
	(LTO_SECTION_PREFIX): Move here.
	(struct sym_aux): Likewise.
	(struct plugin_symtab): Likewise.
	(struct plugin_file_info): Likewise.
	(claim_file_handler): Add new function prototype.
	(onload_format_checks): Likewise.
	(check): Declare extern.
	(translate): Likewise.
	(parse_table_entry): Likewise.
	(resolve_conflicts): Likewise.
	(add_symbols):  Likewise.
	(claimed_files): Likewise.
	(num_claimed_files): Likewise.
	* lto-plugin-elf.c (process_symtab): Move here.
	(claim_file_handler): Likewise, and make non-static.
	(onload_format_checks): New function factored out from onload.
	* lto-plugin-coff.c (claim_file_handler): New function stub.
	(onload_format_checks): Likewise.

From-SVN: r165133
2010-10-07 20:28:59 +00:00

85 lines
2.4 KiB
C

/* Common declarations for LTO plugin for gold and/or GNU ld.
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
Contributed by Rafael Avila de Espindola (espindola@google.com).
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include <stdbool.h>
#include "plugin-api.h"
/* LTO magic section name. */
#define LTO_SECTION_PREFIX ".gnu.lto_.symtab"
/* The part of the symbol table the plugin has to keep track of. Note that we
must keep SYMS until all_symbols_read is called to give the linker time to
copy the symbol information. */
struct sym_aux
{
uint32_t slot;
unsigned id;
unsigned next_conflict;
};
struct plugin_symtab
{
int nsyms;
struct sym_aux *aux;
struct ld_plugin_symbol *syms;
unsigned id;
};
/* All that we have to remember about a file. */
struct plugin_file_info
{
char *name;
void *handle;
struct plugin_symtab symtab;
struct plugin_symtab conflicts;
};
/* These are the methods supplied by one of the object format
dependent files lto-plugin-elf.c or lto-plugin-coff.c */
extern enum ld_plugin_status claim_file_handler
(const struct ld_plugin_input_file *file, int *claimed);
extern enum ld_plugin_status onload_format_checks (struct ld_plugin_tv *tv);
/* These methods are made available to the object format
dependent files. */
extern void check (bool gate, enum ld_plugin_level level, const char *text);
extern void translate (char *data, char *end, struct plugin_symtab *out);
extern char *parse_table_entry (char *p, struct ld_plugin_symbol *entry,
struct sym_aux *aux);
extern void resolve_conflicts (struct plugin_symtab *t,
struct plugin_symtab *conflicts);
/* And this callback function is exposed. */
extern ld_plugin_add_symbols add_symbols;
/* Along with these two variables. */
extern struct plugin_file_info *claimed_files;
extern unsigned int num_claimed_files;