GCC Middle and Back End API Reference
|
Data Structures | |
struct | id |
struct | head |
struct | lto_object |
struct | lto_object_list |
Typedefs | |
typedef int | scanfilter |
Enumerations | |
enum | lto_mode_d { LTO_MODE_NONE, LTO_MODE_LTO, LTO_MODE_WHOPR, LTO_MODE_NONE, LTO_MODE_LTO, LTO_MODE_WHOPR } |
enum | symkind { SYM_REGULAR = 0, SYM_CTOR = 1, SYM_DTOR = 2, SYM_INIT = 3, SYM_FINI = 4, SYM_DWEH = 5 } |
enum | scanpass { PASS_FIRST, PASS_OBJ, PASS_LIB, PASS_SECOND, PASS_LTOINFO } |
enum | scanfilter_masks { SCAN_NOTHING = 0, SCAN_CTOR = 1 << SYM_CTOR, SCAN_DTOR = 1 << SYM_DTOR, SCAN_INIT = 1 << SYM_INIT, SCAN_FINI = 1 << SYM_FINI, SCAN_DWEH = 1 << SYM_DWEH, SCAN_ALL = ~0 } |
Functions | |
static symkind | is_ctor_dtor (const char *) |
static void | handler (int) |
static void | do_wait (const char *, struct pex_obj *) |
static void | fork_execute (const char *, char **) |
static void | maybe_unlink (const char *) |
static void | maybe_unlink_list (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 | dump_list (FILE *, const char *, struct id *) |
static void | dump_prefix_list (FILE *, const char *, struct prefix_list *) |
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_libraries (const char *) |
static int | is_in_list (const char *, struct id *) |
static void | write_aix_file (FILE *, struct id *) |
static char * | resolve_lib_name (const char *) |
static char * | extract_string (const char **) |
static void | post_ld_pass (bool) |
static void | process_args (int *argcp, char **argv) |
static void | scan_prog_file (const char *, scanpass, scanfilter) |
static void | collect_atexit () |
void | notice () |
void | notice_translated () |
static void | handler () |
int | file_exists () |
static char * | extract_string () |
void | dump_ld_file () |
static symkind | is_ctor_dtor () |
static void | add_lto_object () |
static void | maybe_run_lto_and_relink (char **lto_ld_argv, char **object_lst, const char **object, bool force) |
int | main () |
int | collect_wait () |
static void | do_wait () |
struct pex_obj * | collect_execute (const char *prog, char **argv, const char *outname, const char *errname, int flags) |
static void | fork_execute () |
static void | maybe_unlink () |
static void | maybe_unlink_list () |
static void | add_to_list () |
static int | extract_init_priority () |
static void | sort_ids () |
static void | write_list () |
static int | is_in_list () |
static void | dump_list () |
static void | dump_prefix_list () |
static void | write_list_with_asm () |
static void | write_c_file_stat () |
static void | write_c_file_glob () |
static void | write_c_file () |
static void | write_aix_file () |
static bool | maybe_lto_object_file () |
static void | scan_libraries () |
static int | ignore_library (const char *) |
static int | ignore_library () |
char * | ldgetname (LDFILE *, GCC_SYMENT *) |
static char * | resolve_lib_name () |
static void | do_dsymutil (const char *output_file) |
Variables | |
int | do_collecting = 1 |
int | no_demangle |
bool | vflag |
static int | rflag |
static int | strip_flag |
static int | export_flag |
static int | aix64_flag |
static int | aixrtl_flag |
static enum lto_mode_d | lto_mode = LTO_MODE_NONE |
bool | debug |
bool | helpflag |
static int | shared_obj |
static const char * | c_file |
static const char * | o_file |
static const char * | export_file |
static char ** | lto_o_files |
const char * | ldout |
const char * | lderrout |
static const char * | output_file |
static const char * | nm_file_name |
static const char * | ldd_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 | exports |
static struct head | frame_tables |
static bool | at_file_supplied |
static char * | response_file |
struct obstack | temporary_obstack |
char * | temporary_firstobj |
static const char * | target_system_root = TARGET_SYSTEM_ROOT |
bool | may_unlink_output_file = false |
static struct head | libs |
static struct path_prefix | cmdline_lib_dirs |
static struct path_prefix | libpath_lib_dirs |
static struct path_prefix * | libpaths [3] |
static struct lto_object_list | lto_objects |
static struct path_prefix cpath | path |
static const char *const | target_machine = TARGET_MACHINE |
static long | sequence_number = 0 |
static const char *const | aix_std_libs [] |
static int | flag_dsym = false |
static int | flag_idsym = false |
typedef int scanfilter |
This type is used for parameters and variables which hold combinations of the flags in enum scanfilter_masks.
enum lto_mode_d |
enum scanfilter_masks |
enum scanpass |
enum symkind |
|
static |
Search for NAME using prefix list PPREFIX. We only look for executable files. Return 0 if not found, otherwise return its name, allocated with malloc.
Add an entry for the object file NAME to object file list LIST. New entries are added at the end of the list. The original pointer value of NAME is preserved, i.e., no string copy is performed.
References lto_object_list::first, lto_object_list::last, lto_object::name, and lto_object::next.
Referenced by scan_prog_file().
|
static |
Referenced by main(), scan_libraries(), and scan_prog_file().
|
static |
Add a name to a linked list.
References head::first, free(), head::last, id::name, id::next, head::number, id::sequence, sequence_number, and strlen().
|
static |
Delete tempfiles and exit function.
References c_file, dump_ld_file(), export_file, lderrout, ldout, lto_o_files, maybe_unlink(), maybe_unlink_list(), o_file, and response_file.
Referenced by main().
|
read |
Execute a program, and wait for the reply.
References at_file_supplied, debug, errno, fatal_error(), free(), notice(), response_file, and vflag.
Referenced by do_dsymutil(), fork_execute(), maybe_run_lto_and_relink(), run_gcc(), and tlink_execute().
int collect_wait | ( | ) |
Wait for a process to finish, and exit if a nonzero status is found.
References error(), fatal_error(), and strsignal().
Referenced by do_wait(), fork_execute(), run_gcc(), and tlink_execute().
|
static |
References collect_execute(), do_wait(), and output_file.
Referenced by post_ld_pass().
|
static |
Referenced by do_dsymutil(), fork_execute(), maybe_run_lto_and_relink(), scan_libraries(), and scan_prog_file().
|
static |
References collect_wait(), error(), and response_file.
void dump_ld_file | ( | ) |
References free(), no_demangle, strlen(), temporary_firstobj, and temporary_obstack.
Referenced by collect_atexit(), and do_tlink().
|
static |
|
static |
References prefix_list::next, and prefix_list::prefix.
|
static |
Referenced by sort_ids().
|
static |
Grab the init priority number from an init function name that looks like "_GLOBAL_.I.12345.foo".
|
static |
Referenced by main().
|
static |
Parse a reasonable subset of shell quoting syntax.
References temporary_obstack.
int file_exists | ( | ) |
Referenced by read_repo_files(), and resolve_lib_name().
|
static |
Referenced by main(), and maybe_run_lto_and_relink().
|
static |
References collect_execute(), and do_wait().
|
static |
|
static |
References c_file, export_file, lderrout, ldout, lto_o_files, maybe_unlink(), maybe_unlink_list(), o_file, and response_file.
|
static |
This function checks the filename and returns 1 if this name matches the location of a standard AIX library.
|
static |
References strlen(), and target_system_root.
|
static |
Referenced by scan_prog_file().
|
static |
|
static |
|
static |
char* ldgetname | ( | LDFILE * | , |
GCC_SYMENT * | |||
) |
int main | ( | ) |
Main program.
References add_prefix(), add_to_list(), aix64_flag, aixrtl_flag, at_file_supplied, atexit(), bug_report_url, c_file, c_file_name, cmdline_lib_dirs, collect_atexit(), constructors, debug, destructors, diagnostic_initialize(), do_collecting, do_tlink(), dump_list(), error(), export_file, export_flag, exports, extract_string(), fatal_error(), find_a_file(), find_file_set_debug(), fininame, head::first, fork_execute(), frame_tables, gcc_init_libintl(), getenv(), global_dc, handler(), helpflag, initname, ldd_file_name, lderrout, ldout, len, libpath_lib_dirs, libs, lto_mode, LTO_MODE_LTO, LTO_MODE_NONE, LTO_MODE_WHOPR, maybe_run_lto_and_relink(), maybe_unlink(), id::name, id::next, nm_file_name, no_demangle, notice(), notice_translated(), head::number, o_file, output_file, PASS_FIRST, PASS_OBJ, PASS_SECOND, path, post_ld_pass(), prefix_from_env(), process_args(), progname, resolve_lib_name(), rflag, SCAN_ALL, SCAN_DWEH, scan_libraries(), SCAN_NOTHING, scan_prog_file(), shared_obj, sort_ids(), strip_file_name, strip_flag, strlen(), target_system_root, temporary_firstobj, temporary_obstack, version_string, vflag, write_aix_file(), and write_c_file().
|
static |
Check to make sure the file is an LTO object file.
Referenced by scan_prog_file().
|
static |
Perform a link-time recompilation and relink if any of the object files contain LTO info. The linker command line LTO_LD_ARGV represents the linker command that would produce a final executable without the use of LTO. OBJECT_LST is a vector of object file names appearing in LTO_LD_ARGV that are to be considered for link-time recompilation, where OBJECT is a pointer to the last valid element. (This awkward convention avoids an impedance mismatch with the usage of similarly-named variables in main().) The elements of OBJECT_LST must be identical, i.e., pointer equal, to the corresponding arguments in LTO_LD_ARGV. Upon entry, at least one linker run has been performed without the use of any LTO info that might be present. Any recompilations necessary for template instantiations have been performed, and initializer/finalizer tables have been created if needed and included in the linker command line LTO_LD_ARGV. If any of the object files contain LTO info, we run the LTO back end on all such files, and perform the final link with the LTO back end output substituted for the LTO-optimized files. In some cases, a final link with all link-time generated code has already been performed, so there is no need to relink if no LTO info is found. In other cases, our caller has not produced the final executable, and is relying on us to perform the required link whether LTO info is present or not. In that case, the FORCE argument should be true. Note that the linker command line argument LTO_LD_ARGV passed into this function may be modified in place.
References collect_execute(), do_wait(), fatal_error(), lto_object_list::first, fork_execute(), free(), getenv(), lto_o_files, lto_objects, maybe_unlink_list(), lto_object::name, lto_object::next, PASS_LTOINFO, post_ld_pass(), SCAN_ALL, scan_prog_file(), temporary_firstobj, and temporary_obstack.
Referenced by main().
|
static |
Referenced by collect_atexit(), handler(), main(), and maybe_unlink_list().
|
static |
Unlink FILE unless we are debugging or this is the output_file and we may not unlink it.
References debug, may_unlink_output_file, notice(), and output_file.
|
static |
Referenced by collect_atexit(), handler(), and maybe_run_lto_and_relink().
|
static |
Call maybe_unlink on the NULL-terminated list, FILE_LIST.
References maybe_unlink().
void notice | ( | ) |
Notify user of a non-error.
Referenced by collect_execute(), main(), maybe_unlink(), scan_libraries(), and write_c_file_stat().
void notice_translated | ( | ) |
Notify user of a non-error, without translating the format string.
Referenced by main().
|
static |
References do_dsymutil(), and output_file.
Referenced by main(), and maybe_run_lto_and_relink().
|
static |
Referenced by main(), print_usage(), and ref_maybe_used_by_call_p_1().
|
static |
Referenced by main().
|
static |
Given a library name without "lib" prefix, this function returns a full library name including a path.
References aixrtl_flag, debug, fatal_error(), file_exists(), path_prefix::max_len, prefix_list::next, path_prefix::plist, prefix_list::prefix, and strlen().
|
static |
Referenced by main().
|
static |
Use the List Dynamic Dependencies program to find shared libraries that the output file depends upon and their initialization/finalization routines, if any.
References add_to_list(), debug, do_wait(), errno, error(), fatal_error(), head::first, ldd_file_name, id::name, id::next, notice(), PASS_LIB, SCAN_ALL, scan_prog_file(), and vflag.
|
static |
Scan the name list of the loaded program for the symbols g++ uses for static constructors and destructors. The SCANPASS argument tells which collect processing pass this is for and the SCANFILTER argument tells which kinds of symbols to consider in this pass. Symbols of a special kind not in the filter mask are considered as regular ones. The constructor table begins at __CTOR_LIST__ and contains a count of the number of pointers (or -1 if the constructors are built in a separate section by the linker), followed by the pointers to the constructor functions, terminated with a null pointer. The destructor table has the same format, and begins at __DTOR_LIST__.
Generic version to scan the name list of the loaded program for the symbols g++ uses for static constructors and destructors.
COFF version to scan the name list of the loaded program for the symbols g++ uses for static constructors and destructors.
References add_lto_object(), add_to_list(), constructors, debug, destructors, do_wait(), errno, fatal_error(), frame_tables, is_ctor_dtor(), lto_objects, maybe_lto_object_file(), nm_file_name, PASS_LIB, PASS_LTOINFO, PASS_SECOND, SCAN_CTOR, SCAN_DTOR, SCAN_DWEH, SCAN_FINI, SCAN_INIT, SYM_CTOR, SYM_DTOR, SYM_DWEH, SYM_FINI, SYM_INIT, and vflag.
Referenced by main(), maybe_run_lto_and_relink(), and scan_libraries().
|
static |
Insertion sort the ids from ctor/dtor list HEAD_PTR in descending order. ctors will be run from right to left, dtors from left to right.
References extract_init_priority(), head::first, id::name, id::next, id::sequence, and sequence_number.
|
static |
Referenced by main().
|
static |
References shared_obj, write_c_file_glob(), and write_c_file_stat().
|
static |
Referenced by write_c_file().
|
static |
Write the constructor/destructor tables.
References constructors, destructors, head::first, frame_tables, head::number, write_list(), and write_list_with_asm().
|
static |
Referenced by write_c_file().
|
static |
Write out the constructor and destructor tables statically (for a shared object), along with the functions to execute them.
References constructors, debug, destructors, fininame, head::first, frame_tables, free(), initname, notice(), head::number, output_file, shared_obj, strlen(), write_list(), and write_list_with_asm().
|
static |
Referenced by write_c_file_glob(), and write_c_file_stat().
|
static |
Write: `prefix', the names on list LIST, `suffix'.
References id::next, and id::sequence.
|
static |
Referenced by write_c_file_glob(), and write_c_file_stat().
|
static |
References id::name, id::next, and id::sequence.
|
static |
Referenced by main().
|
static |
Array of standard AIX libraries which should not be scanned for ctors/dtors.
|
static |
Referenced by main(), and resolve_lib_name().
|
static |
Referenced by collect_execute(), and main().
|
static |
Referenced by collect_atexit(), handler(), and main().
const char* c_file_name |
Referenced by main(), and recompile_files().
|
static |
Referenced by main().
|
static |
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
DEBUG_FUNCTION void debug |
Dump expression REF.
Dump a rtx vector REF.
Unified dump function for a DATA_REFERENCE structure.
Generic dump for the above.
Referenced by collect_execute(), debug_body(), debug_head(), find_a_file(), find_file_set_debug(), main(), maybe_default_option(), maybe_unlink(), maybe_unlink_file(), prefix_from_string(), remove_forwarder_block(), rename_ssa_copies(), resolve_lib_name(), run_gcc(), scan_libraries(), scan_prog_file(), tlink_init(), and write_c_file_stat().
|
static |
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
int do_collecting = 1 |
Referenced by main().
|
static |
Referenced by collect_atexit(), handler(), and main().
|
static |
Referenced by main().
|
static |
Referenced by main(), and write_c_file_stat().
|
static |
|
static |
|
static |
Referenced by main(), scan_prog_file(), write_c_file_glob(), and write_c_file_stat().
bool helpflag |
Referenced by main().
|
static |
Referenced by main(), and write_c_file_stat().
|
static |
Referenced by main(), and scan_libraries().
const char* lderrout |
Referenced by collect_atexit(), do_tlink(), handler(), and main().
const char* ldout |
Referenced by collect_atexit(), do_tlink(), handler(), and main().
|
static |
Referenced by main().
|
static |
|
static |
Lists to keep libraries to be scanned for global constructors/destructors.
Referenced by main().
|
static |
Current LTO mode.
Referenced by main().
|
static |
Referenced by collect_atexit(), handler(), and maybe_run_lto_and_relink().
|
static |
Referenced by maybe_run_lto_and_relink(), and scan_prog_file().
bool may_unlink_output_file = false |
Whether we may unlink the output file, which should be set as soon as we know we have successfully produced it. This is typically useful to prevent blindly attempting to unlink a read-only output that the target linker would leave untouched.
Referenced by do_tlink(), and maybe_unlink().
|
static |
Referenced by main(), and scan_prog_file().
int no_demangle |
Nonzero if we should suppress the automatic demangling of identifiers in linker error messages. Set from COLLECT_NO_DEMANGLE.
Referenced by dump_ld_file(), and main().
|
static |
Referenced by collect_atexit(), handler(), and main().
|
static |
Referenced by do_dsymutil(), main(), maybe_unlink(), post_ld_pass(), and write_c_file_stat().
|
static |
We maintain two prefix lists: one from COMPILER_PATH environment variable and one from the PATH variable.
Referenced by add_env_var_paths(), add_path(), base_of_path(), file_at_path(), for_each_path(), get_loop_hot_path(), is_directory(), main(), match_rtx(), matches_main_base(), output_file_names(), read_state(), read_state_fileloc(), thread_across_edge(), tree_estimate_loop_size(), and write_match_code_switch().
|
static |
Referenced by collect_atexit(), collect_execute(), do_wait(), and handler().
|
static |
Referenced by main().
|
static |
Referenced by add_to_list(), and sort_ids().
|
static |
Referenced by main(), write_c_file(), and write_c_file_stat().
|
static |
Referenced by main().
|
static |
Referenced by main().
|
static |
This is the name of the target machine. We use it to form the name of the files to execute.
|
static |
A string that must be prepended to a target OS path in order to find it on the host system.
Referenced by ignore_library(), and main().
char* temporary_firstobj |
Referenced by dump_ld_file(), main(), maybe_run_lto_and_relink(), read_repo_file(), recompile_files(), and scan_linker_output().
struct obstack temporary_obstack |
Referenced by dump_ld_file(), extract_string(), frob_extension(), main(), maybe_run_lto_and_relink(), read_repo_file(), recompile_files(), scan_linker_output(), and tfgets().
bool vflag |
Referenced by collect_execute(), main(), scan_libraries(), scan_prog_file(), and tlink_init().