lexsup.c
来自「基于4个mips核的noc设计」· C语言 代码 · 共 1,283 行 · 第 1/3 页
C
1,283 行
sprintf (buf, "%s:%s", command_line.rpath_link, optarg); free (command_line.rpath_link); command_line.rpath_link = buf; } break; case OPTION_RELAX: command_line.relax = true; break; case OPTION_RETAIN_SYMBOLS_FILE: add_keepsyms_file (optarg); break; case 'S': link_info.strip = strip_debugger; break; case 's': link_info.strip = strip_all; break; case OPTION_SHARED: if (config.has_shared) link_info.shared = true; else einfo (_("%P%F: -shared not supported\n")); break; case 'h': /* Used on Solaris. */ case OPTION_SONAME: command_line.soname = optarg; break; case OPTION_SORT_COMMON: config.sort_common = true; break; case OPTION_STATS: config.stats = true; break; case OPTION_SYMBOLIC: link_info.symbolic = true; break; case 't': trace_files = true; break; case 'T': ldfile_open_command_file (optarg); parser_input = input_script; yyparse (); break; case OPTION_SECTION_START: { char *optarg2; char *sec_name; int len; /* Check for <something>=<somthing>... */ optarg2 = strchr (optarg, '='); if (optarg2 == NULL) { fprintf (stderr, _("%s: Invalid argument to option \"--section-start\"\n"), program_name); xexit (1); } optarg2++; /* So far so good. Are all the args present? */ if ((*optarg == '\0') || (*optarg2 == '\0')) { fprintf (stderr, _("%s: Missing argument(s) to option \"--section-start\"\n"), program_name); xexit (1); } /* We must copy the section name as set_section_start doesn't do it for us. */ len = optarg2 - optarg; sec_name = xmalloc (len); memcpy (sec_name, optarg, len - 1); sec_name[len - 1] = 0; /* Then set it... */ set_section_start (sec_name, optarg2); } break; case OPTION_TARGET_HELP: /* Mention any target specific options. */ ldemul_list_emulation_options (stdout); exit (0); case OPTION_TBSS: set_section_start (".bss", optarg); break; case OPTION_TDATA: set_section_start (".data", optarg); break; case OPTION_TTEXT: set_section_start (".text", optarg); break; case OPTION_TRADITIONAL_FORMAT: link_info.traditional_format = true; break; case OPTION_TASK_LINK: link_info.task_link = true; /* Fall through - do an implied -r option. */ case OPTION_UR: link_info.relocateable = true; config.build_constructors = true; config.magic_demand_paged = false; config.text_read_only = false; config.dynamic_link = false; break; case 'u': ldlang_add_undef (optarg); break; case OPTION_UNIQUE: if (optarg != NULL) lang_add_unique (optarg); else config.unique_orphan_sections = true; break; case OPTION_VERBOSE: ldversion (1); version_printed = true; trace_file_tries = true; break; case 'v': ldversion (0); version_printed = true; break; case 'V': ldversion (1); version_printed = true; break; case OPTION_VERSION: /* This output is intended to follow the GNU standards document. */ printf ("GNU ld %s\n", ld_program_version); printf (_("Copyright 2001 Free Software Foundation, Inc.\n")); printf (_("\This program is free software; you may redistribute it under the terms of\n\the GNU General Public License. This program has absolutely no warranty.\n")); { ld_emulation_xfer_type **ptr = ld_emulations; printf (_(" Supported emulations:\n")); while (*ptr) { printf (" %s\n", (*ptr)->emulation_name); ptr++; } } xexit (0); break; case OPTION_VERSION_SCRIPT: /* This option indicates a small script that only specifies version information. Read it, but don't assume that we've seen a linker script. */ { boolean hold_had_script; hold_had_script = had_script; ldfile_open_command_file (optarg); had_script = hold_had_script; parser_input = input_version_script; yyparse (); } break; case OPTION_VERSION_EXPORTS_SECTION: /* This option records a version symbol to be applied to the symbols listed for export to be found in the object files .exports sections. */ command_line.version_exports_section = optarg; break; case OPTION_WARN_COMMON: config.warn_common = true; break; case OPTION_WARN_CONSTRUCTORS: config.warn_constructors = true; break; case OPTION_WARN_MULTIPLE_GP: config.warn_multiple_gp = true; break; case OPTION_WARN_ONCE: config.warn_once = true; break; case OPTION_WARN_SECTION_ALIGN: config.warn_section_align = true; break; case OPTION_WHOLE_ARCHIVE: whole_archive = true; break; case OPTION_WRAP: add_wrap (optarg); break; case 'X': link_info.discard = discard_l; break; case 'x': link_info.discard = discard_all; break; case 'Y': if (strncmp (optarg, "P,", 2) == 0) optarg += 2; default_dirlist = xstrdup (optarg); break; case 'y': add_ysym (optarg); break; case OPTION_SPLIT_BY_RELOC: if (optarg != NULL) config.split_by_reloc = strtoul (optarg, NULL, 0); else config.split_by_reloc = 32768; break; case OPTION_SPLIT_BY_FILE: if (optarg != NULL) config.split_by_file = bfd_scan_vma (optarg, NULL, 0); else config.split_by_file = 1; break; case OPTION_CHECK_SECTIONS: command_line.check_section_addresses = true; break; case OPTION_NO_CHECK_SECTIONS: command_line.check_section_addresses = false; break; case '(': if (ingroup) { fprintf (stderr, _("%s: may not nest groups (--help for usage)\n"), program_name); xexit (1); } lang_enter_group (); ingroup = 1; break; case ')': if (! ingroup) { fprintf (stderr, _("%s: group ended before it began (--help for usage)\n"), program_name); xexit (1); } lang_leave_group (); ingroup = 0; break; case OPTION_MPC860C0: link_info.mpc860c0 = 20; /* default value (in bytes) */ if (optarg) { unsigned words; words = is_num (optarg, 1, 10, 0); if (words == 0) { fprintf (stderr, _("%s: Invalid argument to option \"mpc860c0\"\n"), program_name); xexit (1); } link_info.mpc860c0 = words * 4; /* convert words to bytes */ } command_line.relax = true; break; case OPTION_INIT: link_info.init_function = optarg; break; case OPTION_FINI: link_info.fini_function = optarg; break; } } if (ingroup) lang_leave_group (); if (default_dirlist != NULL) set_default_dirlist (default_dirlist);}/* Add the (colon-separated) elements of DIRLIST_PTR to the library search path. */static voidset_default_dirlist (dirlist_ptr) char *dirlist_ptr;{ char *p; while (1) { p = strchr (dirlist_ptr, PATH_SEPARATOR); if (p != NULL) *p = '\0'; if (*dirlist_ptr != '\0') ldfile_add_library_path (dirlist_ptr, true); if (p == NULL) break; dirlist_ptr = p + 1; }}static voidset_section_start (sect, valstr) char *sect, *valstr;{ const char *end; bfd_vma val = bfd_scan_vma (valstr, &end, 16); if (*end) einfo (_("%P%F: invalid hex number `%s'\n"), valstr); lang_section_start (sect, exp_intop (val));}/* Print help messages for the options. */static voidhelp (){ unsigned i; const char **targets, **pp; printf (_("Usage: %s [options] file...\n"), program_name); printf (_("Options:\n")); for (i = 0; i < OPTION_COUNT; i++) { if (ld_options[i].doc != NULL) { boolean comma; int len; unsigned j; printf (" "); comma = false; len = 2; j = i; do { if (ld_options[j].shortopt != '\0' && ld_options[j].control != NO_HELP) { printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt); len += (comma ? 2 : 0) + 2; if (ld_options[j].arg != NULL) { if (ld_options[j].opt.has_arg != optional_argument) { printf (" "); ++len; } printf ("%s", _(ld_options[j].arg)); len += strlen (_(ld_options[j].arg)); } comma = true; } ++j; } while (j < OPTION_COUNT && ld_options[j].doc == NULL); j = i; do { if (ld_options[j].opt.name != NULL && ld_options[j].control != NO_HELP) { int two_dashes = (ld_options[j].control == TWO_DASHES || ld_options[j].control == EXACTLY_TWO_DASHES); printf ("%s-%s%s", comma ? ", " : "", two_dashes ? "-" : "", ld_options[j].opt.name); len += ((comma ? 2 : 0) + 1 + (two_dashes ? 1 : 0) + strlen (ld_options[j].opt.name)); if (ld_options[j].arg != NULL) { printf (" %s", _(ld_options[j].arg)); len += 1 + strlen (_(ld_options[j].arg)); } comma = true; } ++j; } while (j < OPTION_COUNT && ld_options[j].doc == NULL); if (len >= 30) { printf ("\n"); len = 0; } for (; len < 30; len++) putchar (' '); printf ("%s\n", _(ld_options[i].doc)); } } /* Note: Various tools (such as libtool) depend upon the format of the listings below - do not change them. */ /* xgettext:c-format */ printf (_("%s: supported targets:"), program_name); targets = bfd_target_list (); for (pp = targets; *pp != NULL; pp++) printf (" %s", *pp); free (targets); printf ("\n"); /* xgettext:c-format */ printf (_("%s: supported emulations: "), program_name); ldemul_list_emulations (stdout); printf ("\n"); /* xgettext:c-format */ printf (_("%s: emulation specific options:\n"), program_name); ldemul_list_emulation_options (stdout); printf ("\n"); printf (_("Report bugs to %s\n"), REPORT_BUGS_TO);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?