#include "config.h"#include "system.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 | PARAMS ((int)) |
| static int is_ctor_dtor | PARAMS ((const char *)) |
| static char *find_a_file | PARAMS ((struct path_prefix *, const char *)) |
| static void prefix_from_env | PARAMS ((const char *, struct path_prefix *)) |
| static void fork_execute | PARAMS ((const char *, char **)) |
| static void add_to_list | PARAMS ((struct head *, const char *)) |
| static void sort_ids | PARAMS ((struct head *)) |
| static void write_list | PARAMS ((FILE *, const char *, struct id *)) |
| static void write_c_file | PARAMS ((FILE *, const char *)) |
| static void scan_prog_file | PARAMS ((const char *, enum pass)) |
| static char *extract_string | PARAMS ((const char **)) |
| static int dup2 | PARAMS ((int, int)) |
| static int | dup2 (int oldfd, int newfd) |
| void | collect_exit (int status) |
| void notice | VPARAMS ((const char *msgid,...)) |
| void | fancy_abort () |
| static void | handler (int signo) |
| int | file_exists (char *name) const |
| static char * | extract_string (char **pp) const |
| void | dump_file (char *name) const |
| static int | is_ctor_dtor (char *s) const |
| static char * | find_a_file (struct path_prefix *pprefix, const char *name) |
| static void | add_prefix (struct path_prefix *pprefix, const char *prefix) |
| static void | prefix_from_env (char *env, struct path_prefix *pprefix) const |
| static void | prefix_from_string (char *p, struct path_prefix *pprefix) const |
| int main | PARAMS ((int, char *[])) |
| int | main (int argc, argv) |
| int | collect_wait (char *prog) const |
| static void | do_wait (char *prog) const |
| void | collect_execute (char *prog, char **argv, const char *redir) const |
| static void | fork_execute (char *prog, char **argv) const |
| static void | maybe_unlink (char *file) const |
| static void | add_to_list (struct head *head_ptr, const char *name) |
| static int | extract_init_priority (char *name) const |
| static void | sort_ids (struct head *head_ptr) |
| static void | write_list (FILE *stream, const char *prefix, struct id *list) |
| static void | write_list_with_asm (FILE *stream, const char *prefix, struct id *list) |
| static void | write_c_file_stat (FILE *stream, name) |
| static void | write_c_file_glob (FILE *stream, name) |
| static void | write_c_file (FILE *stream, const char *name) |
| static void | scan_prog_file (char *prog_name, enum pass which_pass) const |
Variables | |
| int | do_collecting = 0 |
| int | no_demangle |
| int | vflag |
| static int | rflag |
| static int | strip_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 | pexecute_pid |
| static struct path_prefix cpath | path |
| static long | sequence_number = 0 |
| #define COLLECT |
Definition at line 57 of file collect2.c.
| #define DEFAULT_INIT_PRIORITY 65535 |
Definition at line 153 of file collect2.c.
Referenced by build_cdtor(), c_expand_body(), compile_resource_file(), cp_finish_file(), create_coverage(), default_named_section_asm_out_constructor(), default_named_section_asm_out_destructor(), emit_register_classes(), extract_init_priority(), finish_file(), finish_objc(), generate_ctor_and_dtor_functions_for_priority(), generate_ctor_or_dtor_function(), output_func_start_profiler(), start_objects(), start_static_initialization_or_destruction(), WFE_Start_Function(), WGEN_Start_Function(), xstormy16_asm_out_constructor(), and xstormy16_asm_out_destructor().
| #define LIBRARY_PATH_ENV "LIBRARY_PATH" |
| #define NAME__MAIN "__main" |
Definition at line 149 of file collect2.c.
Referenced by expand_main_function(), and write_c_file_glob().
| #define NM_FLAGS "-n" |
| #define OBJECT_FORMAT_NONE |
Definition at line 87 of file collect2.c.
| #define VFORK_STRING "vfork" |
Definition at line 43 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 196 of file collect2.c.
| static void add_prefix | ( | struct path_prefix * | pprefix, | |
| const char * | prefix | |||
| ) | [static] |
Definition at line 761 of file collect2.c.
References len, prefix_list::next, pl, prefix_list::prefix, prev, strlen(), xmalloc(), and xstrdup().
Referenced by add_sysrooted_prefix(), main(), prefix_from_string(), and process_command().
Definition at line 1687 of file collect2.c.
References free(), id::name, id::next, id::sequence, strcmp(), strcpy, strlen(), and xcalloc().
Referenced by main(), and scan_prog_file().
| void collect_execute | ( | char * | prog, | |
| char ** | argv, | |||
| const char * | redir | |||
| ) | const |
Definition at line 1587 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_pid, PEXECUTE_SEARCH, STDERR_FILENO, STDOUT_FILENO, str, and vflag.
Referenced by fork_execute(), and tlink_execute().
| void collect_exit | ( | int | status | ) |
Definition at line 339 of file collect2.c.
Referenced by collect_wait(), do_tlink(), do_wait(), fatal(), and fatal_perror().
| int collect_wait | ( | char * | prog | ) | const |
Definition at line 1548 of file collect2.c.
References collect_exit(), error(), FATAL_EXIT_CODE, pexecute_pid, pwait(), strsignal(), WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSIGNALED, and WTERMSIG.
Referenced by do_wait(), and tlink_execute().
| static void do_wait | ( | char * | prog | ) | const [static] |
Definition at line 1572 of file collect2.c.
References collect_exit(), collect_wait(), error(), and ret.
Referenced by fork_execute(), and scan_prog_file().
| void dump_file | ( | char * | name | ) | const |
Definition at line 538 of file collect2.c.
References c, cplus_demangle(), DMGL_ANSI, DMGL_PARAMS, DMGL_VERBOSE, EOF, fclose(), fflush(), fopen, fputs(), free(), getc(), ISALNUM, 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] |
Definition at line 315 of file collect2.c.
References close, dup(), and fd.
Referenced by chain_open(), collect_execute(), DAVINCI::DAVINCI(), daVinci::daVinci(), DaVinci::DaVinci(), internal_fix(), pex_djgpp_exec_child(), pex_unix_exec_child(), pexecute(), pxfdup2_(), run_phase(), run_simple_program(), and scan_prog_file().
| static int extract_init_priority | ( | char * | name | ) | const [static] |
Definition at line 1722 of file collect2.c.
References atoi(), DEFAULT_INIT_PRIORITY, and pos().
Referenced by sort_ids().
| static char* extract_string | ( | char ** | pp | ) | const [static] |
Definition at line 507 of file collect2.c.
References c, obstack_1grow, obstack_finish, p, and temporary_obstack.
Referenced by get_base_filename(), and main().
Definition at line 469 of file collect2.c.
References fatal().
Referenced by _fatal_insn(), abort_with_insn(), and segv_handler().
| int file_exists | ( | char * | name | ) | const |
| static char* find_a_file | ( | struct path_prefix * | pprefix, | |
| const char * | name | |||
| ) | [static] |
Definition at line 678 of file collect2.c.
References access, debug, fprintf(), free(), HAVE_DOS_BASED_FILE_SYSTEM, HOST_EXECUTABLE_SUFFIX, len, prefix_list::next, NULL, pl, prefix_list::prefix, S_ISDIR, stat::st_mode, strcat(), strcpy, strlen(), X_OK, and xmalloc().
Referenced by execute(), find_file(), include_spec_function(), main(), and read_specs().
| static void fork_execute | ( | char * | prog, | |
| char ** | argv | |||
| ) | const [static] |
Definition at line 1661 of file collect2.c.
References collect_execute(), do_wait(), and NULL.
Referenced by main().
| static void handler | ( | int | signo | ) | [static] |
Definition at line 475 of file collect2.c.
References c_file, getpid, kill, ldout, maybe_unlink(), o_file, and signal().
| static int is_ctor_dtor | ( | char * | s | ) | const [static] |
Definition at line 606 of file collect2.c.
References len, names, NO_DOT_IN_LABEL, NULL, p, ret, and strncmp().
Referenced by scan_prog_file().
| int main | ( | int argc | , | |
| argv | ||||
| ) |
Definition at line 854 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, current_demangling_style, debug, DEFAULT_LINKER, destructors, do_collecting, do_tlink(), 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, version_string, vflag, write_c_file(), X_OK, xcalloc(), and xstrdup().
| static void maybe_unlink | ( | char * | file | ) | const [static] |
Definition at line 1672 of file collect2.c.
References debug, notice(), and unlink.
Referenced by collect_exit(), handler(), and main().
| int main PARAMS | ( | (int, char *[]) | ) |
| static int dup2 PARAMS | ( | (int, int) | ) | [static] |
| static char* extract_string PARAMS | ( | (const char **) | ) | [static] |
| static void fork_execute PARAMS | ( | (const char *, char **) | ) | [static] |
| static void prefix_from_env PARAMS | ( | (const char *, struct path_prefix *) | ) | [static] |
| static char* find_a_file PARAMS | ( | (struct path_prefix *, const char *) | ) | [static] |
| static int is_ctor_dtor PARAMS | ( | (const char *) | ) | [static] |
Definition at line 635 of file mips-tfile.c.
| static void handler PARAMS | ( | (int) | ) | [static] |
| static void prefix_from_env | ( | char * | env, | |
| struct path_prefix * | pprefix | |||
| ) | const [static] |
Definition at line 797 of file collect2.c.
References GET_ENVIRONMENT, and prefix_from_string().
Referenced by main().
| static void prefix_from_string | ( | char * | p, | |
| struct path_prefix * | pprefix | |||
| ) | const [static] |
Definition at line 809 of file collect2.c.
References add_prefix(), debug, DIR_SEPARATOR, fprintf(), IS_DIR_SEPARATOR, PATH_SEPARATOR, strcpy, strlen(), strncpy(), and xmalloc().
Referenced by prefix_from_env().
Definition at line 2115 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, is_ctor_dtor(), ISSPACE, nm_file_name, NM_FLAGS, PARAMS, PASS_LIB, PASS_SECOND, pid, pipe(), signal(), SIGQUIT, str, vflag, vfork, VFORK_STRING, and void.
Referenced by main().
Definition at line 1740 of file collect2.c.
References extract_init_priority(), id::name, id::next, NULL, and id::sequence.
Referenced by main().
Definition at line 368 of file collect2.c.
References _, VA_CLOSE, va_end, VA_FIXEDARG, VA_OPEN, VA_START, and vfprintf().
Definition at line 2075 of file collect2.c.
References fprintf(), shared_obj, write_c_file_glob(), and write_c_file_stat().
Referenced by main().
Definition at line 2010 of file collect2.c.
References constructors, destructors, head::first, fprintf(), frame_tables, NAME__MAIN, head::number, write_list(), and write_list_with_asm().
Referenced by write_c_file().
Definition at line 1879 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().
Referenced by write_c_file().
Definition at line 1782 of file collect2.c.
References fprintf(), id::next, and id::sequence.
Referenced by write_c_file_glob(), and write_c_file_stat().
Definition at line 1862 of file collect2.c.
References fprintf(), id::name, id::next, and id::sequence.
Referenced by write_c_file_glob(), and write_c_file_stat().
const char* c_file [static] |
Definition at line 215 of file collect2.c.
Referenced by Bundle_Generator(), Bypass_Generator(), collect_exit(), Enums_Generator(), handler(), Itanium_Generator(), Lits_Generator(), main(), Opcode_Generator(), Operands_Generator(), Proc_Generator(), Proc_Properties_Generator(), Properties_Generator(), Register_Generator(), and Subset_Generator().
| const char* c_file_name |
struct head constructors [static] |
Definition at line 230 of file collect2.c.
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
| int debug |
Definition at line 211 of file collect2.c.
struct head destructors [static] |
Definition at line 231 of file collect2.c.
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
| int do_collecting = 0 |
char * fininame [static] |
struct head frame_tables [static] |
Definition at line 235 of file collect2.c.
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
char* initname [static] |
| const char* ldout |
Definition at line 220 of file collect2.c.
Referenced by collect_exit(), do_tlink(), handler(), and main().
const char* nm_file_name [static] |
| int no_demangle |
const char* o_file [static] |
const char* output_file [static] |
Definition at line 221 of file collect2.c.
struct path_prefix cpath path [static] |
Definition at line 663 of file collect2.c.
| int pexecute_pid |
int rflag [static] |
long sequence_number = 0 [static] |
Definition at line 1682 of file collect2.c.
int shared_obj [static] |
Definition at line 213 of file collect2.c.
Referenced by main(), write_c_file(), and write_c_file_stat().
const char* strip_file_name [static] |
int strip_flag [static] |
| char* temporary_firstobj |
Definition at line 238 of file collect2.c.
Referenced by dump_file(), main(), read_repo_file(), recompile_files(), and scan_linker_output().
Definition at line 237 of file collect2.c.
Referenced by afgets(), build_class_ref(), build_dtable_decl(), DEFUN(), dump_file(), extract_string(), frob_extension(), init_class_processing(), init_repo(), java_get_line_col(), java_lex(), java_unicode_2_utf8(), layout_class(), layout_class_method(), main(), read_repo_file(), recompile_files(), scan_linker_output(), tfgets(), and write_classfile().
| int vflag |
Definition at line 203 of file collect2.c.
1.5.6