GCC Middle and Back End API Reference
tlink.c File Reference

Data Structures

struct  symbol_hash_entry
struct  file_hash_entry
struct  demangled_hash_entry
struct  symbol_stack_entry
struct  file_stack_entry

Typedefs

typedef struct symbol_hash_entry symbol
typedef struct file_hash_entry file
typedef const char * str
typedef struct demangled_hash_entry demangled

Functions

static int hash_string_eq (const void *, const void *)
static hashval_t hash_string_hash (const void *)
static int hash_string_eq ()
static hashval_t hash_string_hash ()
static struct symbol_hash_entrysymbol_hash_lookup (const char *, int)
static struct file_hash_entryfile_hash_lookup (const char *)
static struct
demangled_hash_entry
demangled_hash_lookup (const char *, int)
static void symbol_push (symbol *)
static symbolsymbol_pop (void)
static void file_push (file *)
static filefile_pop (void)
static void tlink_init (void)
static int tlink_execute (const char *, char **, const char *, const char *)
static char * frob_extension (const char *, const char *)
static char * obstack_fgets (FILE *, struct obstack *)
static char * tfgets (FILE *)
static char * pfgets (FILE *)
static void freadsym (FILE *, file *, int)
static void read_repo_file (file *)
static void maybe_tweak (char *, file *)
static int recompile_files (void)
static int read_repo_files (char **)
static void demangle_new_symbols (void)
static int scan_linker_output (const char *)
static struct symbol_hash_entrysymbol_hash_lookup ()
static struct file_hash_entryfile_hash_lookup ()
static struct
demangled_hash_entry
demangled_hash_lookup ()
static void symbol_push ()
static void file_push ()
static char * frob_extension ()
static char * obstack_fgets ()
static char * tfgets ()
static char * pfgets ()
static void freadsym ()
static void read_repo_file ()
static void maybe_tweak ()
static int read_repo_files ()
static bool start_tweaking ()
static int scan_linker_output ()
void do_tlink ()

Variables

int prepends_underscore
static int tlink_verbose
static char * initial_cwd
static htab_t symbol_table
static htab_t file_table
static htab_t demangled_table
struct obstack symbol_stack_obstack
struct symbol_stack_entrysymbol_stack
struct obstack file_stack_obstack
struct file_stack_entryfile_stack

Typedef Documentation

typedef struct file_hash_entry file
typedef const char* str
typedef struct symbol_hash_entry symbol
Hash table boilerplate for working with htab_t.  We have hash tables
   for symbol names, file names, and demangled symbols.   

Function Documentation

static void demangle_new_symbols ( )
static
Add the demangled forms of any new symbols to the hash table.   

References demangled_hash_lookup(), symbol_hash_entry::key, demangled_hash_entry::mangled, and symbol_pop().

Referenced by do_tlink().

static struct demangled_hash_entry* demangled_hash_lookup ( const char *  ,
int   
)
staticread
static struct demangled_hash_entry* demangled_hash_lookup ( )
staticread
Look up an entry in the demangled name hash table.   

References demangled_table, and demangled_hash_entry::key.

void do_tlink ( )
Entry point for tlink.  Called from main in collect2.c.

   Iteratively try to provide definitions for all the unresolved symbols
   mentioned in the linker error messages.

   LD_ARGV is an array of arguments for the linker.
   OBJECT_LST is an array of object files that we may be able to recompile
     to provide missing definitions.  Currently ignored.   

References demangle_new_symbols(), dump_ld_file(), error(), lderrout, ldout, may_unlink_output_file, read_repo_files(), recompile_files(), scan_linker_output(), tlink_execute(), tlink_init(), and tlink_verbose.

static struct file_hash_entry* file_hash_lookup ( const char *  )
staticread

Referenced by read_repo_files().

static struct file_hash_entry* file_hash_lookup ( )
staticread
Look up an entry in the file hash table.   

References file_table, and file_hash_entry::key.

static void file_push ( file )
static

Referenced by freadsym(), and start_tweaking().

static void freadsym ( FILE *  ,
file ,
int   
)
static

Referenced by read_repo_file().

static void freadsym ( )
static
Real tlink code.   
Subroutine of read_repo_file.  We are reading the repo file for file F,
   which is coming in on STREAM, and the symbol that comes next in STREAM
   is offered, chosen or provided if CHOSEN is 0, 1 or 2, respectively.

   XXX "provided" is unimplemented, both here and in the compiler.   

References symbol_hash_entry::chosen, symbol_hash_entry::file, file_push(), symbol_hash_lookup(), symbol_push(), and tfgets().

static char* frob_extension ( const char *  ,
const char *   
)
static

Referenced by read_repo_files(), and recompile_files().

static char* frob_extension ( )
static

References strlen(), and temporary_obstack.

static int hash_string_eq ( const void *  ,
const void *   
)
static
Hash and comparison functions for these hash tables.   

Referenced by tlink_init().

static int hash_string_eq ( )
static
static hashval_t hash_string_hash ( const void *  )
static

Referenced by tlink_init().

static hashval_t hash_string_hash ( )
static
static void maybe_tweak ( char *  ,
file  
)
static

Referenced by recompile_files().

static void maybe_tweak ( )
static
We might want to modify LINE, which is a symbol line from file F.  We do
   this if either we saw an error message referring to the symbol in
   question, or we have already allocated the symbol to another file and
   this one wants to emit it as well.   

References symbol_hash_entry::chosen, symbol_hash_entry::file, symbol_hash_lookup(), symbol_hash_entry::tweaked, and symbol_hash_entry::tweaking.

static char* obstack_fgets ( FILE *  ,
struct obstack  
)
static

Referenced by tfgets().

static char* obstack_fgets ( )
static
static char* pfgets ( FILE *  )
static

Referenced by read_repo_file().

static char* pfgets ( )
static

References tfgets().

static void read_repo_file ( file )
static

Referenced by read_repo_files(), and recompile_files().

static void read_repo_file ( )
static
Read in the repo file denoted by F, and record all its information.   

References file_hash_entry::args, file_hash_entry::dir, freadsym(), getenv(), file_hash_entry::key, file_hash_entry::main, pfgets(), temporary_firstobj, temporary_obstack, and tlink_verbose.

static int read_repo_files ( char **  )
static

Referenced by do_tlink().

static int read_repo_files ( )
static
The first phase of processing: determine which object files have
   .rpo files associated with them, and read in the information.   

References file_exists(), file_hash_lookup(), frob_extension(), read_repo_file(), and recompile_files().

static int recompile_files ( )
static
static int scan_linker_output ( const char *  )
static

Referenced by do_tlink().

static int scan_linker_output ( )
static
Step through the output of the linker, in the file named FNAME, and
   adjust the settings for each symbol encountered.   

References symbol_hash_entry::chosen, demangled_hash_lookup(), len, demangled_hash_entry::mangled, start_tweaking(), strlen(), strstr(), symbol_hash_lookup(), temporary_firstobj, temporary_obstack, tfgets(), and symbol_hash_entry::tweaked.

static bool start_tweaking ( )
static
We want to tweak symbol SYM.  Return true if all is well, false on
   error.   

References error(), symbol_hash_entry::file, file_push(), symbol_hash_entry::key, file_hash_entry::key, tlink_verbose, symbol_hash_entry::tweaked, and symbol_hash_entry::tweaking.

Referenced by scan_linker_output().

static struct symbol_hash_entry* symbol_hash_lookup ( const char *  ,
int   
)
staticread
static struct symbol_hash_entry* symbol_hash_lookup ( )
staticread
Look up an entry in the symbol hash table.   

References symbol_hash_entry::key, and symbol_table.

static symbol * symbol_pop ( void  )
static
static void symbol_push ( symbol )
static

Referenced by freadsym().

static void symbol_push ( )
static
static char* tfgets ( FILE *  )
static
static char* tfgets ( )
static
static int tlink_execute ( const char *  prog,
char **  argv,
const char *  outname,
const char *  errname 
)
static

References collect_execute(), and collect_wait().

Referenced by do_tlink(), and recompile_files().

static void tlink_init ( )
static
Other machinery.   
Initialize the tlink machinery.  Called from do_tlink.   

References debug, demangled_table, file_stack_obstack, file_table, getenv(), hash_string_eq(), hash_string_hash(), initial_cwd, symbol_stack_obstack, symbol_table, tlink_verbose, and vflag.

Referenced by do_tlink().


Variable Documentation

htab_t demangled_table
static
struct file_stack_entry* file_stack

Referenced by file_pop(), and file_push().

struct obstack file_stack_obstack

Referenced by file_pop(), file_push(), and tlink_init().

htab_t file_table
static

Referenced by file_hash_lookup(), and tlink_init().

char* initial_cwd
static

Referenced by recompile_files(), and tlink_init().

int prepends_underscore
Defined in the automatically-generated underscore.c.   
struct symbol_stack_entry* symbol_stack

Referenced by symbol_pop(), and symbol_push().

struct obstack symbol_stack_obstack

Referenced by symbol_pop(), symbol_push(), and tlink_init().

htab_t symbol_table
static

Referenced by symbol_hash_lookup(), and tlink_init().

int tlink_verbose
static