0
|
1 /* Specific flags and argument handling of the C front-end.
|
|
2 Copyright (C) 1999, 2001, 2003, 2007 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 3, 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 COPYING3. If not see
|
|
18 <http://www.gnu.org/licenses/>. */
|
|
19
|
|
20 #include "config.h"
|
|
21 #include "system.h"
|
|
22 #include "coretypes.h"
|
|
23 #include "tm.h"
|
|
24 #include "gcc.h"
|
|
25
|
|
26 /* Filter argc and argv before processing by the gcc driver proper. */
|
|
27 void
|
|
28 lang_specific_driver (int *in_argc ATTRIBUTE_UNUSED,
|
|
29 const char *const **in_argv ATTRIBUTE_UNUSED,
|
|
30 int *in_added_libraries ATTRIBUTE_UNUSED)
|
|
31 {
|
|
32 /* Systems which use the NeXT runtime by default should arrange
|
|
33 for the shared libgcc to be used when -fgnu-runtime is passed
|
|
34 through specs. */
|
|
35 #if defined(ENABLE_SHARED_LIBGCC) && ! defined(NEXT_OBJC_RUNTIME)
|
|
36 int i;
|
|
37
|
|
38 /* The new argument list will be contained in this. */
|
|
39 const char **arglist;
|
|
40
|
|
41 /* True if we should add -shared-libgcc to the command-line. */
|
|
42 int shared_libgcc = 0;
|
|
43
|
|
44 /* The total number of arguments with the new stuff. */
|
|
45 int argc;
|
|
46
|
|
47 /* The argument list. */
|
|
48 const char *const *argv;
|
|
49
|
|
50 argc = *in_argc;
|
|
51 argv = *in_argv;
|
|
52
|
|
53 for (i = 1; i < argc; i++)
|
|
54 {
|
|
55 if (argv[i][0] == '-')
|
|
56 {
|
|
57 if (strcmp (argv[i], "-static-libgcc") == 0
|
|
58 || strcmp (argv[i], "-static") == 0)
|
|
59 return;
|
|
60 }
|
|
61 else
|
|
62 {
|
|
63 int len;
|
|
64
|
|
65 /* If the filename ends in .m or .mi, we are compiling ObjC
|
|
66 and want to pass -shared-libgcc. */
|
|
67 len = strlen (argv[i]);
|
|
68 if ((len > 2 && argv[i][len - 2] == '.' && argv[i][len - 1] == 'm')
|
|
69 || (len > 3 && argv[i][len - 3] == '.' && argv[i][len - 2] == 'm'
|
|
70 && argv[i][len - 1] == 'i'))
|
|
71 shared_libgcc = 1;
|
|
72 }
|
|
73 }
|
|
74
|
|
75 if (shared_libgcc)
|
|
76 {
|
|
77 /* Make sure to have room for the trailing NULL argument. */
|
|
78 arglist = XNEWVEC (const char *, argc + 2);
|
|
79
|
|
80 i = 0;
|
|
81 do
|
|
82 {
|
|
83 arglist[i] = argv[i];
|
|
84 i++;
|
|
85 }
|
|
86 while (i < argc);
|
|
87
|
|
88 arglist[i++] = "-shared-libgcc";
|
|
89
|
|
90 arglist[i] = NULL;
|
|
91
|
|
92 *in_argc = i;
|
|
93 *in_argv = arglist;
|
|
94 }
|
|
95 #endif
|
|
96 }
|
|
97
|
|
98 /* Called before linking. Returns 0 on success and -1 on failure. */
|
|
99 int
|
|
100 lang_specific_pre_link (void)
|
|
101 {
|
|
102 return 0; /* Not used for C. */
|
|
103 }
|
|
104
|
|
105 /* Number of extra output files that lang_specific_pre_link may generate. */
|
|
106 int lang_specific_extra_outfiles = 0; /* Not used for C. */
|