annotate gcc/c/gccspec.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Specific flags and argument handling of the C front-end.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 1999-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #include "config.h"
kono
parents:
diff changeset
21 #include "system.h"
kono
parents:
diff changeset
22 #include "coretypes.h"
kono
parents:
diff changeset
23 #include "tm.h"
kono
parents:
diff changeset
24 #include "opts.h"
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 /* Filter command line before processing by the gcc driver proper. */
kono
parents:
diff changeset
27 void
kono
parents:
diff changeset
28 lang_specific_driver (struct cl_decoded_option **in_decoded_options ATTRIBUTE_UNUSED,
kono
parents:
diff changeset
29 unsigned int *in_decoded_options_count ATTRIBUTE_UNUSED,
kono
parents:
diff changeset
30 int *in_added_libraries ATTRIBUTE_UNUSED)
kono
parents:
diff changeset
31 {
kono
parents:
diff changeset
32 /* Systems which use the NeXT runtime by default should arrange
kono
parents:
diff changeset
33 for the shared libgcc to be used when -fgnu-runtime is passed
kono
parents:
diff changeset
34 through specs. */
kono
parents:
diff changeset
35 #if defined(ENABLE_SHARED_LIBGCC) && ! NEXT_OBJC_RUNTIME
kono
parents:
diff changeset
36 unsigned int i;
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 /* The new argument list will be contained in this. */
kono
parents:
diff changeset
39 struct cl_decoded_option *new_decoded_options;
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 /* True if we should add -shared-libgcc to the command-line. */
kono
parents:
diff changeset
42 int shared_libgcc = 0;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 /* The total number of arguments with the new stuff. */
kono
parents:
diff changeset
45 unsigned int argc;
kono
parents:
diff changeset
46
kono
parents:
diff changeset
47 /* The argument list. */
kono
parents:
diff changeset
48 struct cl_decoded_option *decoded_options;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 argc = *in_decoded_options_count;
kono
parents:
diff changeset
51 decoded_options = *in_decoded_options;
kono
parents:
diff changeset
52
kono
parents:
diff changeset
53 for (i = 1; i < argc; i++)
kono
parents:
diff changeset
54 {
kono
parents:
diff changeset
55 switch (decoded_options[i].opt_index)
kono
parents:
diff changeset
56 {
kono
parents:
diff changeset
57 case OPT_static_libgcc:
kono
parents:
diff changeset
58 case OPT_static:
kono
parents:
diff changeset
59 return;
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 case OPT_SPECIAL_input_file:
kono
parents:
diff changeset
62 {
kono
parents:
diff changeset
63 const char *file = decoded_options[i].arg;
kono
parents:
diff changeset
64 int len;
kono
parents:
diff changeset
65
kono
parents:
diff changeset
66 /* If the filename ends in .m or .mi, we are compiling
kono
parents:
diff changeset
67 ObjC and want to pass -shared-libgcc. */
kono
parents:
diff changeset
68 len = strlen (file);
kono
parents:
diff changeset
69 if ((len > 2 && file[len - 2] == '.' && file[len - 1] == 'm')
kono
parents:
diff changeset
70 || (len > 3 && file[len - 3] == '.' && file[len - 2] == 'm'
kono
parents:
diff changeset
71 && file[len - 1] == 'i'))
kono
parents:
diff changeset
72 shared_libgcc = 1;
kono
parents:
diff changeset
73 }
kono
parents:
diff changeset
74 break;
kono
parents:
diff changeset
75 }
kono
parents:
diff changeset
76 }
kono
parents:
diff changeset
77
kono
parents:
diff changeset
78 if (shared_libgcc)
kono
parents:
diff changeset
79 {
kono
parents:
diff changeset
80 new_decoded_options = XNEWVEC (struct cl_decoded_option, argc + 1);
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 i = 0;
kono
parents:
diff changeset
83 do
kono
parents:
diff changeset
84 {
kono
parents:
diff changeset
85 new_decoded_options[i] = decoded_options[i];
kono
parents:
diff changeset
86 i++;
kono
parents:
diff changeset
87 }
kono
parents:
diff changeset
88 while (i < argc);
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 generate_option (OPT_shared_libgcc, NULL, 1, CL_DRIVER,
kono
parents:
diff changeset
91 &new_decoded_options[i++]);
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 *in_decoded_options_count = i;
kono
parents:
diff changeset
94 *in_decoded_options = new_decoded_options;
kono
parents:
diff changeset
95 }
kono
parents:
diff changeset
96 #endif
kono
parents:
diff changeset
97 }
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 /* Called before linking. Returns 0 on success and -1 on failure. */
kono
parents:
diff changeset
100 int
kono
parents:
diff changeset
101 lang_specific_pre_link (void)
kono
parents:
diff changeset
102 {
kono
parents:
diff changeset
103 return 0; /* Not used for C. */
kono
parents:
diff changeset
104 }
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 /* Number of extra output files that lang_specific_pre_link may generate. */
kono
parents:
diff changeset
107 int lang_specific_extra_outfiles = 0; /* Not used for C. */