]>
Commit | Line | Data |
---|---|---|
aeee4812 | 1 | /* Copyright (C) 2022-2023 Free Software Foundation, Inc. |
2f26f5b5 MP |
2 | |
3 | This file is part of GCC. | |
4 | ||
5 | GCC is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3, or (at your option) | |
8 | any later version. | |
9 | ||
10 | GCC is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with GCC; see the file COPYING3. If not see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #include "config.h" | |
20 | #include "system.h" | |
21 | #include "coretypes.h" | |
22 | #include "tm.h" | |
23 | #include "opts.h" | |
24 | ||
25 | /* Perform early driver flags initializations that can't be achieved | |
26 | with specs. In particular, we need to explicitly request a static | |
27 | link for rtps by default before lang_specific_driver gets control. */ | |
28 | ||
29 | void vxworks_driver_init (unsigned int *in_decoded_options_count, | |
30 | struct cl_decoded_option **in_decoded_options) | |
31 | { | |
32 | unsigned int i; | |
33 | struct cl_decoded_option *decoded_options = *in_decoded_options; | |
34 | ||
35 | /* Arrange to add -static if we are going to link a rtp and there is no | |
36 | trace of any explicit request for a specific kind of link. */ | |
37 | bool wont_link = false; | |
38 | bool mrtp = false; | |
39 | bool link_kind_indication = false; | |
40 | ||
41 | /* The new argument list will be contained in this. */ | |
42 | struct cl_decoded_option *new_decoded_options; | |
43 | unsigned int num_options = *in_decoded_options_count; | |
44 | ||
45 | for (i = 1; i < num_options; i++) | |
46 | { | |
47 | if (decoded_options[i].errors & CL_ERR_MISSING_ARG) | |
48 | continue; | |
49 | ||
50 | switch (decoded_options[i].opt_index) | |
51 | { | |
52 | case OPT_static: | |
53 | case OPT_shared: | |
54 | case OPT_Bdynamic: | |
55 | case OPT_Bstatic: | |
56 | case OPT_non_static: | |
57 | link_kind_indication = true; | |
58 | break; | |
59 | ||
60 | case OPT_c: | |
61 | case OPT_r: | |
62 | case OPT_S: | |
63 | case OPT_E: | |
64 | case OPT_M: | |
65 | case OPT_MM: | |
66 | case OPT_fsyntax_only: | |
67 | wont_link = true; | |
68 | break; | |
69 | ||
70 | case OPT_mrtp: | |
71 | mrtp = true; | |
72 | break; | |
73 | ||
74 | default: | |
75 | break; | |
76 | } | |
77 | } | |
78 | ||
79 | if (!wont_link && mrtp && !link_kind_indication) | |
80 | { | |
81 | num_options++; | |
82 | new_decoded_options = XNEWVEC(struct cl_decoded_option, num_options); | |
83 | ||
84 | for (i = 0; i < num_options - 1; i++) | |
85 | new_decoded_options[i] = decoded_options[i]; | |
86 | ||
87 | generate_option(OPT_static, NULL, 1, CL_DRIVER, | |
88 | &new_decoded_options[num_options - 1]); | |
89 | ||
90 | *in_decoded_options = new_decoded_options; | |
91 | *in_decoded_options_count = num_options; | |
92 | } | |
93 | } |