]>
Commit | Line | Data |
---|---|---|
08dc830e | 1 | /* Specific flags and argument handling of the C front-end. |
38935c21 | 2 | Copyright (C) 1999, 2001 Free Software Foundation, Inc. |
08dc830e | 3 | |
1322177d | 4 | This file is part of GCC. |
08dc830e | 5 | |
1322177d LB |
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. | |
08dc830e | 10 | |
1322177d LB |
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. | |
08dc830e ZW |
15 | |
16 | You should have received a copy of the GNU General Public License | |
1322177d LB |
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. */ | |
08dc830e ZW |
20 | |
21 | #include "config.h" | |
22 | #include "system.h" | |
9257393c | 23 | #include "gcc.h" |
08dc830e | 24 | |
dc297297 | 25 | /* Filter argc and argv before processing by the gcc driver proper. */ |
08dc830e | 26 | void |
9257393c | 27 | lang_specific_driver (in_argc, in_argv, in_added_libraries) |
08dc830e | 28 | int *in_argc ATTRIBUTE_UNUSED; |
37620334 | 29 | const char *const **in_argv ATTRIBUTE_UNUSED; |
08dc830e ZW |
30 | int *in_added_libraries ATTRIBUTE_UNUSED; |
31 | { | |
38935c21 FS |
32 | #ifdef ENABLE_SHARED_LIBGCC |
33 | int i; | |
34 | ||
35 | /* The new argument list will be contained in this. */ | |
36 | const char **arglist; | |
37 | ||
38 | /* True if we should add -shared-libgcc to the command-line. */ | |
39 | int shared_libgcc = 0; | |
40 | ||
41 | /* The total number of arguments with the new stuff. */ | |
42 | int argc; | |
43 | ||
44 | /* The argument list. */ | |
45 | const char *const *argv; | |
46 | ||
47 | argc = *in_argc; | |
48 | argv = *in_argv; | |
49 | ||
50 | for (i = 1; i < argc; i++) | |
51 | { | |
52 | if (argv[i][0] == '-') | |
53 | { | |
54 | if (strcmp (argv[i], "-static-libgcc") == 0 | |
55 | || strcmp (argv[i], "-static") == 0) | |
56 | return; | |
57 | } | |
58 | else | |
59 | { | |
60 | int len; | |
61 | ||
62 | /* If the filename ends in .m or .mi, we are compiling ObjC | |
63 | and want to pass -shared-libgcc. */ | |
64 | len = strlen (argv[i]); | |
65 | if ((len > 2 && argv[i][len - 2] == '.' && argv[i][len - 1] == 'm') | |
66 | || (len > 3 && argv[i][len - 3] == '.' && argv[i][len - 2] == 'm' | |
67 | && argv[i][len - 1] == 'i')) | |
68 | shared_libgcc = 1; | |
69 | } | |
70 | } | |
71 | ||
72 | if (shared_libgcc) | |
73 | { | |
74 | /* Make sure to have room for the trailing NULL argument. */ | |
75 | arglist = (const char **) xmalloc ((argc+2) * sizeof (char *)); | |
76 | ||
77 | i = 0; | |
78 | do | |
79 | { | |
80 | arglist[i] = argv[i]; | |
81 | i++; | |
82 | } | |
83 | while (i < argc); | |
84 | ||
85 | arglist[i++] = "-shared-libgcc"; | |
86 | ||
87 | arglist[i] = NULL; | |
88 | ||
89 | *in_argc = i; | |
90 | *in_argv = arglist; | |
91 | } | |
92 | #endif | |
08dc830e ZW |
93 | } |
94 | ||
dc297297 | 95 | /* Called before linking. Returns 0 on success and -1 on failure. */ |
08dc830e ZW |
96 | int |
97 | lang_specific_pre_link () | |
98 | { | |
dc297297 | 99 | return 0; /* Not used for C. */ |
08dc830e ZW |
100 | } |
101 | ||
dc297297 KH |
102 | /* Number of extra output files that lang_specific_pre_link may generate. */ |
103 | int lang_specific_extra_outfiles = 0; /* Not used for C. */ |