⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gcc.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 5 页
字号:
		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\              %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\                      %{!pipe:%g.s} %A\n }}}}"},  {"-",   "%{E:cpp -lang-c %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\	%{C:%{!E:%eGNU C does not support -C without using -E}}\	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\        -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\	%{!undef:%{!ansi:%p} %P} %{trigraphs}\        %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\        %{traditional-cpp:-traditional}\	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\        %i %W{o*}}\    %{!E:%e-E required when input is from standard input}"},  {".m", "@objective-c"},  {"@objective-c",   "cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\	%{C:%{!E:%eGNU C does not support -C without using -E}}\	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d}\        -undef -D__OBJC__ -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\	%{!undef:%{!ansi:%p} %P} %{trigraphs}\        %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\        %{traditional-cpp:-traditional}\	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\        %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",   "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.i} %1 \		   %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a}\		   %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \		   %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \    		   -lang-objc %{gen-decls} \		   %{aux-info*}\		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\              %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\                      %{!pipe:%g.s} %A\n }}}}"},  {".h", "@c-header"},  {"@c-header",   "%{!E:%eCompilation of header file requested} \    cpp %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\	%{C:%{!E:%eGNU C does not support -C without using -E}}\	 %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} \        -undef -D__GNUC__=2 %{ansi:-trigraphs -$ -D__STRICT_ANSI__}\	%{!undef:%{!ansi:%p} %P} %{trigraphs}\        %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\        %{traditional-cpp:-traditional}\	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\        %i %W{o*}"},  {".cc", "@c++"},  {".cxx", "@c++"},  {".C", "@c++"},  {"@c++",   "cpp -lang-c++ %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\	%{C:%{!E:%eGNU C++ does not support -C without using -E}}\	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} \	-undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus \	%{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!undef:%{!ansi:%p} %P}\        %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\        %{traditional-cpp:-traditional} %{trigraphs}\	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\        %i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",   "%{!M:%{!MM:%{!E:cc1plus %{!pipe:%g.i} %1 %2\		   %{!Q:-quiet} -dumpbase %b.cc %{d*} %{m*} %{a}\		   %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} %{traditional}\		   %{v:-version} %{pg:-p} %{p} %{f*} %{+e*}\		   %{aux-info*}\		   %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\		   %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\              %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\		      %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\                      %{!pipe:%g.s} %A\n }}}}"},  {".i", "@cpp-output"},  {"@cpp-output",   "cc1 %i %1 %{!Q:-quiet} %{d*} %{m*} %{a}\	%{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} %{traditional}\	%{v:-version} %{pg:-p} %{p} %{f*}\	%{aux-info*}\	%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\	%{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\    %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\            %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %{!pipe:%g.s} %A\n }"},  {".ii", "@c++-cpp-output"},  {"@c++-cpp-output",   "cc1plus %i %1 %2 %{!Q:-quiet} %{d*} %{m*} %{a}\	    %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} %{traditional}\	    %{v:-version} %{pg:-p} %{p} %{f*} %{+e*}\	    %{aux-info*}\	    %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\	    %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\       %{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\	       %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\	       %{!pipe:%g.s} %A\n }"},  {".s", "@assembler"},  {"@assembler",   "%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\            %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o} %i %A\n }"},  {".S", "@assembler-with-cpp"},  {"@assembler-with-cpp",   "cpp -lang-asm %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %I\	%{C:%{!E:%eGNU C does not support -C without using -E}}\	%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{trigraphs} \        -undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \        %c %{O*:-D__OPTIMIZE__} %{traditional} %{ftraditional:-traditional}\        %{traditional-cpp:-traditional}\	%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*}\        %i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",   "%{!M:%{!MM:%{!E:%{!S:as %{R} %{j} %{J} %{h} %{d2} %a %Y\                    %{c:%W{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%u.o}\		    %{!pipe:%g.s} %A\n }}}}"},  /* Mark end of table */  {0, 0}};/* Number of elements in default_compilers, not counting the terminator.  */static int n_default_compilers  = (sizeof default_compilers / sizeof (struct compiler)) - 1;/* Here is the spec for running the linker, after compiling all files.  *//* -u* was put back because both BSD and SysV seem to support it.  *//* %{static:} simply prevents an error message if the target machine   doesn't handle -static.  */#ifdef LINK_LIBGCC_SPECIAL_1/* Have gcc do the search for libgcc.a, but generate -L options as usual.  */static char *link_command_spec = "\%{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \			%{r} %{s} %{T*} %{t} %{u*} %{x} %{z}\			%{!A:%{!nostdlib:%S}} %{static:}\			%{L*} %D %o %{!nostdlib:%L libgcc.a%s %L %{!A:%E}}\n }}}}}";#else#ifdef LINK_LIBGCC_SPECIAL/* Have gcc do the search for libgcc.a, and don't generate -L options.  */static char *link_command_spec = "\%{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \			%{r} %{s} %{T*} %{t} %{u*} %{x} %{z}\			%{!A:%{!nostdlib:%S}} %{static:}\			%{L*} %o %{!nostdlib:%L libgcc.a%s %L %{!A:%E}}\n }}}}}";#else/* Use -L and have the linker do the search for -lgcc.  */static char *link_command_spec = "\%{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \			%{r} %{s} %{T*} %{t} %{u*} %{x} %{z}\			%{!A:%{!nostdlib:%S}} %{static:}\			%{L*} %D %o %{!nostdlib:%L -lgcc %L %{!A:%E}}\n }}}}}";#endif#endif/* A vector of options to give to the linker.   These options are accumulated by -Xlinker and -Wl,   and substituted into the linker command with %X.  */static int n_linker_options;static char **linker_options;/* A vector of options to give to the assembler.   These options are accumulated by -Wa,   and substituted into the assembler command with %X.  */static int n_assembler_options;static char **assembler_options;/* Read compilation specs from a file named FILENAME,   replacing the default ones.   A suffix which starts with `*' is a definition for   one of the machine-specific sub-specs.  The "suffix" should be   *asm, *cc1, *cpp, *link, *startfile, *signed_char, etc.   The corresponding spec is stored in asm_spec, etc.,   rather than in the `compilers' vector.   Anything invalid in the file is a fatal error.  */static voidread_specs (filename)     char *filename;{  int desc;  struct stat statbuf;  char *buffer;  register char *p;  if (verbose_flag)    fprintf (stderr, "Reading specs from %s\n", filename);  /* Open and stat the file.  */  desc = open (filename, 0, 0);  if (desc < 0)    pfatal_with_name (filename);  if (stat (filename, &statbuf) < 0)    pfatal_with_name (filename);  /* Read contents of file into BUFFER.  */  buffer = xmalloc ((unsigned) statbuf.st_size + 1);  read (desc, buffer, (unsigned) statbuf.st_size);  buffer[statbuf.st_size] = 0;  close (desc);  /* Scan BUFFER for specs, putting them in the vector.  */  p = buffer;  while (1)    {      char *suffix;      char *spec;      char *in, *out, *p1, *p2;      /* Advance P in BUFFER to the next nonblank nocomment line.  */      p = skip_whitespace (p);      if (*p == 0)	break;      /* Find the colon that should end the suffix.  */      p1 = p;      while (*p1 && *p1 != ':' && *p1 != '\n') p1++;      /* The colon shouldn't be missing.  */      if (*p1 != ':')	fatal ("specs file malformed after %d characters", p1 - buffer);      /* Skip back over trailing whitespace.  */      p2 = p1;      while (p2 > buffer && (p2[-1] == ' ' || p2[-1] == '\t')) p2--;      /* Copy the suffix to a string.  */      suffix = save_string (p, p2 - p);      /* Find the next line.  */      p = skip_whitespace (p1 + 1);      if (p[1] == 0)	fatal ("specs file malformed after %d characters", p - buffer);      p1 = p;      /* Find next blank line.  */      while (*p1 && !(*p1 == '\n' && p1[1] == '\n')) p1++;      /* Specs end at the blank line and do not include the newline.  */      spec = save_string (p, p1 - p);      p = p1;      /* Delete backslash-newline sequences from the spec.  */      in = spec;      out = spec;      while (*in != 0)	{	  if (in[0] == '\\' && in[1] == '\n')	    in += 2;	  else if (in[0] == '#')	    {	      while (*in && *in != '\n') in++;	    }	  else	    *out++ = *in++;	}      *out = 0;      if (suffix[0] == '*')	{	  if (! strcmp (suffix, "*link_command"))	    link_command_spec = spec;	  else	    set_spec (suffix + 1, spec);	}      else	{	  /* Add this pair to the vector.  */	  compilers	    = ((struct compiler *)	       xrealloc (compilers, (n_compilers + 2) * sizeof (struct compiler)));	  compilers[n_compilers].suffix = suffix;	  bzero (compilers[n_compilers].spec,		 sizeof compilers[n_compilers].spec);	  compilers[n_compilers].spec[0] = spec;	  n_compilers++;	}      if (*suffix == 0)	link_command_spec = spec;    }  if (link_command_spec == 0)    fatal ("spec file has no spec for linking");}static char *skip_whitespace (p)     char *p;{  while (1)    {      /* A fully-blank line is a delimiter in the SPEC file and shouldn't	 be considered whitespace.  */      if (p[0] == '\n' && p[1] == '\n' && p[2] == '\n')	return p + 1;      else if (*p == '\n' || *p == ' ' || *p == '\t')	p++;      else if (*p == '#')	{	  while (*p != '\n') p++;	  p++;	}      else	break;    }  return p;}/* Structure to keep track of the specs that have been defined so far.  These   are accessed using %(specname) or %[specname] in a compiler or link spec. */struct spec_list{  char *name;                 /* Name of the spec. */  char *spec;                 /* The spec itself. */  struct spec_list *next;     /* Next spec in linked list. */};/* List of specs that have been defined so far. */static struct spec_list *specs = (struct spec_list *) 0;/* Change the value of spec NAME to SPEC.  If SPEC is empty, then the spec is   removed; If the spec starts with a + then SPEC is added to the end of the   current spec. */static voidset_spec (name, spec)     char *name;     char *spec;{  struct spec_list *sl;  char *old_spec;  /* See if the spec already exists */  for (sl = specs; sl; sl = sl->next)    if (strcmp (sl->name, name) == 0)      break;  if (!sl)    {      /* Not found - make it */      sl = (struct spec_list *) xmalloc (sizeof (struct spec_list));      sl->name = save_string (name, strlen (name));      sl->spec = save_string ("", 0);      sl->next = specs;      specs = sl;    }  old_spec = sl->spec;  if (name && spec[0] == '+' && isspace (spec[1]))    sl->spec = concat (old_spec, spec + 1, "");  else    sl->spec = save_string (spec, strlen (spec));  if (! strcmp (name, "asm"))    asm_spec = sl->spec;  else if (! strcmp (name, "asm_final"))    asm_final_spec = sl->spec;  else if (! strcmp (name, "cc1"))    cc1_spec = sl->spec;  else if (! strcmp (name, "cc1plus"))    cc1plus_spec = sl->spec;  else if (! strcmp (name, "cpp"))    cpp_spec = sl->spec;  else if (! strcmp (name, "endfile"))    endfile_spec = sl->spec;  else if (! strcmp (name, "lib"))    lib_spec = sl->spec;  else if (! strcmp (name, "link"))    link_spec = sl->spec;  else if (! strcmp (name, "predefines"))    cpp_predefines = sl->spec;  else if (! strcmp (name, "signed_char"))    signed_char_spec = sl->spec;  else if (! strcmp (name, "startfile"))    startfile_spec = sl->spec;  else if (! strcmp (name, "switches_need_spaces"))    switches_need_spaces = sl->spec;  else if (! strcmp (name, "cross_compile"))    cross_compile = atoi (sl->spec);  /* Free the old spec */  if (old_spec)    free (old_spec);}/* Accumulate a command (program name and args), and run it.  *//* Vector of pointers to arguments in the current line of specifications.  */static char **argbuf;/* Number of elements allocated in argbuf.  */static int argbuf_length;/* Number of elements in argbuf currently in use (containing args).  */static int argbuf_index;/* This is the list of suffixes and codes (%g/%u/%U) and the associated   temp file.  Used only if MKTEMP_EACH_FILE.  */static struct temp_name {  char *suffix;		/* suffix associated with the code.  */  int length;		/* strlen (suffix).  */  int unique;		/* Indicates whether %g or %u/%U was used.  */  char *filename;	/* associated filename.  */  int filename_length;	/* strlen (filename).  */  struct temp_name *next;} *temp_names;/* Number of commands executed so far.  */static int execution_count;/* Number of commands that exited with a signal.  */static int signal_count;/* Name with which this program was invoked.  */static char *programname;/* Structures to keep track of prefixes to try when looking for files. */struct prefix_list{  char *prefix;               /* String to prepend to the path. */  struct prefix_list *next;   /* Next in linked list. */  int require_machine_suffix; /* Don't use without machine_suffix.  */  /* 2 means try both machine_suffix and just_machine_suffix.  */  int *used_flag_ptr;	      /* 1 if a file was found with this prefix.  */};struct path_prefix{  struct prefix_list *plist;  /* List of prefixes to try */  int max_len;                /* Max length of a prefix in PLIST */  char *name;                 /* Name of this list (used in config stuff) */};/* List of prefixes to try when looking for executables. */static struct path_prefix exec_prefix = { 0, 0, "exec" };/* List of prefixes to try when looking for startup (crt0) files. */static struct path_prefix startfile_prefix = { 0, 0, "startfile" };/* List of prefixes to try when looking for libraries. */static struct path_prefix library_prefix = { 0, 0, "libraryfile" };

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -