]> gcc.gnu.org Git - gcc.git/blob - gcc/gccspec.c
* doc/install.texi: Note that libada uses autoconf 2.57 also.
[gcc.git] / gcc / gccspec.c
1 /* Specific flags and argument handling of the C front-end.
2 Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
3
4 This file is part of GCC.
5
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
9 version.
10
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to the Free
18 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19 02111-1307, USA. */
20
21 #include "config.h"
22 #include "system.h"
23 #include "coretypes.h"
24 #include "tm.h"
25 #include "gcc.h"
26
27 /* Filter argc and argv before processing by the gcc driver proper. */
28 void
29 lang_specific_driver (int *in_argc ATTRIBUTE_UNUSED,
30 const char *const **in_argv ATTRIBUTE_UNUSED,
31 int *in_added_libraries ATTRIBUTE_UNUSED)
32 {
33 #ifdef ENABLE_SHARED_LIBGCC
34 int i;
35
36 /* The new argument list will be contained in this. */
37 const char **arglist;
38
39 /* True if we should add -shared-libgcc to the command-line. */
40 int shared_libgcc = 0;
41
42 /* The total number of arguments with the new stuff. */
43 int argc;
44
45 /* The argument list. */
46 const char *const *argv;
47
48 argc = *in_argc;
49 argv = *in_argv;
50
51 for (i = 1; i < argc; i++)
52 {
53 if (argv[i][0] == '-')
54 {
55 if (strcmp (argv[i], "-static-libgcc") == 0
56 || strcmp (argv[i], "-static") == 0)
57 return;
58 }
59 else
60 {
61 int len;
62
63 /* If the filename ends in .m or .mi, we are compiling ObjC
64 and want to pass -shared-libgcc. */
65 len = strlen (argv[i]);
66 if ((len > 2 && argv[i][len - 2] == '.' && argv[i][len - 1] == 'm')
67 || (len > 3 && argv[i][len - 3] == '.' && argv[i][len - 2] == 'm'
68 && argv[i][len - 1] == 'i'))
69 shared_libgcc = 1;
70 }
71 }
72
73 if (shared_libgcc)
74 {
75 /* Make sure to have room for the trailing NULL argument. */
76 arglist = xmalloc ((argc+2) * sizeof (char *));
77
78 i = 0;
79 do
80 {
81 arglist[i] = argv[i];
82 i++;
83 }
84 while (i < argc);
85
86 arglist[i++] = "-shared-libgcc";
87
88 arglist[i] = NULL;
89
90 *in_argc = i;
91 *in_argv = arglist;
92 }
93 #endif
94 }
95
96 /* Called before linking. Returns 0 on success and -1 on failure. */
97 int
98 lang_specific_pre_link (void)
99 {
100 return 0; /* Not used for C. */
101 }
102
103 /* Number of extra output files that lang_specific_pre_link may generate. */
104 int lang_specific_extra_outfiles = 0; /* Not used for C. */
105
106 /* Table of language-specific spec functions. */
107 const struct spec_function lang_specific_spec_functions[] =
108 {
109 { 0, 0 }
110 };
This page took 0.038181 seconds and 5 git commands to generate.