]>
Commit | Line | Data |
---|---|---|
08dc830e | 1 | /* Specific flags and argument handling of the C front-end. |
d9d16a19 | 2 | Copyright (C) 1999, 2001, 2003, 2007, 2010 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 | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 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 | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
08dc830e ZW |
19 | |
20 | #include "config.h" | |
21 | #include "system.h" | |
4977bab6 ZW |
22 | #include "coretypes.h" |
23 | #include "tm.h" | |
9257393c | 24 | #include "gcc.h" |
d9d16a19 | 25 | #include "opts.h" |
08dc830e | 26 | |
d9d16a19 | 27 | /* Filter command line before processing by the gcc driver proper. */ |
08dc830e | 28 | void |
d9d16a19 JM |
29 | lang_specific_driver (struct cl_decoded_option **in_decoded_options ATTRIBUTE_UNUSED, |
30 | unsigned int *in_decoded_options_count ATTRIBUTE_UNUSED, | |
0c20a65f | 31 | int *in_added_libraries ATTRIBUTE_UNUSED) |
08dc830e | 32 | { |
d2328a13 GK |
33 | /* Systems which use the NeXT runtime by default should arrange |
34 | for the shared libgcc to be used when -fgnu-runtime is passed | |
35 | through specs. */ | |
36 | #if defined(ENABLE_SHARED_LIBGCC) && ! defined(NEXT_OBJC_RUNTIME) | |
d9d16a19 | 37 | unsigned int i; |
38935c21 FS |
38 | |
39 | /* The new argument list will be contained in this. */ | |
d9d16a19 | 40 | struct cl_decoded_option *new_decoded_options; |
38935c21 FS |
41 | |
42 | /* True if we should add -shared-libgcc to the command-line. */ | |
43 | int shared_libgcc = 0; | |
44 | ||
45 | /* The total number of arguments with the new stuff. */ | |
d9d16a19 | 46 | unsigned int argc; |
38935c21 FS |
47 | |
48 | /* The argument list. */ | |
d9d16a19 | 49 | struct cl_decoded_option *decoded_options; |
38935c21 | 50 | |
d9d16a19 JM |
51 | argc = *in_decoded_options_count; |
52 | decoded_options = *in_decoded_options; | |
38935c21 FS |
53 | |
54 | for (i = 1; i < argc; i++) | |
55 | { | |
d9d16a19 | 56 | switch (decoded_options[i].opt_index) |
38935c21 | 57 | { |
d9d16a19 JM |
58 | case OPT_static_libgcc: |
59 | case OPT_static: | |
60 | return; | |
61 | ||
62 | case OPT_SPECIAL_input_file: | |
63 | { | |
64 | const char *file = decoded_options[i].arg; | |
65 | int len; | |
66 | ||
67 | /* If the filename ends in .m or .mi, we are compiling | |
68 | ObjC and want to pass -shared-libgcc. */ | |
69 | len = strlen (file); | |
70 | if ((len > 2 && file[len - 2] == '.' && file[len - 1] == 'm') | |
71 | || (len > 3 && file[len - 3] == '.' && file[len - 2] == 'm' | |
72 | && file[len - 1] == 'i')) | |
73 | shared_libgcc = 1; | |
74 | } | |
75 | break; | |
38935c21 FS |
76 | } |
77 | } | |
78 | ||
79 | if (shared_libgcc) | |
80 | { | |
d9d16a19 | 81 | new_decoded_options = XNEWVEC (struct cl_decoded_option, argc + 1); |
38935c21 FS |
82 | |
83 | i = 0; | |
84 | do | |
85 | { | |
d9d16a19 | 86 | new_decoded_options[i] = decoded_options[i]; |
38935c21 FS |
87 | i++; |
88 | } | |
89 | while (i < argc); | |
90 | ||
d9d16a19 JM |
91 | generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER, |
92 | &new_decoded_options[i++]); | |
38935c21 | 93 | |
d9d16a19 JM |
94 | *in_decoded_options_count = i; |
95 | *in_decoded_options = new_decoded_options; | |
38935c21 FS |
96 | } |
97 | #endif | |
08dc830e ZW |
98 | } |
99 | ||
dc297297 | 100 | /* Called before linking. Returns 0 on success and -1 on failure. */ |
08dc830e | 101 | int |
0c20a65f | 102 | lang_specific_pre_link (void) |
08dc830e | 103 | { |
dc297297 | 104 | return 0; /* Not used for C. */ |
08dc830e ZW |
105 | } |
106 | ||
dc297297 KH |
107 | /* Number of extra output files that lang_specific_pre_link may generate. */ |
108 | int lang_specific_extra_outfiles = 0; /* Not used for C. */ |