#include "config.h"#include "system.h"#include "coretypes.h"#include "tm.h"#include <signal.h>#include "collect2.h"#include "demangle.h"#include "obstack.h"#include "intl.h"#include "version.h"

Go to the source code of this file.
Data Types | |
| type | id |
| type | head |
| type | prefix_list |
| type | path_prefix |
Defines | |
| #define | VFORK_STRING "vfork" |
| #define | LIBRARY_PATH_ENV "LIBRARY_PATH" |
| #define | COLLECT |
| #define | OBJECT_FORMAT_NONE |
| #define | NM_FLAGS "-n" |
| #define | NAME__MAIN "__main" |
| #define | DEFAULT_INIT_PRIORITY 65535 |
| #define | COLLECT_SHARED_INIT_FUNC(STREAM, FUNC) fprintf ((STREAM), "void _GLOBAL__DI() {\n\t%s();\n}\n", (FUNC)) |
| #define | COLLECT_SHARED_FINI_FUNC(STREAM, FUNC) fprintf ((STREAM), "void _GLOBAL__DD() {\n\t%s();\n}\n", (FUNC)) |
Enumerations | |
| enum | pass { PASS_FIRST, PASS_OBJ, PASS_LIB, PASS_SECOND, PASS_FIRST, PASS_OBJ, PASS_LIB, PASS_SECOND, PASS_FIRST, PASS_OBJ, PASS_LIB, PASS_SECOND, PASS_FIRST, PASS_OBJ, PASS_LIB, PASS_SECOND } |
Functions/Subroutines | |
| static void | handler (int) |
| static int | is_ctor_dtor (const char *) |
| static char * | find_a_file (struct path_prefix *, const char *) |
| static void | add_prefix (struct path_prefix *, const char *) |
| static void | prefix_from_env (const char *, struct path_prefix *) |
| static void | prefix_from_string (const char *, struct path_prefix *) |
| static void | do_wait (const char *) |
| static void | fork_execute (const char *, char **) |
| static void | maybe_unlink (const char *) |
| static void | add_to_list (struct head *, const char *) |
| static int | extract_init_priority (const char *) |
| static void | sort_ids (struct head *) |
| static void | write_list (FILE *, const char *, struct id *) |
| static void | write_list_with_asm (FILE *, const char *, struct id *) |
| static void | write_c_file (FILE *, const char *) |
| static void | write_c_file_stat (FILE *, const char *) |
| static void | write_c_file_glob (FILE *, const char *) |
| static void | scan_prog_file (const char *, enum pass) |
| static char * | extract_string (const char **) |
| static int | dup2 (int oldfd, int newfd) |
| void | collect_exit (int status) |
| void | notice (const char *cmsgid,...) |
| void | fatal_perror (const char *cmsgid,...) |
| void | fatal (const char *cmsgid,...) |
| void | error (const char *gmsgid,...) |
| void | fancy_abort (const char *file, int line, const char *func) |
| int | file_exists (const char *name) |
| void | dump_file (const char *name) |
| int | main (int argc, char **argv) |
| int | collect_wait (const char *prog) |
| void | collect_execute (const char *prog, char **argv, const char *redir) |
| static void | write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED) |
| static void | write_c_file_glob (FILE *stream, const char *name ATTRIBUTE_UNUSED) |
Variables | |
| int | do_collecting = 0 |
| int | no_demangle |
| int | vflag |
| static int | rflag |
| static int | strip_flag |
| static const char * | demangle_flag |
| int | debug |
| static int | shared_obj |
| static const char * | c_file |
| static const char * | o_file |
| const char * | ldout |
| static const char * | output_file |
| static const char * | nm_file_name |
| static const char * | strip_file_name |
| const char * | c_file_name |
| static char * | initname |
| static char * | fininame |
| static struct head | constructors |
| static struct head | destructors |
| static struct head | frame_tables |
| struct obstack | temporary_obstack |
| char * | temporary_firstobj |
| int | pid |
| static struct path_prefix cpath | path |
| static long | sequence_number = 0 |
| #define COLLECT |
Definition at line 55 of file collect2.c.
| #define COLLECT_SHARED_FINI_FUNC | ( | STREAM, | |||
| FUNC | ) | fprintf ((STREAM), "void _GLOBAL__DD() {\n\t%s();\n}\n", (FUNC)) |
Definition at line 138 of file collect2.c.
| #define COLLECT_SHARED_INIT_FUNC | ( | STREAM, | |||
| FUNC | ) | fprintf ((STREAM), "void _GLOBAL__DI() {\n\t%s();\n}\n", (FUNC)) |
Definition at line 134 of file collect2.c.
| #define DEFAULT_INIT_PRIORITY 65535 |
Definition at line 131 of file collect2.c.
| #define LIBRARY_PATH_ENV "LIBRARY_PATH" |
Definition at line 52 of file collect2.c.
| #define NAME__MAIN "__main" |
Definition at line 127 of file collect2.c.
| #define NM_FLAGS "-n" |
Definition at line 118 of file collect2.c.
| #define OBJECT_FORMAT_NONE |
Definition at line 83 of file collect2.c.
| #define VFORK_STRING "vfork" |
Definition at line 41 of file collect2.c.
| enum pass |
| PASS_FIRST | |
| PASS_OBJ | |
| PASS_LIB | |
| PASS_SECOND | |
| PASS_FIRST | |
| PASS_OBJ | |
| PASS_LIB | |
| PASS_SECOND | |
| PASS_FIRST | |
| PASS_OBJ | |
| PASS_LIB | |
| PASS_SECOND | |
| PASS_FIRST | |
| PASS_OBJ | |
| PASS_LIB | |
| PASS_SECOND |
Definition at line 174 of file collect2.c.
| static void add_prefix | ( | struct path_prefix * | pprefix, | |
| const char * | prefix | |||
| ) | [static] |
Definition at line 676 of file collect2.c.
References len, path_prefix::max_len, prefix_list::next, pl, path_prefix::plist, prefix_list::prefix, prev, strlen(), xmalloc(), and xstrdup().
Definition at line 1637 of file collect2.c.
References head::first, free(), head::last, id::name, id::next, head::number, id::sequence, strcmp(), strcpy, strlen(), and xcalloc().
| void collect_execute | ( | const char * | prog, | |
| char ** | argv, | |||
| const char * | redir | |||
| ) |
Definition at line 1544 of file collect2.c.
References close, debug, dup(), dup2(), fatal(), fatal_perror(), fflush(), fprintf(), notice(), NULL, O_CREAT, O_TRUNC, O_WRONLY, open, pexecute(), PEXECUTE_FIRST, PEXECUTE_LAST, PEXECUTE_SEARCH, pid, STDERR_FILENO, STDOUT_FILENO, str, and vflag.
| void collect_exit | ( | int | status | ) |
Definition at line 312 of file collect2.c.
References c_file, dump_file, exit(), ldout, maybe_unlink(), and o_file.
| int collect_wait | ( | const char * | prog | ) |
Definition at line 1507 of file collect2.c.
References collect_exit(), error(), FATAL_EXIT_CODE, pid, pwait(), strsignal(), WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSIGNALED, and WTERMSIG.
| static void do_wait | ( | const char * | prog | ) | [static] |
Definition at line 1530 of file collect2.c.
References collect_exit(), collect_wait(), error(), and ret.
| void dump_file | ( | const char * | name | ) |
Definition at line 466 of file collect2.c.
References c, cplus_demangle(), DMGL_ANSI, DMGL_PARAMS, DMGL_VERBOSE, EOF, fclose(), fflush(), fopen, fputs(), free(), getc(), ISIDNUM, no_demangle, obstack_1grow, obstack_finish, obstack_free, obstack_object_size, p, putc(), result, stream, strlen(), strncmp(), temporary_firstobj, temporary_obstack, and USER_LABEL_PREFIX.
| static int dup2 | ( | int | oldfd, | |
| int | newfd | |||
| ) | [static] |
| void error | ( | const char * | gmsgid, | |
| ... | ||||
| ) |
Definition at line 385 of file collect2.c.
References _, fprintf(), va_end, va_start, and vfprintf().
| static int extract_init_priority | ( | const char * | name | ) | [static] |
| static char * extract_string | ( | const char ** | pp | ) | [static] |
Definition at line 436 of file collect2.c.
References c, obstack_1grow, obstack_finish, p, and temporary_obstack.
| void fancy_abort | ( | const char * | file, | |
| int | line, | |||
| const char * | func | |||
| ) |
Definition at line 400 of file collect2.c.
| void fatal | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
Definition at line 369 of file collect2.c.
Referenced by add_symbols(), add_sysrooted_prefix(), append_arg(), botch(), check_attr_test(), collect_execute(), compare_version_strings(), do_self_spec(), do_spec_1(), eval_spec_function(), execute(), fancy_abort(), gen_absence_set(), gen_automata_option(), gen_automaton(), gen_bypass(), gen_cpu_unit(), gen_excl_set(), gen_exp(), gen_expand(), gen_insn(), gen_presence_absence_set(), gen_presence_set(), gen_query_cpu_unit(), gen_regexp_allof(), gen_regexp_el(), gen_regexp_oneof(), gen_regexp_repeat(), gen_split(), get_attr_value(), get_file_basename(), handle_braces(), handle_spec_function(), init_md_reader_args(), init_md_reader_args_cb(), initiate_automaton_gen(), lang_specific_driver(), main(), make_canonical(), make_length_attrs(), operate_exp(), output_deps(), print_multilib_info(), process_brace_body(), process_command(), read_specs(), scan_prog_file(), set_multilib_dir(), simplify_test_exp(), special_symbol(), used_arg(), version_compare_spec_function(), vfinfo(), write_automata(), write_rbrac(), and write_test_expr().
| void fatal_perror | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
Definition at line 352 of file collect2.c.
Referenced by collect_execute(), collect_wait(), main(), recompile_files(), and scan_prog_file().
| int file_exists | ( | const char * | name | ) |
| static char * find_a_file | ( | struct path_prefix * | pprefix, | |
| const char * | name | |||
| ) | [static] |
Definition at line 595 of file collect2.c.
References access, debug, fprintf(), free(), HAVE_DOS_BASED_FILE_SYSTEM, HOST_EXECUTABLE_SUFFIX, len, path_prefix::max_len, prefix_list::next, NULL, pl, path_prefix::plist, prefix_list::prefix, S_ISDIR, stat::st_mode, strcat(), strcpy, strlen(), X_OK, and xmalloc().
| static void fork_execute | ( | const char * | prog, | |
| char ** | argv | |||
| ) | [static] |
| static int is_ctor_dtor | ( | const char * | s | ) | [static] |
Definition at line 532 of file collect2.c.
References len, names, NO_DOT_IN_LABEL, NULL, p, ret, and strncmp().
| int main | ( | int argc | , | |
| char ** | argv | |||
| ) |
Definition at line 762 of file collect2.c.
References access, add_prefix(), add_to_list(), auto_demangling, buf, c_file, c_file_name, COLLECT2_HOST_INITIALIZATION, COLLECT_EXPORT_LIST, concat(), constructors, cpath, cplus_demangle_name_to_style(), current_demangling_style, debug, DEFAULT_LINKER, demangle_flag, destructors, do_collecting, do_tlink(), error(), extract_string(), fatal(), fatal_perror(), fclose(), find_a_file(), fininame, first_file, fopen, fork_execute(), fprintf(), frame_tables, gcc_init_libintl, getenv(), handler(), i, initname, LD_FINI_SWITCH, LD_INIT_SWITCH, LDD_SUFFIX, ldout, LIBRARY_PATH_ENV, make_temp_file(), maybe_unlink(), id::name, id::next, nm_file_name, no_demangle, notice(), NULL, head::number, o_file, obstack_alloc, obstack_begin, obstack_free, PASS_FIRST, PASS_OBJ, PASS_SECOND, path, prefix_from_env(), ptr, putenv, q, REAL_LD_FILE_NAME, REAL_NM_FILE_NAME, REAL_STRIP_FILE_NAME, rflag, scan_prog_file(), shared_obj, SIGALRM, SIGBUS, signal(), SIGQUIT, sort_ids(), strchr, strcmp(), strip_file_name, strip_flag, strncmp(), strrchr(), SWITCHES_NEED_SPACES, TARGET_VERSION, temporary_firstobj, temporary_obstack, unknown_demangling, unlock_std_streams(), version_string, vflag, write_c_file(), X_OK, xcalloc(), and xstrdup().
| static void maybe_unlink | ( | const char * | file | ) | [static] |
| void notice | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
Definition at line 340 of file collect2.c.
| static void prefix_from_env | ( | const char * | env, | |
| struct path_prefix * | pprefix | |||
| ) | [static] |
| static void prefix_from_string | ( | const char * | p, | |
| struct path_prefix * | pprefix | |||
| ) | [static] |
Definition at line 720 of file collect2.c.
References add_prefix(), debug, DIR_SEPARATOR, fprintf(), IS_DIR_SEPARATOR, PATH_SEPARATOR, strcpy, strlen(), strncpy(), and xmalloc().
Definition at line 2036 of file collect2.c.
References add_to_list(), buf, close, constructors, debug, destructors, do_wait(), dup2(), end, execv(), fatal(), fatal_perror(), fclose(), fdopen, fflush(), fgets(), fprintf(), frame_tables, inf, int, is_ctor_dtor(), ISSPACE, nm_file_name, NM_FLAGS, PASS_LIB, PASS_SECOND, pid, pipe(), signal(), SIGQUIT, str, vflag, vfork, VFORK_STRING, and void.
Definition at line 1686 of file collect2.c.
References extract_init_priority(), head::first, id::name, id::next, NULL, and id::sequence.
Definition at line 2000 of file collect2.c.
References fprintf(), shared_obj, write_c_file_glob(), and write_c_file_stat().
Definition at line 1937 of file collect2.c.
References constructors, destructors, head::first, fprintf(), frame_tables, NAME__MAIN, head::number, write_list(), and write_list_with_asm().
Definition at line 1808 of file collect2.c.
References COLLECT_SHARED_FINI_FUNC, COLLECT_SHARED_INIT_FUNC, concat(), constructors, debug, destructors, fininame, head::first, fprintf(), frame_tables, free(), initname, ISALNUM, notice(), NULL, head::number, q, r, shared_obj, strchr, strlen(), strncmp(), strncpy(), strrchr(), write_list(), write_list_with_asm(), and xmalloc().
Definition at line 1794 of file collect2.c.
References fprintf(), id::name, id::next, and id::sequence.
const char* c_file [static] |
Definition at line 195 of file collect2.c.
| const char* c_file_name |
Definition at line 207 of file collect2.c.
struct head constructors [static] |
Definition at line 210 of file collect2.c.
| int debug |
Definition at line 191 of file collect2.c.
const char* demangle_flag [static] |
struct head destructors [static] |
Definition at line 211 of file collect2.c.
| int do_collecting = 0 |
Definition at line 149 of file collect2.c.
char * fininame [static] |
Definition at line 208 of file collect2.c.
struct head frame_tables [static] |
Definition at line 215 of file collect2.c.
char* initname [static] |
Definition at line 208 of file collect2.c.
| const char* ldout |
Definition at line 200 of file collect2.c.
const char* nm_file_name [static] |
Definition at line 202 of file collect2.c.
| int no_demangle |
Definition at line 154 of file collect2.c.
const char* o_file [static] |
Definition at line 196 of file collect2.c.
const char* output_file [static] |
Definition at line 201 of file collect2.c.
struct path_prefix cpath path [static] |
Definition at line 580 of file collect2.c.
| int pid |
Definition at line 221 of file collect2.c.
Referenced by collect_execute(), collect_wait(), do_compile(), EXEC_PATH_SET::Dump(), execute(), Extended_Lower_Bound(), Extended_Upper_Bound(), gen_aux_info_file(), initialize_predefined_identifiers(), SUB_SEME_EXEC_PATH_MGR::Next_Path(), pex_run_in_environment(), pex_win32_exec_child(), pexecute(), process_actual_node(), Processor_2D_Tile_Loop(), scan_prog_file(), spawn_script(), tmpnam(), and unwind_get_obj_phdr().
int rflag [static] |
Definition at line 182 of file collect2.c.
long sequence_number = 0 [static] |
Definition at line 1632 of file collect2.c.
int shared_obj [static] |
Definition at line 193 of file collect2.c.
const char* strip_file_name [static] |
Definition at line 206 of file collect2.c.
int strip_flag [static] |
Definition at line 183 of file collect2.c.
| char* temporary_firstobj |
Definition at line 218 of file collect2.c.
Definition at line 217 of file collect2.c.
| int vflag |
Definition at line 181 of file collect2.c.
1.5.6