#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 | 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 *, struct pex_obj *) |
| 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 **) |
| 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, FILE *to) |
| int | main (int argc, char **argv) |
| int | collect_wait (const char *prog, struct pex_obj *pex) |
| struct pex_obj * | collect_execute (const char *prog, char **argv, const char *outname, const char *errname) |
| 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 |
| const char * | lderrout |
| 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 |
| static struct path_prefix cpath | path |
| static long | sequence_number = 0 |
| #define COLLECT |
Definition at line 42 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 125 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 121 of file collect2.c.
| #define DEFAULT_INIT_PRIORITY 65535 |
Definition at line 118 of file collect2.c.
| #define LIBRARY_PATH_ENV "LIBRARY_PATH" |
Definition at line 39 of file collect2.c.
| #define NAME__MAIN "__main" |
Definition at line 114 of file collect2.c.
| #define NM_FLAGS "-n" |
Definition at line 105 of file collect2.c.
| #define OBJECT_FORMAT_NONE |
Definition at line 70 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 161 of file collect2.c.
| static void add_prefix | ( | struct path_prefix * | pprefix, | |
| const char * | prefix | |||
| ) | [static] |
Definition at line 650 of file collect2.c.
References len, path_prefix::max_len, prefix_list::next, pl, path_prefix::plist, prefix_list::prefix, prev, strlen(), XNEW, and xstrdup().
Definition at line 1600 of file collect2.c.
References head::first, free(), head::last, id::name, id::next, head::number, id::sequence, strcmp(), strcpy, strlen(), and xcalloc().
| struct pex_obj* collect_execute | ( | const char * | prog, | |
| char ** | argv, | |||
| const char * | outname, | |||
| const char * | errname | |||
| ) | [read] |
Definition at line 1522 of file collect2.c.
References debug, err, errno, fatal(), fatal_perror(), fflush(), fprintf(), notice(), NULL, pex, pex_init(), PEX_LAST, pex_run(), PEX_SEARCH, str, and vflag.
| void collect_exit | ( | int | status | ) |
Definition at line 277 of file collect2.c.
References c_file, dump_file, exit(), lderrout, ldout, maybe_unlink(), and o_file.
Definition at line 1482 of file collect2.c.
References collect_exit(), error(), FATAL_EXIT_CODE, fatal_perror(), pex_free(), pex_get_status(), strsignal(), WCOREDUMP, WEXITSTATUS, WIFEXITED, WIFSIGNALED, and WTERMSIG.
Definition at line 1508 of file collect2.c.
References collect_exit(), collect_wait(), error(), and ret.
Definition at line 440 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_free, obstack_object_size, p, putc(), result, stream, strlen(), strncmp(), temporary_firstobj, temporary_obstack, USER_LABEL_PREFIX, and XOBFINISH.
| void error | ( | const char * | gmsgid, | |
| ... | ||||
| ) |
Definition at line 356 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 410 of file collect2.c.
References c, obstack_1grow, p, temporary_obstack, and XOBFINISH.
| void fancy_abort | ( | const char * | file, | |
| int | line, | |||
| const char * | func | |||
| ) |
| void fatal | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
Definition at line 340 of file collect2.c.
References _, collect_exit(), FATAL_EXIT_CODE, fprintf(), va_end, va_start, and vfprintf().
| void fatal_perror | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
Definition at line 323 of file collect2.c.
References _, collect_exit(), errno, FATAL_EXIT_CODE, fprintf(), va_end, va_start, vfprintf(), and xstrerror().
| int file_exists | ( | const char * | name | ) |
Definition at line 402 of file collect2.c.
References access, R_OK, S_ISREG, stat::st_mode, stat, and strlen().
| static char * find_a_file | ( | struct path_prefix * | pprefix, | |
| const char * | name | |||
| ) | [static] |
Definition at line 569 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 XNEWVEC.
| static void fork_execute | ( | const char * | prog, | |
| char ** | argv | |||
| ) | [static] |
| static void handler | ( | int | signo | ) | [static] |
Definition at line 951 of file run.c.
References cleanup(), do_exit(), error(), RC_SYSTEM_ERROR, and strsignal().
Referenced by alloc_handler(), c_invoke_pragma_handler(), c_register_pragma(), c_register_pragma_with_expansion(), catch_signals(), check_handlers(), check_handlers_1(), cp_parser_handler(), Current_Handler_Count(), expand_end_java_handler(), expand_expr(), generate_bytecode_insns(), generate_classfile(), main(), Mark_Scopes_And_Labels(), Set_Handler_Labels(), verify_jvm_instructions(), WN2C_initialize(), and WN2F_initialize().
| static int is_ctor_dtor | ( | const char * | s | ) | [static] |
Definition at line 506 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 736 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, lderrout, 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(), XCNEWVEC, and xstrdup().
| static void maybe_unlink | ( | const char * | file | ) | [static] |
| void notice | ( | const char * | cmsgid, | |
| ... | ||||
| ) |
| 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 694 of file collect2.c.
References add_prefix(), debug, DIR_SEPARATOR, fprintf(), IS_DIR_SEPARATOR, PATH_SEPARATOR, strcpy, strlen(), strncpy(), and XNEWVEC.
Definition at line 1999 of file collect2.c.
References add_to_list(), buf, constructors, debug, destructors, do_wait(), end, err, errno, fatal(), fatal_perror(), fflush(), fgets(), fprintf(), frame_tables, inf, int, is_ctor_dtor(), ISSPACE, nm_file_name, NM_FLAGS, NULL, PASS_LIB, PASS_SECOND, pex, pex_init(), pex_read_output(), pex_run(), PEX_USE_PIPES, signal(), SIGQUIT, str, vflag, and void.
Definition at line 1649 of file collect2.c.
References extract_init_priority(), head::first, id::name, id::next, NULL, and id::sequence.
Definition at line 1963 of file collect2.c.
References fprintf(), shared_obj, write_c_file_glob(), and write_c_file_stat().
Definition at line 1900 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 1771 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 XNEWVEC.
Definition at line 1757 of file collect2.c.
References fprintf(), id::name, id::next, and id::sequence.
const char* c_file [static] |
Definition at line 182 of file collect2.c.
| const char* c_file_name |
Definition at line 195 of file collect2.c.
struct head constructors [static] |
Definition at line 198 of file collect2.c.
| int debug |
Definition at line 178 of file collect2.c.
const char* demangle_flag [static] |
Definition at line 171 of file collect2.c.
struct head destructors [static] |
Definition at line 199 of file collect2.c.
| int do_collecting = 0 |
Definition at line 136 of file collect2.c.
char * fininame [static] |
Definition at line 196 of file collect2.c.
struct head frame_tables [static] |
Definition at line 203 of file collect2.c.
char* initname [static] |
Definition at line 196 of file collect2.c.
| const char* lderrout |
| const char* ldout |
Definition at line 187 of file collect2.c.
const char* nm_file_name [static] |
Definition at line 190 of file collect2.c.
| int no_demangle |
Definition at line 141 of file collect2.c.
const char* o_file [static] |
Definition at line 183 of file collect2.c.
const char* output_file [static] |
Definition at line 189 of file collect2.c.
struct path_prefix cpath path [static] |
Definition at line 554 of file collect2.c.
int rflag [static] |
Definition at line 169 of file collect2.c.
long sequence_number = 0 [static] |
Definition at line 1595 of file collect2.c.
int shared_obj [static] |
Definition at line 180 of file collect2.c.
const char* strip_file_name [static] |
Definition at line 194 of file collect2.c.
int strip_flag [static] |
Definition at line 170 of file collect2.c.
| char* temporary_firstobj |
Definition at line 206 of file collect2.c.
Definition at line 205 of file collect2.c.
| int vflag |
Definition at line 168 of file collect2.c.
1.5.6