]>
Commit | Line | Data |
---|---|---|
1e59de90 | 1 | # Copyright 2021 Nikita Kniazev |
7c673cae | 2 | # Copyright 2001 David Abrahams |
b32b8144 | 3 | # Copyright 2002-2017 Rene Rivera |
7c673cae FG |
4 | # Copyright 2002-2003 Vladimir Prus |
5 | # Copyright 2005 Reece H. Dunn | |
6 | # Copyright 2006 Ilya Sokolov | |
7 | # Copyright 2007 Roland Schwarz | |
8 | # Copyright 2007 Boris Gubenko | |
9 | # | |
10 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
11 | # (See accompanying file LICENSE.txt or copy at |
12 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae | 13 | |
92f5a8d4 TL |
14 | #| tag::doc[] |
15 | ||
16 | [[bbv2.reference.tools.compiler.gcc]] | |
17 | = GNU C++ | |
18 | ||
19 | The `gcc` module supports the http://gcc.gnu.org[GNU C++ compiler] on | |
20 | Linux, a number of Unix-like system including SunOS and on Windows | |
21 | (either http://www.cygwin.com[Cygwin] or http://www.mingw.org[MinGW]). | |
22 | ||
23 | The `gcc` module is initialized using the following syntax: | |
24 | ||
25 | ---- | |
26 | using gcc : [version] : [c++-compile-command] : [compiler options] ; | |
27 | ---- | |
28 | ||
29 | This statement may be repeated several times, if you want to configure | |
30 | several versions of the compiler. | |
31 | ||
32 | If the version is not explicitly specified, it will be automatically | |
33 | detected by running the compiler with the `-v` option. If the command is | |
34 | not specified, the `g++` binary will be searched in PATH. | |
35 | ||
36 | The following options can be provided, using | |
37 | _`<option-name>option-value syntax`_: | |
38 | ||
1e59de90 TL |
39 | `asmflags`:: |
40 | Specifies additional compiler flags that will be used when compiling assembler | |
41 | sources. | |
42 | ||
92f5a8d4 TL |
43 | `cflags`:: |
44 | Specifies additional compiler flags that will be used when compiling C | |
45 | sources. | |
46 | ||
47 | `cxxflags`:: | |
48 | Specifies additional compiler flags that will be used when compiling C++ | |
49 | sources. | |
50 | ||
1e59de90 TL |
51 | `fflags`:: |
52 | Specifies additional compiler flags that will be used when compiling Fortran | |
53 | sources. | |
54 | ||
55 | `mflags`:: | |
56 | Specifies additional compiler flags that will be used when compiling | |
57 | Objective-C sources. | |
58 | ||
59 | `mmflags`:: | |
60 | Specifies additional compiler flags that will be used when compiling | |
61 | Objective-C++ sources. | |
62 | ||
92f5a8d4 | 63 | `compileflags`:: |
1e59de90 TL |
64 | Specifies additional compiler flags that will be used when compiling any |
65 | language sources. | |
92f5a8d4 TL |
66 | |
67 | `linkflags`:: | |
68 | Specifies additional command line options that will be passed to the linker. | |
69 | ||
70 | `root`:: | |
71 | Specifies root directory of the compiler installation. This option is | |
72 | necessary only if it is not possible to detect this information from the | |
73 | compiler command--for example if the specified compiler command is a user | |
74 | script. | |
75 | ||
76 | `archiver`:: | |
77 | Specifies the archiver command that is used to produce static | |
78 | libraries. Normally, it is autodetected using gcc `-print-prog-name` | |
79 | option or defaulted to `ar`, but in some cases you might want to | |
80 | override it, for example to explicitly use a system version instead of | |
81 | one included with gcc. | |
82 | ||
92f5a8d4 TL |
83 | `rc`:: |
84 | Specifies the resource compiler command that will be used with the | |
85 | version of gcc that is being configured. This setting makes sense only | |
86 | for Windows and only if you plan to use resource files. By default | |
87 | `windres` will be used. | |
88 | ||
89 | `rc-type`:: | |
90 | Specifies the type of resource compiler. The value can be either | |
91 | `windres` for msvc resource compiler, or `rc` for borland's resource | |
92 | compiler. | |
93 | ||
94 | In order to compile 64-bit applications, you have to specify | |
95 | `address-model=64`, and the `instruction-set` feature should refer to a 64 | |
96 | bit processor. Currently, those include `nocona`, `opteron`, `athlon64` and | |
97 | `athlon-fx`. | |
98 | ||
99 | |# # end::doc[] | |
100 | ||
7c673cae FG |
101 | import "class" : new ; |
102 | import common ; | |
103 | import cygwin ; | |
104 | import feature ; | |
105 | import fortran ; | |
106 | import generators ; | |
107 | import os ; | |
108 | import pch ; | |
109 | import property ; | |
110 | import property-set ; | |
111 | import rc ; | |
112 | import regex ; | |
11fdf7f2 | 113 | import sequence ; |
7c673cae FG |
114 | import set ; |
115 | import toolset ; | |
116 | import type ; | |
117 | import unix ; | |
b32b8144 FG |
118 | import virtual-target ; |
119 | import errors ; | |
7c673cae FG |
120 | |
121 | ||
122 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] | |
123 | { | |
124 | .debug-configuration = true ; | |
125 | } | |
126 | ||
127 | ||
128 | feature.extend toolset : gcc ; | |
7c673cae FG |
129 | |
130 | toolset.inherit-generators gcc : unix : unix.link unix.link.dll ; | |
131 | toolset.inherit-flags gcc : unix ; | |
132 | toolset.inherit-rules gcc : unix ; | |
133 | ||
134 | generators.override gcc.prebuilt : builtin.prebuilt ; | |
135 | generators.override gcc.searched-lib-generator : searched-lib-generator ; | |
136 | ||
137 | # Make gcc toolset object files use the "o" suffix on all platforms. | |
138 | type.set-generated-target-suffix OBJ : <toolset>gcc : o ; | |
139 | type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ; | |
140 | type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ; | |
141 | ||
142 | ||
143 | # Initializes the gcc toolset for the given version. If necessary, command may | |
144 | # be used to specify where the compiler is located. The parameter 'options' is a | |
145 | # space-delimited list of options, each one specified as | |
146 | # <option-name>option-value. Valid option names are: cxxflags, linkflags and | |
147 | # linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or | |
148 | # sun and the default value will be selected based on the current OS. | |
149 | # Example: | |
150 | # using gcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ; | |
151 | # | |
152 | # The compiler command to use is detected in three steps: | |
153 | # 1) If an explicit command is specified by the user, it will be used and must | |
154 | # be available. | |
155 | # 2) If only a certain version is specified, it is enforced: | |
156 | # - either the 'g++-VERSION' command must be available | |
157 | # - or the default command 'g++' must be available and match the exact | |
158 | # version. | |
159 | # 3) Without user-provided restrictions use default 'g++'. | |
160 | # | |
b32b8144 | 161 | rule init ( version ? : command * : options * : requirement * ) |
7c673cae | 162 | { |
7c673cae FG |
163 | # Information about the gcc command... |
164 | # The command. | |
1e59de90 | 165 | command = [ common.find-compiler gcc : g++ : $(version) : $(command) ] ; |
92f5a8d4 | 166 | # The 'command' variable can have multiple elements but when calling the |
7c673cae FG |
167 | # SHELL builtin we need a single string, and we need to quote elements |
168 | # with spaces. | |
1e59de90 | 169 | local command-string = [ common.make-command-string $(command) ] ; |
7c673cae FG |
170 | # The root directory of the tool install. |
171 | local root = [ feature.get-values <root> : $(options) ] ; | |
172 | # The bin directory where to find the command to execute. | |
173 | local bin ; | |
174 | # The compiler flavor. | |
175 | local flavor = [ feature.get-values <flavor> : $(options) ] ; | |
b32b8144 FG |
176 | # vxworks build on windows uses csh that is neither mingw or cygwin |
177 | if [ feature.get-values <target-os> : $(options) ] = vxworks | |
178 | { | |
179 | flavor ?= vxworks ; | |
180 | } | |
7c673cae FG |
181 | # Autodetect the root and bin dir if not given. |
182 | if $(command) | |
183 | { | |
184 | bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ; | |
185 | root ?= $(bin:D) ; | |
186 | } | |
11fdf7f2 | 187 | local target-os ; |
7c673cae FG |
188 | # Autodetect the version and flavor if not given. |
189 | if $(command) | |
190 | { | |
191 | local machine = [ MATCH "^([^ ]+)" : | |
192 | [ SHELL "$(command-string) -dumpmachine" ] ] ; | |
1e59de90 TL |
193 | if ! $(version) { # ?= operator does not short-circuit |
194 | version ?= [ get-short-version $(command-string) ] ; | |
195 | } | |
7c673cae FG |
196 | switch $(machine:L) |
197 | { | |
198 | case *mingw* : flavor ?= mingw ; | |
11fdf7f2 TL |
199 | case *cygwin* : flavor ?= cygwin ; |
200 | } | |
201 | switch $(machine:L) | |
202 | { | |
203 | case *mingw* : target-os ?= windows ; | |
204 | case *cygwin* : target-os ?= cygwin ; | |
205 | case *linux* : target-os ?= linux ; | |
206 | # TODO: finish this list. | |
7c673cae FG |
207 | } |
208 | } | |
209 | ||
210 | local condition ; | |
b32b8144 | 211 | condition = [ common.check-init-parameters gcc $(requirement) : version $(version) |
7c673cae FG |
212 | : $(condition) ] ; |
213 | ||
214 | common.handle-options gcc : $(condition) : $(command) : $(options) ; | |
215 | ||
11fdf7f2 TL |
216 | # Set the default target-os for this toolset. |
217 | if $(target-os) && ! [ feature.get-values <target-os> : $(requirement) ] | |
218 | { | |
219 | local conditionx = [ regex.replace $(condition) "/" "," ] ; | |
220 | toolset.add-defaults $(conditionx)\:<target-os>$(target-os) ; | |
221 | } | |
7c673cae FG |
222 | |
223 | # If gcc is installed in a non-standard location, we would need to add | |
224 | # LD_LIBRARY_PATH when running programs created with it (for unit-test/run | |
225 | # rules). | |
226 | if $(command) | |
227 | { | |
228 | # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries | |
229 | # and all must be added to LD_LIBRARY_PATH. The linker will pick the | |
230 | # right onces. Note that we do not provide a clean way to build a 32-bit | |
231 | # binary using a 64-bit compiler, but user can always pass -m32 | |
232 | # manually. | |
233 | local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ; | |
234 | if $(.debug-configuration) | |
235 | { | |
11fdf7f2 | 236 | ECHO "notice:" using gcc libraries "::" $(condition) "::" $(lib_path) ; |
7c673cae FG |
237 | } |
238 | toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ; | |
239 | } | |
240 | ||
241 | # If we are not using a system gcc installation we should adjust the various | |
242 | # programs as needed to prefer using their installation specific versions. | |
243 | # This is essential for correct use of MinGW and for cross-compiling. | |
244 | ||
245 | # - Archive builder. | |
246 | local archiver = [ common.get-invocation-command gcc | |
247 | : [ .get-prog-name $(command-string) : ar : $(flavor) ] | |
248 | : [ feature.get-values <archiver> : $(options) ] | |
249 | : $(bin) | |
250 | : search-path ] ; | |
251 | toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ; | |
252 | if $(.debug-configuration) | |
253 | { | |
11fdf7f2 | 254 | ECHO "notice:" using gcc archiver "::" $(condition) "::" $(archiver[1]) ; |
7c673cae | 255 | } |
f67539c2 TL |
256 | local arflags = [ feature.get-values <arflags> : $(options) ] ; |
257 | toolset.flags gcc.archive .ARFLAGS $(condition) : $(arflags) ; | |
7c673cae | 258 | |
7c673cae FG |
259 | # - Resource compiler. |
260 | local rc = [ common.get-invocation-command-nodefault gcc : windres : | |
261 | [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ; | |
262 | local rc-type = [ feature.get-values <rc-type> : $(options) ] ; | |
263 | rc-type ?= windres ; | |
264 | if ! $(rc) | |
265 | { | |
266 | # If we can not find an RC compiler we fallback to a null one that | |
267 | # creates empty object files. This allows the same Jamfiles to work | |
268 | # across the board. The null RC uses assembler to create the empty | |
269 | # objects, so configure that. | |
270 | rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ] | |
271 | ; | |
272 | rc-type = null ; | |
273 | } | |
274 | rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ; | |
92f5a8d4 | 275 | |
b32b8144 | 276 | toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ; |
11fdf7f2 TL |
277 | |
278 | init-cxxstd-flags $(condition) : $(version) ; | |
7c673cae FG |
279 | } |
280 | ||
281 | if [ os.name ] = NT | |
282 | { | |
283 | # This causes single-line command invocation to not go through .bat files, | |
284 | # thus avoiding command-line length limitations. | |
1e59de90 TL |
285 | JAMSHELL = [ modules.peek : JAMSHELL ] ; |
286 | JAMSHELL ?= % ; | |
7c673cae FG |
287 | } |
288 | ||
1e59de90 | 289 | rule get-full-version ( command-string ) |
11fdf7f2 TL |
290 | { |
291 | # -dumpfullversion is only supported for gcc 7+. | |
292 | # Passing both options works, as the first one that's | |
293 | # recognized will be used. | |
1e59de90 TL |
294 | return [ common.match-command-output version : "^([0-9.]+)" |
295 | : "$(command-string) -dumpfullversion -dumpversion" ] ; | |
11fdf7f2 TL |
296 | } |
297 | ||
1e59de90 | 298 | rule get-short-version ( command-string : single-digit-since ? ) |
92f5a8d4 | 299 | { |
1e59de90 TL |
300 | local version = [ get-full-version $(command-string) ] ; |
301 | version = [ SPLIT_BY_CHARACTERS $(version) : . ] ; | |
302 | ||
303 | import version ; | |
304 | if [ version.version-less $(version) : $(single-digit-since:E=5) ] | |
305 | { | |
306 | return $(version[1-2]:J=.) ; | |
307 | } | |
308 | ||
309 | return $(version[1]) ; | |
92f5a8d4 TL |
310 | } |
311 | ||
7c673cae FG |
312 | # Uses -print-prog-name to get the name of the tool. |
313 | # Converts the path to native form if using cygwin. | |
314 | rule .get-prog-name ( command-string : tool : flavor ? ) | |
315 | { | |
316 | local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" : | |
317 | [ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ; | |
b32b8144 | 318 | |
11fdf7f2 | 319 | if $(flavor) = cygwin && [ os.name ] = NT |
7c673cae FG |
320 | { |
321 | prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ; | |
322 | } | |
323 | return $(prog-name) ; | |
324 | } | |
325 | ||
b32b8144 FG |
326 | ### |
327 | ### Functions that set options on the targets. | |
328 | ### | |
7c673cae | 329 | |
11fdf7f2 | 330 | local all-os = [ feature.values <target-os> ] ; |
7c673cae | 331 | |
11fdf7f2 | 332 | local rule compile-link-flags ( * ) |
7c673cae | 333 | { |
11fdf7f2 TL |
334 | toolset.flags gcc.compile OPTIONS $(1) : $(2) ; |
335 | toolset.flags gcc.link OPTIONS $(1) : $(2) ; | |
7c673cae FG |
336 | } |
337 | ||
b32b8144 | 338 | { |
11fdf7f2 TL |
339 | # This logic will add -fPIC for all compilations: |
340 | # | |
341 | # lib a : a.cpp b ; | |
342 | # obj b : b.cpp ; | |
343 | # exe c : c.cpp a d ; | |
344 | # obj d : d.cpp ; | |
345 | # | |
346 | # This all is fine, except that 'd' will be compiled with -fPIC even | |
347 | # though it is not needed, as 'd' is used only in exe. However, it is | |
348 | # hard to detect where a target is going to be used. Alternatively, we | |
349 | # can set -fPIC only when main target type is LIB but than 'b' would be | |
350 | # compiled without -fPIC which would lead to link errors on x86-64. So, | |
351 | # compile everything with -fPIC. | |
352 | # | |
353 | # Yet another alternative would be to create a propagated <sharedable> | |
354 | # feature and set it when building shared libraries, but that would be | |
355 | # hard to implement and would increase the target path length even more. | |
b32b8144 | 356 | |
11fdf7f2 TL |
357 | # On Windows, fPIC is the default, and specifying -fPIC explicitly leads |
358 | # to a warning. | |
359 | local non-windows = [ set.difference $(all-os) : cygwin windows ] ; | |
360 | compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ; | |
b32b8144 | 361 | } |
7c673cae | 362 | |
7c673cae | 363 | { |
11fdf7f2 TL |
364 | # Handle address-model |
365 | compile-link-flags <target-os>aix/<address-model>32 : -maix32 ; | |
366 | compile-link-flags <target-os>aix/<address-model>64 : -maix64 ; | |
367 | ||
368 | compile-link-flags <target-os>hpux/<address-model>32 : -milp32 ; | |
369 | compile-link-flags <target-os>hpux/<address-model>64 : -mlp64 ; | |
370 | ||
371 | local generic-os = [ set.difference $(all-os) : aix hpux ] ; | |
372 | local arch = power sparc x86 ; | |
373 | compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>32 : -m32 ; | |
374 | compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>64 : -m64 ; | |
7c673cae FG |
375 | } |
376 | ||
7c673cae | 377 | { |
11fdf7f2 TL |
378 | # Handle threading |
379 | local rule threading-flags ( * ) | |
b32b8144 | 380 | { |
11fdf7f2 TL |
381 | compile-link-flags <threading>multi/$(1) : $(2) ; |
382 | if $(3) | |
b32b8144 | 383 | { |
11fdf7f2 | 384 | toolset.flags gcc.link FINDLIBS-SA <threading>multi/$(1) : $(3) ; |
b32b8144 | 385 | } |
b32b8144 | 386 | } |
7c673cae | 387 | |
11fdf7f2 TL |
388 | threading-flags <target-os>windows : -mthreads ; |
389 | threading-flags <target-os>cygwin : -mthreads ; | |
390 | threading-flags <target-os>solaris : -pthreads : rt ; | |
f67539c2 | 391 | threading-flags <target-os>qnx : -pthread ; |
7c673cae | 392 | |
11fdf7f2 TL |
393 | local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ; |
394 | threading-flags <target-os>$(bsd) : -pthread ; | |
395 | ||
1e59de90 TL |
396 | # iOS doesn't need pthread flag according to the https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread.3.html |
397 | # The default system libraries include pthread functions. No additional libraries or CFLAGS are necessary to use this API. | |
398 | local no-threading = android beos haiku sgi darwin vxworks iphone appletv ; | |
f67539c2 | 399 | local threading-generic-os = [ set.difference $(all-os) : $(no-threading) $(bsd) windows cygwin solaris qnx ] ; |
11fdf7f2 | 400 | threading-flags <target-os>$(threading-generic-os) : -pthread : rt ; |
7c673cae FG |
401 | } |
402 | ||
7c673cae | 403 | { |
11fdf7f2 | 404 | local rule cxxstd-flags ( * ) |
b32b8144 | 405 | { |
11fdf7f2 TL |
406 | toolset.flags gcc.compile.c++ OPTIONS $(1) : $(2) ; |
407 | toolset.flags gcc.link OPTIONS $(1) : $(2) ; | |
b32b8144 | 408 | } |
7c673cae | 409 | |
11fdf7f2 TL |
410 | local cxxstd = [ feature.values <cxxstd> ] ; |
411 | local dialects = [ feature.values <cxxstd-dialect> ] ; | |
412 | .cxxstd-dialects = [ set.difference $(dialects) : gnu iso ] ; | |
413 | # C++ latest needs to be set up on a per-toolset basis | |
414 | for local std in [ set.difference $(cxxstd) : latest ] | |
b32b8144 | 415 | { |
11fdf7f2 TL |
416 | cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>iso : -std=c++$(std) ; |
417 | cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>gnu : -std=gnu++$(std) ; | |
418 | # If we see this it's probably a mistake, but | |
419 | # toolset.flags has no way to set up diagnostics. | |
420 | cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ; | |
b32b8144 | 421 | } |
7c673cae | 422 | |
11fdf7f2 TL |
423 | local rule version-ge ( lhs : rhs ) |
424 | { | |
425 | lhs = [ regex.split $(lhs) "[.]" ] ; | |
426 | rhs = [ regex.split $(rhs) "[.]" ] ; | |
427 | return [ sequence.compare $(rhs) : $(lhs) : numbers.less ] ; | |
428 | } | |
429 | # Version specific flags | |
430 | local rule init-cxxstd-flags ( condition * : version ) | |
b32b8144 | 431 | { |
11fdf7f2 | 432 | local std ; |
20effc67 TL |
433 | if [ version-ge $(version) : 10 ] { std = 20 ; } |
434 | else if [ version-ge $(version) : 8 ] { std = 2a ; } | |
435 | else if [ version-ge $(version) : 6 ] { std = 17 ; } | |
92f5a8d4 | 436 | else if [ version-ge $(version) : 5 ] { std = 1z ; } |
20effc67 | 437 | else if [ version-ge $(version) : 4.9 ] { std = 14 ; } |
11fdf7f2 TL |
438 | else if [ version-ge $(version) : 4.8 ] { std = 1y ; } |
439 | else if [ version-ge $(version) : 4.7 ] { std = 11 ; } | |
440 | else if [ version-ge $(version) : 3.3 ] { std = 98 ; } | |
441 | if $(std) | |
442 | { | |
443 | cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>iso : -std=c++$(std) ; | |
444 | cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>gnu : -std=gnu++$(std) ; | |
445 | cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ; | |
446 | } | |
b32b8144 FG |
447 | } |
448 | } | |
449 | ||
11fdf7f2 TL |
450 | generators.register-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ; |
451 | generators.register-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ; | |
452 | generators.register-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ; | |
453 | generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ; | |
454 | generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ; | |
1e59de90 TL |
455 | generators.register-c-compiler gcc.compile.m : OBJECTIVE_C : OBJ : <toolset>gcc ; |
456 | generators.register-c-compiler gcc.compile.mm : OBJECTIVE_CPP : OBJ : <toolset>gcc ; | |
11fdf7f2 TL |
457 | |
458 | generators.register [ new fortran-compiling-generator | |
b32b8144 | 459 | gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ] ; |
7c673cae | 460 | |
b32b8144 FG |
461 | rule compile.c++.preprocess ( targets * : sources * : properties * ) |
462 | { | |
7c673cae FG |
463 | # Some extensions are compiled as C++ by default. For others, we need to |
464 | # pass -x c++. We could always pass -x c++ but distcc does not work with it. | |
465 | if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C | |
466 | { | |
467 | LANG on $(<) = "-x c++" ; | |
468 | } | |
469 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
470 | } | |
471 | ||
472 | rule compile.c.preprocess ( targets * : sources * : properties * ) | |
473 | { | |
7c673cae FG |
474 | # If we use the name g++ then default file suffix -> language mapping does |
475 | # not work. So have to pass -x option. Maybe, we can work around this by | |
476 | # allowing the user to specify both C and C++ compiler names. | |
477 | #if $(>:S) != .c | |
478 | #{ | |
479 | LANG on $(<) = "-x c" ; | |
480 | #} | |
481 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
482 | } | |
483 | ||
484 | rule compile.c++ ( targets * : sources * : properties * ) | |
485 | { | |
7c673cae FG |
486 | # Some extensions are compiled as C++ by default. For others, we need to |
487 | # pass -x c++. We could always pass -x c++ but distcc does not work with it. | |
488 | if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C | |
489 | { | |
490 | LANG on $(<) = "-x c++" ; | |
491 | } | |
492 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
7c673cae FG |
493 | } |
494 | ||
495 | rule compile.c ( targets * : sources * : properties * ) | |
496 | { | |
7c673cae FG |
497 | # If we use the name g++ then default file suffix -> language mapping does |
498 | # not work. So have to pass -x option. Maybe, we can work around this by | |
499 | # allowing the user to specify both C and C++ compiler names. | |
500 | #if $(>:S) != .c | |
501 | #{ | |
502 | LANG on $(<) = "-x c" ; | |
503 | #} | |
504 | DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ; | |
505 | } | |
506 | ||
507 | rule compile.fortran ( targets * : sources * : properties * ) | |
508 | { | |
7c673cae FG |
509 | } |
510 | ||
511 | actions compile.c++ bind PCH_FILE | |
512 | { | |
1e59de90 | 513 | "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -include"$(PCH_FILE:S=)" -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<:W)" "$(>:W)" |
7c673cae FG |
514 | } |
515 | ||
516 | actions compile.c bind PCH_FILE | |
517 | { | |
1e59de90 | 518 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -include"$(PCH_FILE:S=)" -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<)" "$(>)" |
7c673cae FG |
519 | } |
520 | ||
521 | actions compile.c++.preprocess bind PCH_FILE | |
522 | { | |
1e59de90 | 523 | "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -include"$(PCH_FILE:S=)" -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" "$(>:W)" -E >"$(<:W)" |
7c673cae FG |
524 | } |
525 | ||
526 | actions compile.c.preprocess bind PCH_FILE | |
527 | { | |
1e59de90 | 528 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -include"$(PCH_FILE:S=)" -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" "$(>)" -E >$(<) |
7c673cae FG |
529 | } |
530 | ||
531 | actions compile.fortran | |
532 | { | |
1e59de90 | 533 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -include"$(PCH_FILE:S=)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
7c673cae FG |
534 | } |
535 | ||
536 | rule compile.asm ( targets * : sources * : properties * ) | |
537 | { | |
7c673cae FG |
538 | LANG on $(<) = "-x assembler-with-cpp" ; |
539 | } | |
540 | ||
541 | actions compile.asm | |
542 | { | |
b32b8144 | 543 | "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" |
7c673cae FG |
544 | } |
545 | ||
1e59de90 TL |
546 | actions compile.m |
547 | { | |
548 | "$(CONFIG_COMMAND)" -x objective-c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
549 | } | |
550 | ||
551 | actions compile.mm | |
552 | { | |
553 | "$(CONFIG_COMMAND)" -x objective-c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)" | |
554 | } | |
555 | ||
b32b8144 | 556 | ### |
f67539c2 | 557 | ### Precompiled header use and generation. |
b32b8144 FG |
558 | ### |
559 | ||
560 | # The compiler looks for a precompiled header in each directory just before it | |
561 | # looks for the include file in that directory. The name searched for is the | |
562 | # name specified in the #include directive with ".gch" suffix appended. The | |
563 | # logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended | |
564 | # to the full header name. | |
565 | ||
566 | type.set-generated-target-suffix PCH : <toolset>gcc : gch ; | |
567 | ||
568 | # GCC-specific pch generator. | |
569 | class gcc-pch-generator : pch-generator | |
570 | { | |
571 | import project ; | |
572 | import property-set ; | |
573 | import type ; | |
574 | ||
575 | rule run-pch ( project name ? : property-set : sources + ) | |
576 | { | |
577 | # Find the header in sources. Ignore any CPP sources. | |
578 | local header ; | |
579 | for local s in $(sources) | |
580 | { | |
581 | if [ type.is-derived [ $(s).type ] H ] | |
582 | { | |
583 | header = $(s) ; | |
584 | } | |
585 | } | |
586 | ||
b32b8144 FG |
587 | local pch-file = [ generator.run $(project) $(name) : $(property-set) |
588 | : $(header) ] ; | |
589 | ||
590 | # Return result of base class and pch-file property as | |
591 | # usage-requirements. | |
592 | return | |
11fdf7f2 TL |
593 | [ $(pch-file[1]).add-raw <pch-file>$(pch-file[2-]) <cflags>-Winvalid-pch ] |
594 | $(pch-file[2-]) | |
b32b8144 FG |
595 | ; |
596 | } | |
b32b8144 FG |
597 | } |
598 | ||
599 | # Note: the 'H' source type will catch both '.h' header and '.hpp' header. The | |
600 | # latter have HPP type, but HPP type is derived from H. The type of compilation | |
601 | # is determined entirely by the destination type. | |
602 | generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ; | |
603 | generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ; | |
604 | ||
605 | # Override default do-nothing generators. | |
606 | generators.override gcc.compile.c.pch : pch.default-c-pch-generator ; | |
607 | generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ; | |
608 | ||
609 | toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ; | |
610 | ||
b32b8144 FG |
611 | actions compile.c++.pch |
612 | { | |
1e59de90 | 613 | "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<)" "$(>)" |
b32b8144 FG |
614 | } |
615 | ||
616 | actions compile.c.pch | |
617 | { | |
1e59de90 | 618 | "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -include"$(FORCE_INCLUDES)" -c -o "$(<)" "$(>)" |
b32b8144 FG |
619 | } |
620 | ||
621 | ### | |
622 | ### General options, like optimization. | |
623 | ### | |
624 | ||
625 | # Declare flags and action for compilation. | |
626 | toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ; | |
627 | toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ; | |
628 | toolset.flags gcc.compile OPTIONS <optimization>space : -Os ; | |
629 | ||
630 | toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ; | |
631 | toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ; | |
632 | toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ; | |
633 | ||
634 | toolset.flags gcc.compile OPTIONS <warnings>off : -w ; | |
635 | toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ; | |
92f5a8d4 TL |
636 | toolset.flags gcc.compile OPTIONS <warnings>all : -Wall ; |
637 | toolset.flags gcc.compile OPTIONS <warnings>extra : -Wall -Wextra ; | |
638 | toolset.flags gcc.compile OPTIONS <warnings>pedantic : -Wall -Wextra -pedantic ; | |
b32b8144 FG |
639 | toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ; |
640 | ||
641 | toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ; | |
642 | toolset.flags gcc.compile OPTIONS <profiling>on : -pg ; | |
643 | ||
92f5a8d4 TL |
644 | toolset.flags gcc.compile OPTIONS <local-visibility>hidden : -fvisibility=hidden ; |
645 | toolset.flags gcc.compile.c++ OPTIONS <local-visibility>hidden : -fvisibility-inlines-hidden ; | |
646 | toolset.flags gcc.compile OPTIONS <local-visibility>protected : -fvisibility=protected ; | |
647 | toolset.flags gcc.compile OPTIONS <local-visibility>protected/<target-os>darwin : ; | |
648 | toolset.flags gcc.compile OPTIONS <local-visibility>global : -fvisibility=default ; | |
649 | ||
b32b8144 | 650 | toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ; |
92f5a8d4 TL |
651 | toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ; |
652 | ||
653 | # sanitizers | |
654 | toolset.flags gcc.compile.c++ OPTIONS <address-sanitizer>on : -fsanitize=address -fno-omit-frame-pointer ; | |
655 | toolset.flags gcc.compile.c++ OPTIONS <address-sanitizer>norecover : -fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer ; | |
656 | toolset.flags gcc.compile.c++ OPTIONS <leak-sanitizer>on : -fsanitize=leak -fno-omit-frame-pointer ; | |
657 | toolset.flags gcc.compile.c++ OPTIONS <leak-sanitizer>norecover : -fsanitize=leak -fno-sanitize-recover=leak -fno-omit-frame-pointer ; | |
658 | toolset.flags gcc.compile.c++ OPTIONS <thread-sanitizer>on : -fsanitize=thread -fno-omit-frame-pointer ; | |
659 | toolset.flags gcc.compile.c++ OPTIONS <thread-sanitizer>norecover : -fsanitize=thread -fno-sanitize-recover=thread -fno-omit-frame-pointer ; | |
660 | toolset.flags gcc.compile.c++ OPTIONS <undefined-sanitizer>on : -fsanitize=undefined -fno-omit-frame-pointer ; | |
661 | toolset.flags gcc.compile.c++ OPTIONS <undefined-sanitizer>norecover : -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer ; | |
662 | ||
663 | toolset.flags gcc.compile.c++ OPTIONS <coverage>on : --coverage ; | |
b32b8144 | 664 | |
11fdf7f2 TL |
665 | # configure Dinkum STL to match compiler options |
666 | toolset.flags gcc.compile.c++ DEFINES <rtti>off/<target-os>vxworks : _NO_RTTI ; | |
667 | toolset.flags gcc.compile.c++ DEFINES <exception-handling>off/<target-os>vxworks : _NO_EX=1 ; | |
668 | ||
f67539c2 TL |
669 | # LTO |
670 | toolset.flags gcc.compile OPTIONS <lto>on/<lto-mode>full : -flto ; | |
671 | toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>full : -flto ; | |
672 | ||
673 | toolset.flags gcc.compile OPTIONS <lto>on/<lto-mode>fat : -flto -ffat-lto-objects ; | |
674 | toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>fat : -flto ; | |
675 | ||
676 | # ABI selection | |
677 | toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu : _GLIBCXX_USE_CXX11_ABI=0 ; | |
678 | toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu11 : _GLIBCXX_USE_CXX11_ABI=1 ; | |
679 | ||
b32b8144 FG |
680 | ### |
681 | ### User free feature options. | |
682 | ### | |
683 | ||
684 | toolset.flags gcc.compile USER_OPTIONS <cflags> ; | |
685 | toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ; | |
686 | toolset.flags gcc.compile.asm USER_OPTIONS <asmflags> ; | |
687 | toolset.flags gcc.compile DEFINES <define> ; | |
688 | toolset.flags gcc.compile INCLUDES <include> ; | |
20effc67 | 689 | toolset.flags gcc.compile FORCE_INCLUDES <force-include> ; |
b32b8144 FG |
690 | toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ; |
691 | toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ; | |
1e59de90 TL |
692 | toolset.flags gcc.compile.m USER_OPTIONS <mflags> ; |
693 | toolset.flags gcc.compile.mm USER_OPTIONS <mmflags> ; | |
b32b8144 FG |
694 | |
695 | ### | |
696 | ### Linking generators and actions. | |
697 | ### | |
698 | ||
7c673cae FG |
699 | # Class checking that we do not try to use the <runtime-link>static property |
700 | # while creating or using a shared library, since it is not supported by | |
701 | # gcc/libc. | |
702 | class gcc-linking-generator : unix-linking-generator | |
703 | { | |
704 | rule run ( project name ? : property-set : sources + ) | |
705 | { | |
b32b8144 FG |
706 | local target-os = [ $(property-set).get <target-os> ] ; |
707 | local no-static-link = true ; | |
708 | switch $(target-os) | |
7c673cae | 709 | { |
b32b8144 FG |
710 | case vms : no-static-link = ; |
711 | case windows : no-static-link = ; | |
7c673cae FG |
712 | } |
713 | ||
714 | local properties = [ $(property-set).raw ] ; | |
715 | local reason ; | |
716 | if $(no-static-link) && <runtime-link>static in $(properties) | |
717 | { | |
718 | if <link>shared in $(properties) | |
719 | { | |
720 | reason = On gcc, DLLs can not be built with | |
721 | '<runtime-link>static'. ; | |
722 | } | |
723 | else if [ type.is-derived $(self.target-types[1]) EXE ] | |
724 | { | |
725 | for local s in $(sources) | |
726 | { | |
727 | local type = [ $(s).type ] ; | |
728 | if $(type) && [ type.is-derived $(type) SHARED_LIB ] | |
729 | { | |
730 | reason = On gcc, using DLLs together with the | |
731 | '<runtime-link>static' option is not possible. ; | |
732 | } | |
733 | } | |
734 | } | |
735 | } | |
736 | if $(reason) | |
737 | { | |
11fdf7f2 TL |
738 | ECHO "warning:" $(reason) ; |
739 | ECHO "warning:" It is suggested to use '<runtime-link>static' together | |
7c673cae FG |
740 | with '<link>static'. ; |
741 | } | |
742 | else | |
743 | { | |
744 | return [ unix-linking-generator.run $(project) $(name) : | |
745 | $(property-set) : $(sources) ] ; | |
746 | } | |
747 | } | |
748 | } | |
749 | ||
750 | # The set of permissible input types is different on mingw. So, define two sets | |
751 | # of generators, with mingw generators selected when target-os=windows. | |
752 | ||
753 | local g ; | |
754 | g = [ new gcc-linking-generator gcc.mingw.link | |
755 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
756 | : EXE | |
757 | : <toolset>gcc <target-os>windows ] ; | |
20effc67 | 758 | $(g).set-rule-name gcc.link.mingw ; |
7c673cae FG |
759 | generators.register $(g) ; |
760 | ||
761 | g = [ new gcc-linking-generator gcc.mingw.link.dll | |
762 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
763 | : IMPORT_LIB SHARED_LIB | |
764 | : <toolset>gcc <target-os>windows ] ; | |
20effc67 | 765 | $(g).set-rule-name gcc.link.dll.mingw ; |
7c673cae FG |
766 | generators.register $(g) ; |
767 | ||
768 | generators.register | |
769 | [ new gcc-linking-generator gcc.link | |
770 | : LIB OBJ | |
771 | : EXE | |
772 | : <toolset>gcc ] ; | |
773 | generators.register | |
774 | [ new gcc-linking-generator gcc.link.dll | |
775 | : LIB OBJ | |
776 | : SHARED_LIB | |
777 | : <toolset>gcc ] ; | |
778 | ||
779 | generators.override gcc.mingw.link : gcc.link ; | |
780 | generators.override gcc.mingw.link.dll : gcc.link.dll ; | |
781 | ||
782 | # Cygwin is similar to msvc and mingw in that it uses import libraries. While in | |
783 | # simple cases, it can directly link to a shared library, it is believed to be | |
784 | # slower, and not always possible. Define cygwin-specific generators here. | |
785 | ||
786 | g = [ new gcc-linking-generator gcc.cygwin.link | |
787 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
788 | : EXE | |
789 | : <toolset>gcc <target-os>cygwin ] ; | |
790 | $(g).set-rule-name gcc.link ; | |
791 | generators.register $(g) ; | |
792 | ||
793 | g = [ new gcc-linking-generator gcc.cygwin.link.dll | |
794 | : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB | |
795 | : IMPORT_LIB SHARED_LIB | |
796 | : <toolset>gcc <target-os>cygwin ] ; | |
797 | $(g).set-rule-name gcc.link.dll ; | |
798 | generators.register $(g) ; | |
799 | ||
800 | generators.override gcc.cygwin.link : gcc.link ; | |
801 | generators.override gcc.cygwin.link.dll : gcc.link.dll ; | |
802 | ||
803 | # Declare flags for linking. | |
804 | # First, the common flags. | |
805 | toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ; | |
806 | toolset.flags gcc.link OPTIONS <profiling>on : -pg ; | |
807 | toolset.flags gcc.link USER_OPTIONS <linkflags> ; | |
808 | toolset.flags gcc.link LINKPATH <library-path> ; | |
809 | toolset.flags gcc.link FINDLIBS-ST <find-static-library> ; | |
810 | toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ; | |
811 | toolset.flags gcc.link LIBRARIES <library-file> ; | |
812 | ||
92f5a8d4 TL |
813 | # Specify compile flags for linker as well as they may be needed for LTO |
814 | toolset.flags gcc.link OPTIONS <local-visibility>hidden : -fvisibility=hidden -fvisibility-inlines-hidden ; | |
815 | toolset.flags gcc.link OPTIONS <local-visibility>protected : -fvisibility=protected ; | |
816 | toolset.flags gcc.link OPTIONS <local-visibility>protected/<target-os>darwin : ; | |
817 | toolset.flags gcc.link OPTIONS <local-visibility>global : -fvisibility=default ; | |
818 | ||
819 | # sanitizers | |
820 | toolset.flags gcc.link OPTIONS <address-sanitizer>on : -fsanitize=address -fno-omit-frame-pointer ; | |
821 | toolset.flags gcc.link OPTIONS <address-sanitizer>norecover : -fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer ; | |
822 | toolset.flags gcc.link OPTIONS <leak-sanitizer>on : -fsanitize=leak -fno-omit-frame-pointer ; | |
823 | toolset.flags gcc.link OPTIONS <leak-sanitizer>norecover : -fsanitize=leak -fno-sanitize-recover=leak -fno-omit-frame-pointer ; | |
824 | toolset.flags gcc.link OPTIONS <thread-sanitizer>on : -fsanitize=thread -fno-omit-frame-pointer ; | |
825 | toolset.flags gcc.link OPTIONS <thread-sanitizer>norecover : -fsanitize=thread -fno-sanitize-recover=thread -fno-omit-frame-pointer ; | |
826 | toolset.flags gcc.link OPTIONS <undefined-sanitizer>on : -fsanitize=undefined -fno-omit-frame-pointer ; | |
827 | toolset.flags gcc.link OPTIONS <undefined-sanitizer>norecover : -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer ; | |
828 | ||
829 | toolset.flags gcc.link OPTIONS <coverage>on : --coverage ; | |
830 | ||
7c673cae FG |
831 | toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ; |
832 | toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ; | |
833 | ||
11fdf7f2 TL |
834 | # target specific link flags |
835 | { | |
836 | # aix | |
837 | ||
838 | # On AIX we *have* to use the native linker. | |
839 | # | |
11fdf7f2 TL |
840 | # The -bnoipath strips the prepending (relative) path of libraries from |
841 | # the loader section in the target library or executable. Hence, during | |
842 | # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded | |
843 | # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without | |
844 | # this option, the prepending (relative) path + library name is | |
845 | # hard-coded in the loader section, causing *only* this path to be | |
846 | # searched during load-time. Note that the AIX linker does not have an | |
847 | # -soname equivalent, this is as close as it gets. | |
848 | # | |
849 | # The -bbigtoc option instrcuts the linker to create a TOC bigger than 64k. | |
92f5a8d4 | 850 | # This is necessary for some submodules such as math, but it does make running |
11fdf7f2 TL |
851 | # the tests a tad slower. |
852 | # | |
92f5a8d4 | 853 | # The above options are definitely for AIX 5.x, and most likely also for |
11fdf7f2 TL |
854 | # AIX 4.x and AIX 6.x. For details about the AIX linker see: |
855 | # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf | |
856 | # | |
1e59de90 | 857 | toolset.flags gcc.link OPTIONS <target-os>aix : -Wl,-bnoipath -Wl,-bbigtoc ; |
11fdf7f2 TL |
858 | |
859 | # See note [1] | |
860 | toolset.flags gcc.link OPTIONS <target-os>aix/<runtime-link>static : -static ; | |
861 | ||
862 | # darwin | |
863 | ||
864 | # On Darwin, the -s option to ld does not work unless we pass -static, | |
865 | # and passing -static unconditionally is a bad idea. So, do not pass -s | |
866 | # at all and darwin.jam will use a separate 'strip' invocation. | |
867 | toolset.flags gcc.link RPATH <target-os>darwin : <dll-path> ; | |
868 | # This does not support -R. | |
869 | toolset.flags gcc.link RPATH_OPTION <target-os>darwin : -rpath ; | |
870 | # -rpath-link is not supported at all. | |
871 | ||
872 | # See note [1] | |
873 | toolset.flags gcc.link OPTIONS <target-os>darwin/<runtime-link>static : -static ; | |
92f5a8d4 | 874 | |
11fdf7f2 TL |
875 | # vxworks |
876 | # On VxWorks we want to reflect what ever special flags have been set in the | |
877 | # environment for the CPU we are targeting in the cross build | |
878 | toolset.flags gcc.link OPTIONS <target-os>vxworks/<strip>on : -Wl,--strip-all ; | |
879 | toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>static : [ os.environ LDFLAGS_STATIC ] ; | |
880 | toolset.flags gcc.link.dll OPTIONS <target-os>vxworks : [ os.environ LDFLAGS_SO ] ; | |
881 | toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] ; | |
92f5a8d4 | 882 | |
11fdf7f2 TL |
883 | # default |
884 | ||
1e59de90 | 885 | local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux iphone appletv ] ; |
11fdf7f2 TL |
886 | # Strip the binary when no debugging is needed. We use --strip-all flag |
887 | # as opposed to -s since icc (intel's compiler) is generally | |
888 | # option-compatible with and inherits from the gcc toolset, but does not | |
889 | # support -s. | |
890 | toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<strip>on : | |
891 | -Wl,--strip-all ; | |
11fdf7f2 TL |
892 | toolset.flags gcc.link START-GROUP <target-os>$(generic-os) : |
893 | -Wl,--start-group ; | |
894 | toolset.flags gcc.link END-GROUP <target-os>$(generic-os) : -Wl,--end-group ; | |
895 | ||
1e59de90 TL |
896 | local rpath-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux windows ] ; |
897 | toolset.flags gcc.link RPATH <target-os>$(rpath-os) : <dll-path> ; | |
898 | toolset.flags gcc.link RPATH_OPTION <target-os>$(rpath-os) : -rpath ; | |
899 | toolset.flags gcc.link RPATH_LINK <target-os>$(rpath-os) : <xdll-path> ; | |
900 | ||
11fdf7f2 TL |
901 | # gnu ld has the ability to change the search behaviour for libraries |
902 | # referenced by the -l switch. These modifiers are -Bstatic and | |
903 | # -Bdynamic and change search for -l switches that follow them. The | |
904 | # following list shows the tried variants. Search stops at the first | |
905 | # variant that has a match. | |
906 | # | |
907 | # *nix: -Bstatic -lxxx | |
908 | # libxxx.a | |
909 | # | |
910 | # *nix: -Bdynamic -lxxx | |
911 | # libxxx.so | |
912 | # libxxx.a | |
913 | # | |
914 | # windows (mingw, cygwin) -Bstatic -lxxx | |
915 | # libxxx.a | |
916 | # xxx.lib | |
917 | # | |
918 | # windows (mingw, cygwin) -Bdynamic -lxxx | |
919 | # libxxx.dll.a | |
920 | # xxx.dll.a | |
921 | # libxxx.a | |
922 | # xxx.lib | |
923 | # cygxxx.dll (*) | |
924 | # libxxx.dll | |
925 | # xxx.dll | |
926 | # libxxx.a | |
927 | # | |
928 | # (*) This is for cygwin | |
929 | # Please note that -Bstatic and -Bdynamic are not a guarantee that a | |
930 | # static or dynamic lib indeed gets linked in. The switches only change | |
931 | # search patterns! | |
932 | ||
933 | # On *nix mixing shared libs with static runtime is not a good idea. | |
934 | toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bstatic ; | |
935 | toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bdynamic ; | |
936 | ||
937 | # On windows allow mixing of static and dynamic libs with static | |
938 | # runtime is not a good idea. | |
939 | toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>windows/<runtime-link>static : -Wl,-Bstatic ; | |
940 | toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>windows/<runtime-link>static : -Wl,-Bdynamic ; | |
941 | toolset.flags gcc.link OPTIONS <target-os>windows/<runtime-link>static : -Wl,-Bstatic ; | |
942 | ||
943 | toolset.flags gcc.link HAVE_SONAME <target-os>$(generic-os) : "" ; | |
944 | toolset.flags gcc.link SONAME_OPTION <target-os>$(generic-os) : -h ; | |
945 | ||
946 | # See note [1] | |
947 | toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<runtime-link>static : -static ; | |
948 | ||
949 | # hpux | |
950 | ||
951 | toolset.flags gcc.link OPTIONS <target-os>hpux/<strip>on : -Wl,-s ; | |
952 | ||
92f5a8d4 | 953 | toolset.flags gcc.link HAVE_SONAME <target-os>hpux : "" ; |
11fdf7f2 TL |
954 | toolset.flags gcc.link SONAME_OPTION <target-os>hpux : +h ; |
955 | ||
956 | # osf | |
957 | ||
958 | # No --strip-all, just -s. | |
959 | toolset.flags gcc.link OPTIONS <target-os>osf/<strip>on : -Wl,-s ; | |
960 | toolset.flags gcc.link RPATH <target-os>osf : <dll-path> ; | |
961 | # This does not support -R. | |
962 | toolset.flags gcc.link RPATH_OPTION <target-os>osf : -rpath ; | |
963 | # -rpath-link is not supported at all. | |
964 | ||
965 | # See note [1] | |
966 | toolset.flags gcc.link OPTIONS <target-os>osf/<runtime-link>static : -static ; | |
967 | ||
968 | # sun | |
969 | ||
970 | toolset.flags gcc.link OPTIONS <target-os>solaris/<strip>on : -Wl,-s ; | |
971 | ||
972 | toolset.flags gcc.link RPATH <target-os>solaris : <dll-path> ; | |
973 | # Solaris linker does not have a separate -rpath-link, but allows using | |
974 | # -L for the same purpose. | |
975 | toolset.flags gcc.link LINKPATH <target-os>solaris : <xdll-path> ; | |
976 | ||
977 | # This permits shared libraries with non-PIC code on Solaris. | |
978 | # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the | |
979 | # following is not needed. Whether -fPIC should be hardcoded, is a | |
980 | # separate question. | |
981 | # AH, 2004/10/16: it is still necessary because some tests link against | |
982 | # static libraries that were compiled without PIC. | |
983 | toolset.flags gcc.link OPTIONS <target-os>solaris : -mimpure-text ; | |
984 | ||
985 | # See note [1] | |
986 | toolset.flags gcc.link OPTIONS <target-os>solaris/<runtime-link>static : -static ; | |
b32b8144 FG |
987 | |
988 | # [1] | |
989 | # For <runtime-link>static we made sure there are no dynamic libraries in the | |
990 | # link. On HP-UX not all system libraries exist as archived libraries (for | |
991 | # example, there is no libunwind.a), so, on this platform, the -static option | |
992 | # cannot be specified. | |
7c673cae FG |
993 | } |
994 | ||
995 | ||
996 | # Enclose the RPATH variable on 'targets' in double quotes, unless it is already | |
997 | # enclosed in single quotes. This special casing is done because it is common to | |
998 | # pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell | |
999 | # expansion -- and if we add double quotes then the preventing properties of | |
1000 | # single quotes disappear. | |
1001 | # | |
1002 | rule quote-rpath ( targets * ) | |
1003 | { | |
1004 | local r = [ on $(targets[1]) return $(RPATH) ] ; | |
1005 | if ! [ MATCH ('.*') : $(r) ] | |
1006 | { | |
1007 | r = \"$(r)\" ; | |
1008 | } | |
1009 | RPATH on $(targets) = $(r) ; | |
1010 | } | |
1011 | ||
1012 | # Declare actions for linking. | |
1013 | rule link ( targets * : sources * : properties * ) | |
1014 | { | |
7c673cae | 1015 | SPACE on $(targets) = " " ; |
7c673cae FG |
1016 | quote-rpath $(targets) ; |
1017 | } | |
1018 | ||
20effc67 | 1019 | rule link.dll ( targets * : sources * : properties * ) |
7c673cae | 1020 | { |
20effc67 | 1021 | SPACE on $(targets) = " " ; |
20effc67 | 1022 | quote-rpath $(targets) ; |
7c673cae FG |
1023 | } |
1024 | ||
20effc67 | 1025 | rule link.mingw ( targets * : sources * : properties * ) |
b32b8144 FG |
1026 | { |
1027 | SPACE on $(targets) = " " ; | |
b32b8144 FG |
1028 | } |
1029 | ||
20effc67 TL |
1030 | rule link.dll.mingw ( targets * : sources * : properties * ) |
1031 | { | |
1032 | SPACE on $(targets) = " " ; | |
20effc67 TL |
1033 | } |
1034 | ||
1035 | actions link.mingw bind LIBRARIES | |
1036 | { | |
1e59de90 | 1037 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" @($(<:T).rsp:O=FC:<=@":>=":E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP)) $(OPTIONS) $(USER_OPTIONS) |
20effc67 TL |
1038 | } |
1039 | ||
1040 | actions link.dll.mingw bind LIBRARIES | |
1041 | { | |
1e59de90 | 1042 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" -shared @($(<[-1]:T).rsp:O=FC:<=@":>=":E=$(START-GROUP) "$(>:T)" "$(LIBRARIES:T)" $(FINDLIBS-ST-PFX:T) -l$(FINDLIBS-ST:T) $(FINDLIBS-SA-PFX:T) -l$(FINDLIBS-SA:T) $(END-GROUP)) $(OPTIONS) $(USER_OPTIONS) |
20effc67 TL |
1043 | } |
1044 | ||
1045 | actions link bind LIBRARIES | |
1046 | { | |
1047 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) | |
1048 | } | |
1049 | ||
b32b8144 FG |
1050 | actions link.dll bind LIBRARIES |
1051 | { | |
1052 | "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,$(RPATH_OPTION:E=-R)$(SPACE)-Wl,$(RPATH) "$(.IMPLIB-COMMAND)$(<[1])" -o "$(<[-1])" $(HAVE_SONAME)-Wl,$(SONAME_OPTION)$(SPACE)-Wl,$(<[-1]:D=) -shared $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS) | |
1053 | } | |
1054 | ||
1055 | ### | |
1056 | ### Archive library generation. | |
1057 | ### | |
7c673cae FG |
1058 | |
1059 | # Default value. Mostly for the sake of intel-linux that inherits from gcc, but | |
1060 | # does not have the same logic to set the .AR variable. We can put the same | |
1061 | # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar' | |
1062 | # is always available. | |
1063 | .AR = ar ; | |
1e59de90 | 1064 | .ARFLAGS = rsc ; |
7c673cae FG |
1065 | |
1066 | toolset.flags gcc.archive AROPTIONS <archiveflags> ; | |
1067 | ||
1068 | rule archive ( targets * : sources * : properties * ) | |
1069 | { | |
1070 | # Always remove archive and start again. Here is the rationale from | |
1071 | # | |
1072 | # Andre Hentz: | |
1073 | # | |
1074 | # I had a file, say a1.c, that was included into liba.a. I moved a1.c to | |
1075 | # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd | |
1076 | # errors. After some debugging I traced it back to the fact that a1.o was | |
1077 | # *still* in liba.a | |
1078 | # | |
1079 | # Rene Rivera: | |
1080 | # | |
1081 | # Originally removing the archive was done by splicing an RM onto the | |
1082 | # archive action. That makes archives fail to build on NT when they have | |
1083 | # many files because it will no longer execute the action directly and blow | |
1084 | # the line length limit. Instead we remove the file in a different action, | |
1085 | # just before building the archive. | |
1086 | # | |
1087 | local clean.a = $(targets[1])(clean) ; | |
1088 | TEMPORARY $(clean.a) ; | |
1089 | NOCARE $(clean.a) ; | |
1090 | LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ; | |
1091 | DEPENDS $(clean.a) : $(sources) ; | |
1092 | DEPENDS $(targets) : $(clean.a) ; | |
1093 | common.RmTemps $(clean.a) : $(targets) ; | |
1094 | } | |
1095 | ||
1096 | # Declare action for creating static libraries. | |
1097 | # The letter 'r' means to add files to the archive with replacement. Since we | |
1098 | # remove archive, we do not care about replacement, but there is no option "add | |
1099 | # without replacement". | |
1100 | # The letter 'c' suppresses the warning in case the archive does not exists yet. | |
1101 | # That warning is produced only on some platforms, for whatever reasons. | |
1102 | # | |
1103 | actions piecemeal archive | |
1104 | { | |
f67539c2 | 1105 | "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" "$(>)" |
7c673cae FG |
1106 | } |
1107 | ||
b32b8144 FG |
1108 | ### |
1109 | ### CPU architecture and instruction set options. | |
1110 | ### | |
7c673cae FG |
1111 | |
1112 | local rule cpu-flags ( toolset variable : architecture : instruction-set + : | |
1113 | values + : default ? ) | |
1114 | { | |
1115 | if $(default) | |
1116 | { | |
1117 | toolset.flags $(toolset) $(variable) | |
1118 | <architecture>$(architecture)/<instruction-set> : $(values) ; | |
1119 | } | |
1120 | toolset.flags $(toolset) $(variable) | |
1121 | <architecture>/<instruction-set>$(instruction-set) | |
1122 | <architecture>$(architecture)/<instruction-set>$(instruction-set) | |
1123 | : $(values) ; | |
1124 | } | |
1125 | ||
1126 | ||
1127 | # Set architecture/instruction-set options. | |
1128 | # | |
1129 | # x86 and compatible | |
1130 | # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default. | |
1131 | # Use i686 instead for 32-bit. | |
1132 | toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i686 ; | |
1133 | cpu-flags gcc OPTIONS : x86 : native : -march=native ; | |
1134 | cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ; | |
1135 | cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ; | |
1136 | cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ; | |
1137 | cpu-flags gcc OPTIONS : x86 : pentium : -march=pentium ; | |
1138 | cpu-flags gcc OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ; | |
1139 | cpu-flags gcc OPTIONS : x86 : pentiumpro : -march=pentiumpro ; | |
1140 | cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ; | |
1141 | cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ; | |
1142 | cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ; | |
1143 | cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ; | |
1144 | cpu-flags gcc OPTIONS : x86 : pentium4 : -march=pentium4 ; | |
1145 | cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ; | |
1146 | cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ; | |
1147 | cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ; | |
1148 | cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ; | |
1149 | cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ; | |
1150 | cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ; | |
1151 | cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ; | |
1152 | cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ; | |
1153 | cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ; | |
1154 | cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ; | |
1155 | cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ; | |
1156 | cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ; | |
1157 | cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ; | |
1158 | cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ; | |
1159 | cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ; | |
1160 | cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ; | |
1161 | cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ; | |
1162 | cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ; | |
1163 | cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ; | |
1164 | cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ; | |
1165 | cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ; | |
1166 | cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ; | |
b32b8144 FG |
1167 | cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ; |
1168 | cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ; | |
1169 | cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ; | |
1170 | cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ; | |
20effc67 TL |
1171 | cpu-flags gcc OPTIONS : x86 : icelake-client : -march=icelake-client ; |
1172 | cpu-flags gcc OPTIONS : x86 : icelake-server : -march=icelake-server ; | |
1173 | cpu-flags gcc OPTIONS : x86 : cascadelake : -march=skylake-avx512 -mavx512vnni ; | |
1174 | cpu-flags gcc OPTIONS : x86 : cooperlake : -march=cooperlake ; | |
1175 | cpu-flags gcc OPTIONS : x86 : tigerlake : -march=tigerlake ; | |
7c673cae FG |
1176 | cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ; |
1177 | cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ; | |
1178 | cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ; | |
1179 | cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ; | |
1180 | cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ; | |
1181 | cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ; | |
1182 | cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ; | |
1183 | cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ; | |
1184 | ## | |
1185 | cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ; | |
1186 | cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ; | |
1187 | cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ; | |
1188 | cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ; | |
1189 | cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ; | |
1190 | cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ; | |
1191 | cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ; | |
1192 | cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ; | |
1193 | cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ; | |
1194 | cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ; | |
1195 | cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ; | |
1196 | cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ; | |
b32b8144 | 1197 | cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ; |
7c673cae FG |
1198 | cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ; |
1199 | cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ; | |
b32b8144 | 1200 | cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ; |
20effc67 | 1201 | cpu-flags gcc OPTIONS : x86 : znver2 : -march=znver2 ; |
7c673cae FG |
1202 | cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ; |
1203 | cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ; | |
1204 | cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ; | |
1205 | cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ; | |
20effc67 | 1206 | cpu-flags gcc OPTIONS : x86 : c7 : -march=c7 ; |
7c673cae FG |
1207 | ## |
1208 | cpu-flags gcc OPTIONS : x86 : atom : -march=atom ; | |
1209 | # Sparc | |
1210 | cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ; | |
1211 | cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ; | |
1212 | cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ; | |
1213 | cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ; | |
1214 | cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ; | |
1215 | cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ; | |
1216 | cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ; | |
1217 | cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ; | |
1218 | cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ; | |
1219 | cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ; | |
1220 | cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ; | |
1221 | cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ; | |
1222 | cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ; | |
1223 | cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ; | |
1224 | # RS/6000 & PowerPC | |
1225 | cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ; | |
1226 | cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ; | |
1227 | cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ; | |
1228 | cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ; | |
1229 | cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ; | |
1230 | cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ; | |
1231 | cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ; | |
1232 | cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ; | |
1233 | cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ; | |
1234 | cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ; | |
1235 | cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ; | |
1236 | cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ; | |
1237 | cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ; | |
1238 | cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ; | |
1239 | cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ; | |
1240 | cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ; | |
1241 | cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ; | |
1242 | cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ; | |
1243 | cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ; | |
1244 | cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ; | |
1245 | cpu-flags gcc OPTIONS : power : power : -mcpu=power ; | |
1246 | cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ; | |
1247 | cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ; | |
1248 | cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ; | |
1249 | cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ; | |
1250 | cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ; | |
1251 | cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ; | |
1252 | cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ; | |
1253 | cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ; | |
1254 | cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ; | |
1255 | cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ; | |
1256 | cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ; | |
92f5a8d4 TL |
1257 | cpu-flags gcc OPTIONS : s390x : z196 : -march=z196 ; |
1258 | cpu-flags gcc OPTIONS : s390x : zEC12 : -march=zEC12 ; | |
1259 | cpu-flags gcc OPTIONS : s390x : z13 : -march=z13 ; | |
1260 | cpu-flags gcc OPTIONS : s390x : z14 : -march=z14 ; | |
f67539c2 | 1261 | cpu-flags gcc OPTIONS : s390x : z15 : -march=z15 ; |
1e59de90 TL |
1262 | # ARM |
1263 | cpu-flags gcc OPTIONS : arm : cortex-a9+vfpv3 : -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard ; | |
1264 | cpu-flags gcc OPTIONS : arm : cortex-a53 : -mcpu=cortex-a53 ; | |
1265 | cpu-flags gcc OPTIONS : arm : cortex-r5 : -mcpu=cortex-r5 ; | |
1266 | cpu-flags gcc OPTIONS : arm : cortex-r5+vfpv3-d16 : -mcpu=cortex-r5 -mfpu=vfpv3-d16 -mfloat-abi=hard ; | |
7c673cae FG |
1267 | # AIX variant of RS/6000 & PowerPC |
1268 | toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X64" ; |