annotate gcc/config/darwin-driver.c @ 143:76e1cf5455ef

add cbc_gc test
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 19:24:05 +0900
parents 84e7813d76e9
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 /* Additional functions for the GCC driver on Darwin native.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
2 Copyright (C) 2006-2018 Free Software Foundation, Inc.
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 Contributed by Apple Computer Inc.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 This file is part of GCC.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 GCC is free software; you can redistribute it and/or modify
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 the Free Software Foundation; either version 3, or (at your option)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 any later version.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 GCC is distributed in the hope that it will be useful,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 GNU General Public License for more details.
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 along with GCC; see the file COPYING3. If not see
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 <http://www.gnu.org/licenses/>. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 #include "config.h"
111
kono
parents: 67
diff changeset
22 #include "libiberty.h"
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 #include "system.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 #include "coretypes.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 #include "tm.h"
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
26 #include "opts.h"
111
kono
parents: 67
diff changeset
27 #include "diagnostic-core.h"
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
28
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29 #ifndef CROSS_DIRECTORY_STRUCTURE
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 #include <sys/sysctl.h>
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 #include "xregex.h"
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
32
111
kono
parents: 67
diff changeset
33 static char *
kono
parents: 67
diff changeset
34 darwin_find_version_from_kernel (void)
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 {
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 char osversion[32];
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 size_t osversion_len = sizeof (osversion) - 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 static int osversion_name[2] = { CTL_KERN, KERN_OSRELEASE };
111
kono
parents: 67
diff changeset
39 int major_vers;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 char * version_p;
111
kono
parents: 67
diff changeset
41 char * new_flag;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 /* Determine the version of the running OS. If we can't, warn user,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 and do nothing. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 if (sysctl (osversion_name, ARRAY_SIZE (osversion_name), osversion,
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 &osversion_len, NULL, 0) == -1)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 {
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
48 warning (0, "sysctl for kern.osversion failed: %m");
111
kono
parents: 67
diff changeset
49 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 }
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
51
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 /* Try to parse the first two parts of the OS version number. Warn
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 user and return if it doesn't make sense. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 if (! ISDIGIT (osversion[0]))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 goto parse_failed;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 major_vers = osversion[0] - '0';
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 version_p = osversion + 1;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 if (ISDIGIT (*version_p))
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 major_vers = major_vers * 10 + (*version_p++ - '0');
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 if (*version_p++ != '.')
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 goto parse_failed;
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 /* The major kernel version number is 4 plus the second OS version
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 component. */
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 if (major_vers - 4 <= 4)
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 /* On 10.4 and earlier, the old linker is used which does not
111
kono
parents: 67
diff changeset
67 support three-component system versions.
kono
parents: 67
diff changeset
68 FIXME: we should not assume this - a newer linker could be used. */
kono
parents: 67
diff changeset
69 asprintf (&new_flag, "10.%d", major_vers - 4);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 else
111
kono
parents: 67
diff changeset
71 /* Although the newer linker supports three-component system
kono
parents: 67
diff changeset
72 versions, there's no guarantee that the minor version component
kono
parents: 67
diff changeset
73 of the kernel and the system are the same. Apple's clang always
kono
parents: 67
diff changeset
74 uses 0 as the minor version: do the same. */
kono
parents: 67
diff changeset
75 asprintf (&new_flag, "10.%d.0", major_vers - 4);
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
111
kono
parents: 67
diff changeset
77 return new_flag;
kono
parents: 67
diff changeset
78
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 parse_failed:
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
80 warning (0, "couldn%'t understand kern.osversion %q.*s",
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 (int) osversion_len, osversion);
111
kono
parents: 67
diff changeset
82 return NULL;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 }
111
kono
parents: 67
diff changeset
84 #endif
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85
111
kono
parents: 67
diff changeset
86 /* When running on a Darwin system and using that system's headers and
kono
parents: 67
diff changeset
87 libraries, default the -mmacosx-version-min flag to be the version
kono
parents: 67
diff changeset
88 of the system on which the compiler is running.
kono
parents: 67
diff changeset
89
kono
parents: 67
diff changeset
90 When building cross or native cross compilers, default to the OSX
kono
parents: 67
diff changeset
91 version of the target (as provided by the most specific target header
kono
parents: 67
diff changeset
92 included in tm.h). This may be overidden by setting the flag explicitly
kono
parents: 67
diff changeset
93 (or by the MACOSX_DEPLOYMENT_TARGET environment). */
kono
parents: 67
diff changeset
94
kono
parents: 67
diff changeset
95 static const char *
kono
parents: 67
diff changeset
96 darwin_default_min_version (void)
kono
parents: 67
diff changeset
97 {
kono
parents: 67
diff changeset
98 /* Try to retrieve the deployment target from the environment. */
kono
parents: 67
diff changeset
99 const char *new_flag = getenv ("MACOSX_DEPLOYMENT_TARGET");
kono
parents: 67
diff changeset
100
kono
parents: 67
diff changeset
101 /* Apparently, an empty string for MACOSX_DEPLOYMENT_TARGET means
kono
parents: 67
diff changeset
102 "use the default". Or, possibly "use 10.1". We choose
kono
parents: 67
diff changeset
103 to ignore the environment variable, as if it was never set. */
kono
parents: 67
diff changeset
104 if (new_flag == NULL || new_flag[0] == 0)
kono
parents: 67
diff changeset
105 #ifndef CROSS_DIRECTORY_STRUCTURE
kono
parents: 67
diff changeset
106 /* Try to find the version from the kernel, if we fail - we print a
kono
parents: 67
diff changeset
107 message and give up. */
kono
parents: 67
diff changeset
108 new_flag = darwin_find_version_from_kernel ();
kono
parents: 67
diff changeset
109 #else
kono
parents: 67
diff changeset
110 /* For cross-compilers, default to a minimum version determined by
kono
parents: 67
diff changeset
111 the configuration. */
kono
parents: 67
diff changeset
112 new_flag = DEF_MIN_OSX_VERSION;
0
a06113de4d67 first commit
kent <kent@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 #endif /* CROSS_DIRECTORY_STRUCTURE */
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
114
111
kono
parents: 67
diff changeset
115 if (new_flag != NULL)
kono
parents: 67
diff changeset
116 {
kono
parents: 67
diff changeset
117 size_t len = strlen (new_flag);
kono
parents: 67
diff changeset
118 if (len > 128) { /* Arbitrary limit, number should be like xx.yy.zz */
kono
parents: 67
diff changeset
119 warning (0, "couldn%'t understand version %s\n", new_flag);
kono
parents: 67
diff changeset
120 return NULL;
kono
parents: 67
diff changeset
121 }
kono
parents: 67
diff changeset
122 new_flag = xstrndup (new_flag, len);
kono
parents: 67
diff changeset
123 }
kono
parents: 67
diff changeset
124 return new_flag;
kono
parents: 67
diff changeset
125 }
kono
parents: 67
diff changeset
126
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
127 /* Translate -filelist and -framework options in *DECODED_OPTIONS
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
128 (size *DECODED_OPTIONS_COUNT) to use -Xlinker so that they are
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 considered to be linker inputs in the case that no other inputs are
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 specified. Handling these options in DRIVER_SELF_SPECS does not
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 suffice because specs are too late to add linker inputs, and
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 handling them in LINK_SPEC does not suffice because the linker will
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 not be called if there are no other inputs. When native, also
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
134 default the -mmacosx-version-min flag. */
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 void
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
137 darwin_driver_init (unsigned int *decoded_options_count,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
138 struct cl_decoded_option **decoded_options)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
139 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
140 unsigned int i;
111
kono
parents: 67
diff changeset
141 bool seenX86 = false;
kono
parents: 67
diff changeset
142 bool seenX86_64 = false;
kono
parents: 67
diff changeset
143 bool seenPPC = false;
kono
parents: 67
diff changeset
144 bool seenPPC64 = false;
kono
parents: 67
diff changeset
145 bool seenM32 = false;
kono
parents: 67
diff changeset
146 bool seenM64 = false;
kono
parents: 67
diff changeset
147 bool appendM32 = false;
kono
parents: 67
diff changeset
148 bool appendM64 = false;
kono
parents: 67
diff changeset
149 const char *vers_string = NULL;
kono
parents: 67
diff changeset
150 bool seen_version_min = false;
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 for (i = 1; i < *decoded_options_count; i++)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
153 {
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
154 if ((*decoded_options)[i].errors & CL_ERR_MISSING_ARG)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
155 continue;
111
kono
parents: 67
diff changeset
156
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
157 switch ((*decoded_options)[i].opt_index)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
158 {
111
kono
parents: 67
diff changeset
159 case OPT_arch:
kono
parents: 67
diff changeset
160 /* Support provision of a single -arch xxxx flag as a means of
kono
parents: 67
diff changeset
161 specifying the sub-target/multi-lib. Translate this into -m32/64
kono
parents: 67
diff changeset
162 as appropriate. */
kono
parents: 67
diff changeset
163 if (!strcmp ((*decoded_options)[i].arg, "i386"))
kono
parents: 67
diff changeset
164 seenX86 = true;
kono
parents: 67
diff changeset
165 else if (!strcmp ((*decoded_options)[i].arg, "x86_64"))
kono
parents: 67
diff changeset
166 seenX86_64 = true;
kono
parents: 67
diff changeset
167 else if (!strcmp ((*decoded_options)[i].arg, "ppc"))
kono
parents: 67
diff changeset
168 seenPPC = true;
kono
parents: 67
diff changeset
169 else if (!strcmp ((*decoded_options)[i].arg, "ppc64"))
kono
parents: 67
diff changeset
170 seenPPC64 = true;
kono
parents: 67
diff changeset
171 else
kono
parents: 67
diff changeset
172 error ("this compiler does not support %s",
kono
parents: 67
diff changeset
173 (*decoded_options)[i].arg);
kono
parents: 67
diff changeset
174 /* Now we've examined it, drop the -arch arg. */
kono
parents: 67
diff changeset
175 if (*decoded_options_count > i) {
kono
parents: 67
diff changeset
176 memmove (*decoded_options + i,
kono
parents: 67
diff changeset
177 *decoded_options + i + 1,
kono
parents: 67
diff changeset
178 ((*decoded_options_count - i)
kono
parents: 67
diff changeset
179 * sizeof (struct cl_decoded_option)));
kono
parents: 67
diff changeset
180 }
kono
parents: 67
diff changeset
181 --i;
kono
parents: 67
diff changeset
182 --*decoded_options_count;
kono
parents: 67
diff changeset
183 break;
kono
parents: 67
diff changeset
184
kono
parents: 67
diff changeset
185 case OPT_m32:
kono
parents: 67
diff changeset
186 seenM32 = true;
kono
parents: 67
diff changeset
187 break;
kono
parents: 67
diff changeset
188
kono
parents: 67
diff changeset
189 case OPT_m64:
kono
parents: 67
diff changeset
190 seenM64 = true;
kono
parents: 67
diff changeset
191 break;
kono
parents: 67
diff changeset
192
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
193 case OPT_filelist:
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
194 case OPT_framework:
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
195 ++*decoded_options_count;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
196 *decoded_options = XRESIZEVEC (struct cl_decoded_option,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
197 *decoded_options,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
198 *decoded_options_count);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
199 memmove (*decoded_options + i + 2,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
200 *decoded_options + i + 1,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
201 ((*decoded_options_count - i - 2)
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
202 * sizeof (struct cl_decoded_option)));
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
203 generate_option (OPT_Xlinker, (*decoded_options)[i].arg, 1,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
204 CL_DRIVER, &(*decoded_options)[i + 1]);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
205 generate_option (OPT_Xlinker,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
206 (*decoded_options)[i].canonical_option[0], 1,
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
207 CL_DRIVER, &(*decoded_options)[i]);
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
208 break;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
209
111
kono
parents: 67
diff changeset
210 case OPT_mmacosx_version_min_:
kono
parents: 67
diff changeset
211 seen_version_min = true;
kono
parents: 67
diff changeset
212 vers_string = xstrndup ((*decoded_options)[i].arg, 32);
kono
parents: 67
diff changeset
213
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
214 default:
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
215 break;
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
216 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
217 }
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
218
111
kono
parents: 67
diff changeset
219 /* Turn -arch xxxx into the appropriate -m32/-m64 flag.
kono
parents: 67
diff changeset
220 If the User tried to specify multiple arch flags (which is possible with
kono
parents: 67
diff changeset
221 some Darwin compilers) warn that this mode is not supported by this
kono
parents: 67
diff changeset
222 compiler (and ignore the arch flags, which means that the default multi-
kono
parents: 67
diff changeset
223 lib will be generated). */
kono
parents: 67
diff changeset
224 /* TODO: determine if these warnings would better be errors. */
kono
parents: 67
diff changeset
225 #if DARWIN_X86
kono
parents: 67
diff changeset
226 if (seenPPC || seenPPC64)
kono
parents: 67
diff changeset
227 warning (0, "this compiler does not support PowerPC (arch flags ignored)");
kono
parents: 67
diff changeset
228 if (seenX86)
kono
parents: 67
diff changeset
229 {
kono
parents: 67
diff changeset
230 if (seenX86_64 || seenM64)
kono
parents: 67
diff changeset
231 warning (0, "%s conflicts with i386 (arch flags ignored)",
kono
parents: 67
diff changeset
232 (seenX86_64? "x86_64": "m64"));
kono
parents: 67
diff changeset
233 else if (! seenM32) /* Add -m32 if the User didn't. */
kono
parents: 67
diff changeset
234 appendM32 = true;
kono
parents: 67
diff changeset
235 }
kono
parents: 67
diff changeset
236 else if (seenX86_64)
kono
parents: 67
diff changeset
237 {
kono
parents: 67
diff changeset
238 if (seenX86 || seenM32)
kono
parents: 67
diff changeset
239 warning (0, "%s conflicts with x86_64 (arch flags ignored)",
kono
parents: 67
diff changeset
240 (seenX86? "i386": "m32"));
kono
parents: 67
diff changeset
241 else if (! seenM64) /* Add -m64 if the User didn't. */
kono
parents: 67
diff changeset
242 appendM64 = true;
kono
parents: 67
diff changeset
243 }
kono
parents: 67
diff changeset
244 #elif DARWIN_PPC
kono
parents: 67
diff changeset
245 if (seenX86 || seenX86_64)
kono
parents: 67
diff changeset
246 warning (0, "this compiler does not support X86 (arch flags ignored)");
kono
parents: 67
diff changeset
247 if (seenPPC)
kono
parents: 67
diff changeset
248 {
kono
parents: 67
diff changeset
249 if (seenPPC64 || seenM64)
kono
parents: 67
diff changeset
250 warning (0, "%s conflicts with ppc (arch flags ignored)",
kono
parents: 67
diff changeset
251 (seenPPC64? "ppc64": "m64"));
kono
parents: 67
diff changeset
252 else if (! seenM32) /* Add -m32 if the User didn't. */
kono
parents: 67
diff changeset
253 appendM32 = true;
kono
parents: 67
diff changeset
254 }
kono
parents: 67
diff changeset
255 else if (seenPPC64)
kono
parents: 67
diff changeset
256 {
kono
parents: 67
diff changeset
257 if (seenPPC || seenM32)
kono
parents: 67
diff changeset
258 warning (0, "%s conflicts with ppc64 (arch flags ignored)",
kono
parents: 67
diff changeset
259 (seenPPC? "ppc": "m32"));
kono
parents: 67
diff changeset
260 else if (! seenM64) /* Add -m64 if the User didn't. */
kono
parents: 67
diff changeset
261 appendM64 = true;
kono
parents: 67
diff changeset
262 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
263 #endif
111
kono
parents: 67
diff changeset
264
kono
parents: 67
diff changeset
265 if (appendM32 || appendM64)
kono
parents: 67
diff changeset
266 {
kono
parents: 67
diff changeset
267 ++*decoded_options_count;
kono
parents: 67
diff changeset
268 *decoded_options = XRESIZEVEC (struct cl_decoded_option,
kono
parents: 67
diff changeset
269 *decoded_options,
kono
parents: 67
diff changeset
270 *decoded_options_count);
kono
parents: 67
diff changeset
271 generate_option (appendM32 ? OPT_m32 : OPT_m64, NULL, 1, CL_DRIVER,
kono
parents: 67
diff changeset
272 &(*decoded_options)[*decoded_options_count - 1]);
kono
parents: 67
diff changeset
273 }
kono
parents: 67
diff changeset
274
kono
parents: 67
diff changeset
275 /* We will need to know the OS X version we're trying to build for here
kono
parents: 67
diff changeset
276 so that we can figure out the mechanism and source for the sysroot to
kono
parents: 67
diff changeset
277 be used. */
kono
parents: 67
diff changeset
278 if (! seen_version_min && *decoded_options_count > 1)
kono
parents: 67
diff changeset
279 {
kono
parents: 67
diff changeset
280 /* Not set by the User, try to figure it out. */
kono
parents: 67
diff changeset
281 vers_string = darwin_default_min_version ();
kono
parents: 67
diff changeset
282 if (vers_string != NULL)
kono
parents: 67
diff changeset
283 {
kono
parents: 67
diff changeset
284 ++*decoded_options_count;
kono
parents: 67
diff changeset
285 *decoded_options = XRESIZEVEC (struct cl_decoded_option,
kono
parents: 67
diff changeset
286 *decoded_options,
kono
parents: 67
diff changeset
287 *decoded_options_count);
kono
parents: 67
diff changeset
288 generate_option (OPT_mmacosx_version_min_, vers_string, 1, CL_DRIVER,
kono
parents: 67
diff changeset
289 &(*decoded_options)[*decoded_options_count - 1]);
kono
parents: 67
diff changeset
290 }
kono
parents: 67
diff changeset
291 }
kono
parents: 67
diff changeset
292 /* Create and push the major version for assemblers that need it. */
kono
parents: 67
diff changeset
293 if (vers_string != NULL)
kono
parents: 67
diff changeset
294 {
kono
parents: 67
diff changeset
295 char *asm_major = NULL;
kono
parents: 67
diff changeset
296 const char *first_period = strchr(vers_string, '.');
kono
parents: 67
diff changeset
297 if (first_period != NULL)
kono
parents: 67
diff changeset
298 {
kono
parents: 67
diff changeset
299 const char *second_period = strchr(first_period+1, '.');
kono
parents: 67
diff changeset
300 if (second_period != NULL)
kono
parents: 67
diff changeset
301 asm_major = xstrndup (vers_string, second_period-vers_string);
kono
parents: 67
diff changeset
302 else
kono
parents: 67
diff changeset
303 asm_major = xstrdup (vers_string);
kono
parents: 67
diff changeset
304 }
kono
parents: 67
diff changeset
305 /* Else we appear to have a weird macosx version with no major number.
kono
parents: 67
diff changeset
306 Punt on this for now. */
kono
parents: 67
diff changeset
307 if (asm_major != NULL)
kono
parents: 67
diff changeset
308 {
kono
parents: 67
diff changeset
309 ++*decoded_options_count;
kono
parents: 67
diff changeset
310 *decoded_options = XRESIZEVEC (struct cl_decoded_option,
kono
parents: 67
diff changeset
311 *decoded_options,
kono
parents: 67
diff changeset
312 *decoded_options_count);
kono
parents: 67
diff changeset
313 generate_option (OPT_asm_macosx_version_min_, asm_major, 1, CL_DRIVER,
kono
parents: 67
diff changeset
314 &(*decoded_options)[*decoded_options_count - 1]);
kono
parents: 67
diff changeset
315 }
kono
parents: 67
diff changeset
316 }
67
f6334be47118 update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
317 }