]>
Commit | Line | Data |
---|---|---|
08dc830e | 1 | /* Specific flags and argument handling of the C front-end. |
8d9254fc | 2 | Copyright (C) 1999-2020 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" | |
d9d16a19 | 24 | #include "opts.h" |
08dc830e | 25 | |
d9d16a19 | 26 | /* Filter command line before processing by the gcc driver proper. */ |
08dc830e | 27 | void |
d9d16a19 JM |
28 | lang_specific_driver (struct cl_decoded_option **in_decoded_options ATTRIBUTE_UNUSED, |
29 | unsigned int *in_decoded_options_count ATTRIBUTE_UNUSED, | |
0c20a65f | 30 | int *in_added_libraries ATTRIBUTE_UNUSED) |
08dc830e | 31 | { |
d2328a13 GK |
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. */ | |
fea3ca91 | 35 | #if defined(ENABLE_SHARED_LIBGCC) && ! NEXT_OBJC_RUNTIME |
d9d16a19 | 36 | unsigned int i; |
38935c21 FS |
37 | |
38 | /* The new argument list will be contained in this. */ | |
d9d16a19 | 39 | struct cl_decoded_option *new_decoded_options; |
38935c21 FS |
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. */ | |
d9d16a19 | 45 | unsigned int argc; |
38935c21 FS |
46 | |
47 | /* The argument list. */ | |
d9d16a19 | 48 | struct cl_decoded_option *decoded_options; |
38935c21 | 49 | |
d9d16a19 JM |
50 | argc = *in_decoded_options_count; |
51 | decoded_options = *in_decoded_options; | |
38935c21 FS |
52 | |
53 | for (i = 1; i < argc; i++) | |
54 | { | |
d9d16a19 | 55 | switch (decoded_options[i].opt_index) |
38935c21 | 56 | { |
d9d16a19 JM |
57 | case OPT_static_libgcc: |
58 | case OPT_static: | |
59 | return; | |
60 | ||
61 | case OPT_SPECIAL_input_file: | |
62 | { | |
63 | const char *file = decoded_options[i].arg; | |
64 | int len; | |
65 | ||
66 | /* If the filename ends in .m or .mi, we are compiling | |
67 | ObjC and want to pass -shared-libgcc. */ | |
68 | len = strlen (file); | |
69 | if ((len > 2 && file[len - 2] == '.' && file[len - 1] == 'm') | |
70 | || (len > 3 && file[len - 3] == '.' && file[len - 2] == 'm' | |
71 | && file[len - 1] == 'i')) | |
72 | shared_libgcc = 1; | |
73 | } | |
74 | break; | |
38935c21 FS |
75 | } |
76 | } | |
77 | ||
78 | if (shared_libgcc) | |
79 | { | |
d9d16a19 | 80 | new_decoded_options = XNEWVEC (struct cl_decoded_option, argc + 1); |
38935c21 FS |
81 | |
82 | i = 0; | |
83 | do | |
84 | { | |
d9d16a19 | 85 | new_decoded_options[i] = decoded_options[i]; |
38935c21 FS |
86 | i++; |
87 | } | |
88 | while (i < argc); | |
89 | ||
d9d16a19 JM |
90 | generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER, |
91 | &new_decoded_options[i++]); | |
38935c21 | 92 | |
d9d16a19 JM |
93 | *in_decoded_options_count = i; |
94 | *in_decoded_options = new_decoded_options; | |
38935c21 FS |
95 | } |
96 | #endif | |
08dc830e ZW |
97 | } |
98 | ||
dc297297 | 99 | /* Called before linking. Returns 0 on success and -1 on failure. */ |
08dc830e | 100 | int |
0c20a65f | 101 | lang_specific_pre_link (void) |
08dc830e | 102 | { |
dc297297 | 103 | return 0; /* Not used for C. */ |
08dc830e ZW |
104 | } |
105 | ||
dc297297 KH |
106 | /* Number of extra output files that lang_specific_pre_link may generate. */ |
107 | int lang_specific_extra_outfiles = 0; /* Not used for C. */ |