1 # Copyright 2001 David Abrahams
2 # Copyright 2002-2017 Rene Rivera
3 # Copyright 2002-2003 Vladimir Prus
4 # Copyright 2005 Reece H. Dunn
5 # Copyright 2006 Ilya Sokolov
6 # Copyright 2007 Roland Schwarz
7 # Copyright 2007 Boris Gubenko
9 # Distributed under the Boost Software License, Version 1.0.
10 # (See accompanying file LICENSE_1_0.txt or copy at
11 # http://www.boost.org/LICENSE_1_0.txt)
15 [[bbv2.reference.tools.compiler.gcc]]
18 The `gcc` module supports the http://gcc.gnu.org[GNU C++ compiler] on
19 Linux, a number of Unix-like system including SunOS and on Windows
20 (either http://www.cygwin.com[Cygwin] or http://www.mingw.org[MinGW]).
22 The `gcc` module is initialized using the following syntax:
25 using gcc : [version] : [c++-compile-command] : [compiler options] ;
28 This statement may be repeated several times, if you want to configure
29 several versions of the compiler.
31 If the version is not explicitly specified, it will be automatically
32 detected by running the compiler with the `-v` option. If the command is
33 not specified, the `g++` binary will be searched in PATH.
35 The following options can be provided, using
36 _`<option-name>option-value syntax`_:
39 Specifies additional compiler flags that will be used when compiling C
43 Specifies additional compiler flags that will be used when compiling C++
47 Specifies additional compiler flags that will be used when compiling both C
51 Specifies additional command line options that will be passed to the linker.
54 Specifies root directory of the compiler installation. This option is
55 necessary only if it is not possible to detect this information from the
56 compiler command--for example if the specified compiler command is a user
60 Specifies the archiver command that is used to produce static
61 libraries. Normally, it is autodetected using gcc `-print-prog-name`
62 option or defaulted to `ar`, but in some cases you might want to
63 override it, for example to explicitly use a system version instead of
64 one included with gcc.
67 Specifies the ranlib command that is used to generated symbol table
68 for static libraries. Normally, it is autodetected using gcc
69 `-print-prog-name` option or defaulted to `ranlib`, but in some cases
70 you might want to override it, for example to explicitly use a system
71 version instead of one included with gcc.
74 Specifies the resource compiler command that will be used with the
75 version of gcc that is being configured. This setting makes sense only
76 for Windows and only if you plan to use resource files. By default
77 `windres` will be used.
80 Specifies the type of resource compiler. The value can be either
81 `windres` for msvc resource compiler, or `rc` for borland's resource
84 In order to compile 64-bit applications, you have to specify
85 `address-model=64`, and the `instruction-set` feature should refer to a 64
86 bit processor. Currently, those include `nocona`, `opteron`, `athlon64` and
91 import "class" : new ;
100 import property-set ;
108 import virtual-target ;
112 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
114 .debug-configuration = true ;
118 feature.extend toolset : gcc ;
120 toolset.inherit-generators gcc : unix : unix.link unix.link.dll ;
121 toolset.inherit-flags gcc : unix ;
122 toolset.inherit-rules gcc : unix ;
124 generators.override gcc.prebuilt : builtin.prebuilt ;
125 generators.override gcc.searched-lib-generator : searched-lib-generator ;
127 # Make gcc toolset object files use the "o" suffix on all platforms.
128 type.set-generated-target-suffix OBJ : <toolset>gcc : o ;
129 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ;
130 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ;
133 # Initializes the gcc toolset for the given version. If necessary, command may
134 # be used to specify where the compiler is located. The parameter 'options' is a
135 # space-delimited list of options, each one specified as
136 # <option-name>option-value. Valid option names are: cxxflags, linkflags and
137 # linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or
138 # sun and the default value will be selected based on the current OS.
140 # using gcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
142 # The compiler command to use is detected in three steps:
143 # 1) If an explicit command is specified by the user, it will be used and must
145 # 2) If only a certain version is specified, it is enforced:
146 # - either the 'g++-VERSION' command must be available
147 # - or the default command 'g++' must be available and match the exact
149 # 3) Without user-provided restrictions use default 'g++'.
151 rule init ( version ? : command * : options * : requirement * )
153 #1): use user-provided command
154 local tool-command = ;
157 tool-command = [ common.get-invocation-command-nodefault gcc : g++ :
162 errors.error toolset gcc "initialization:"
163 : provided command '$(command)' not found
164 : initialized from [ errors.nearest-user-location ] ;
167 #2): enforce user-provided version
170 tool-command = [ common.get-invocation-command-nodefault gcc :
171 "g++-$(version[1])" ] ;
173 #2.1) fallback: check whether "g++" reports the requested version
176 tool-command = [ common.get-invocation-command-nodefault gcc : g++ ]
180 local tool-command-string = \"$(tool-command)\" ;
181 tool-command-string = $(tool-command-string:J=" ") ;
182 local tool-version = [ dump-full-version
183 $(tool-command-string) ] ;
184 # Permit a match between a two-digit version specified by the
185 # user (e.g. 4.4) and a 3-digit version reported by gcc.
186 # Since only two digits are present in the binary name
187 # anyway, insisting that user specify the 3-digit version
188 # when configuring B2, while it is not required on
189 # the command line, would be strange.
190 local versionl = [ regex.split $(version) "[.]" ] ;
191 local tool-versionl = [ regex.split $(tool-version) "[.]" ] ;
192 if ! ( $(versionl[1]) = $(tool-versionl[1]) &&
193 $(versionl[2]:E=$(tool-versionl[2])) = $(tool-versionl[2]) &&
194 $(versionl[3]:E=$(tool-versionl[3])) = $(tool-versionl[3]) )
197 errors.error toolset gcc "initialization:"
198 : version '$(version)' requested but
199 'g++-$(version)' not found and version
200 '$(tool-version)' of default '$(tool-command)'
202 : initialized from [ errors.nearest-user-location ]
210 errors.error toolset gcc "initialization:"
211 : version '$(version)' requested but neither
212 'g++-$(version)' nor default 'g++' found
213 : initialized from [ errors.nearest-user-location ] ;
217 #3) default: no command and no version specified, try using "g++"
220 tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ;
224 errors.error toolset gcc "initialization:"
225 : no command provided, default command 'g++' not found
226 : initialized from [ errors.nearest-user-location ] ;
231 # Information about the gcc command...
233 local command = $(tool-command) ;
234 # The 'command' variable can have multiple elements but when calling the
235 # SHELL builtin we need a single string, and we need to quote elements
237 local command-string = \"$(command)\" ;
238 command-string = $(command-string:J=" ") ;
239 # The root directory of the tool install.
240 local root = [ feature.get-values <root> : $(options) ] ;
241 # The bin directory where to find the command to execute.
243 # The compiler flavor.
244 local flavor = [ feature.get-values <flavor> : $(options) ] ;
245 # vxworks build on windows uses csh that is neither mingw or cygwin
246 if [ feature.get-values <target-os> : $(options) ] = vxworks
250 # Autodetect the root and bin dir if not given.
253 bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
257 # Autodetect the version and flavor if not given.
260 local machine = [ MATCH "^([^ ]+)" :
261 [ SHELL "$(command-string) -dumpmachine" ] ] ;
262 version ?= [ dump-version $(command-string) ] ;
265 case *mingw* : flavor ?= mingw ;
266 case *cygwin* : flavor ?= cygwin ;
270 case *mingw* : target-os ?= windows ;
271 case *cygwin* : target-os ?= cygwin ;
272 case *linux* : target-os ?= linux ;
273 # TODO: finish this list.
278 condition = [ common.check-init-parameters gcc $(requirement) : version $(version)
281 common.handle-options gcc : $(condition) : $(command) : $(options) ;
283 # Set the default target-os for this toolset.
284 if $(target-os) && ! [ feature.get-values <target-os> : $(requirement) ]
286 local conditionx = [ regex.replace $(condition) "/" "," ] ;
287 toolset.add-defaults $(conditionx)\:<target-os>$(target-os) ;
290 # If gcc is installed in a non-standard location, we would need to add
291 # LD_LIBRARY_PATH when running programs created with it (for unit-test/run
295 # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries
296 # and all must be added to LD_LIBRARY_PATH. The linker will pick the
297 # right onces. Note that we do not provide a clean way to build a 32-bit
298 # binary using a 64-bit compiler, but user can always pass -m32
300 local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ;
301 if $(.debug-configuration)
303 ECHO "notice:" using gcc libraries "::" $(condition) "::" $(lib_path) ;
305 toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ;
308 # If we are not using a system gcc installation we should adjust the various
309 # programs as needed to prefer using their installation specific versions.
310 # This is essential for correct use of MinGW and for cross-compiling.
313 local archiver = [ common.get-invocation-command gcc
314 : [ .get-prog-name $(command-string) : ar : $(flavor) ]
315 : [ feature.get-values <archiver> : $(options) ]
318 toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ;
319 if $(.debug-configuration)
321 ECHO "notice:" using gcc archiver "::" $(condition) "::" $(archiver[1]) ;
323 local arflags = [ feature.get-values <arflags> : $(options) ] ;
324 toolset.flags gcc.archive .ARFLAGS $(condition) : $(arflags) ;
327 local ranlib = [ common.get-invocation-command gcc
328 : [ .get-prog-name $(command-string) : ranlib : $(flavor) ]
329 : [ feature.get-values <ranlib> : $(options) ]
332 toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ;
333 if $(.debug-configuration)
335 ECHO "notice:" using gcc ranlib "::" $(condition) "::" $(ranlib[1]) ;
338 # - Resource compiler.
339 local rc = [ common.get-invocation-command-nodefault gcc : windres :
340 [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ;
341 local rc-type = [ feature.get-values <rc-type> : $(options) ] ;
345 # If we can not find an RC compiler we fallback to a null one that
346 # creates empty object files. This allows the same Jamfiles to work
347 # across the board. The null RC uses assembler to create the empty
348 # objects, so configure that.
349 rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ]
353 rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ;
355 toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ;
357 init-cxxstd-flags $(condition) : $(version) ;
362 # This causes single-line command invocation to not go through .bat files,
363 # thus avoiding command-line length limitations.
364 # TODO: Set JAMSHELL on specific targets instead of globally.
368 local rule dump-full-version ( command-string )
370 # -dumpfullversion is only supported for gcc 7+.
371 # Passing both options works, as the first one that's
372 # recognized will be used.
373 return [ MATCH "^([0-9.]+)" :
374 [ SHELL "$(command-string) -dumpfullversion -dumpversion" ] ] ;
377 local rule dump-version ( command-string )
379 return [ MATCH "^([0-9.]+)" :
380 [ SHELL "$(command-string) -dumpversion" ] ] ;
383 # Uses -print-prog-name to get the name of the tool.
384 # Converts the path to native form if using cygwin.
385 rule .get-prog-name ( command-string : tool : flavor ? )
387 local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" :
388 [ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ;
390 if $(flavor) = cygwin && [ os.name ] = NT
392 prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ;
394 return $(prog-name) ;
398 ### Functions that set options on the targets.
401 local all-os = [ feature.values <target-os> ] ;
403 local rule compile-link-flags ( * )
405 toolset.flags gcc.compile OPTIONS $(1) : $(2) ;
406 toolset.flags gcc.link OPTIONS $(1) : $(2) ;
410 # This logic will add -fPIC for all compilations:
414 # exe c : c.cpp a d ;
417 # This all is fine, except that 'd' will be compiled with -fPIC even
418 # though it is not needed, as 'd' is used only in exe. However, it is
419 # hard to detect where a target is going to be used. Alternatively, we
420 # can set -fPIC only when main target type is LIB but than 'b' would be
421 # compiled without -fPIC which would lead to link errors on x86-64. So,
422 # compile everything with -fPIC.
424 # Yet another alternative would be to create a propagated <sharedable>
425 # feature and set it when building shared libraries, but that would be
426 # hard to implement and would increase the target path length even more.
428 # On Windows, fPIC is the default, and specifying -fPIC explicitly leads
430 local non-windows = [ set.difference $(all-os) : cygwin windows ] ;
431 compile-link-flags <link>shared/<target-os>$(non-windows) : -fPIC ;
435 # Handle address-model
436 compile-link-flags <target-os>aix/<address-model>32 : -maix32 ;
437 compile-link-flags <target-os>aix/<address-model>64 : -maix64 ;
439 compile-link-flags <target-os>hpux/<address-model>32 : -milp32 ;
440 compile-link-flags <target-os>hpux/<address-model>64 : -mlp64 ;
442 local generic-os = [ set.difference $(all-os) : aix hpux ] ;
443 local arch = power sparc x86 ;
444 compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>32 : -m32 ;
445 compile-link-flags <target-os>$(generic-os)/<architecture>$(arch)/<address-model>64 : -m64 ;
450 local rule threading-flags ( * )
452 compile-link-flags <threading>multi/$(1) : $(2) ;
455 toolset.flags gcc.link FINDLIBS-SA <threading>multi/$(1) : $(3) ;
459 threading-flags <target-os>windows : -mthreads ;
460 threading-flags <target-os>cygwin : -mthreads ;
461 threading-flags <target-os>solaris : -pthreads : rt ;
462 threading-flags <target-os>qnx : -pthread ;
464 local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ;
465 threading-flags <target-os>$(bsd) : -pthread ;
467 local no-threading = android beos haiku sgi darwin vxworks ;
468 local threading-generic-os = [ set.difference $(all-os) : $(no-threading) $(bsd) windows cygwin solaris qnx ] ;
469 threading-flags <target-os>$(threading-generic-os) : -pthread : rt ;
473 local rule cxxstd-flags ( * )
475 toolset.flags gcc.compile.c++ OPTIONS $(1) : $(2) ;
476 toolset.flags gcc.link OPTIONS $(1) : $(2) ;
479 local cxxstd = [ feature.values <cxxstd> ] ;
480 local dialects = [ feature.values <cxxstd-dialect> ] ;
481 .cxxstd-dialects = [ set.difference $(dialects) : gnu iso ] ;
482 # C++ latest needs to be set up on a per-toolset basis
483 for local std in [ set.difference $(cxxstd) : latest ]
485 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>iso : -std=c++$(std) ;
486 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>gnu : -std=gnu++$(std) ;
487 # If we see this it's probably a mistake, but
488 # toolset.flags has no way to set up diagnostics.
489 cxxstd-flags <cxxstd>$(std)/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ;
492 local rule version-ge ( lhs : rhs )
494 lhs = [ regex.split $(lhs) "[.]" ] ;
495 rhs = [ regex.split $(rhs) "[.]" ] ;
496 return [ sequence.compare $(rhs) : $(lhs) : numbers.less ] ;
498 # Version specific flags
499 local rule init-cxxstd-flags ( condition * : version )
502 if [ version-ge $(version) : 8 ] { std = 2a ; }
503 else if [ version-ge $(version) : 5 ] { std = 1z ; }
504 else if [ version-ge $(version) : 4.8 ] { std = 1y ; }
505 else if [ version-ge $(version) : 4.7 ] { std = 11 ; }
506 else if [ version-ge $(version) : 3.3 ] { std = 98 ; }
509 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>iso : -std=c++$(std) ;
510 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>gnu : -std=gnu++$(std) ;
511 cxxstd-flags $(condition)/<cxxstd>latest/<cxxstd-dialect>$(.cxxstd-dialects) : -std=c++$(std) ;
516 generators.register-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ;
517 generators.register-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ;
518 generators.register-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ;
519 generators.register-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
520 generators.register-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ;
522 generators.register [ new fortran-compiling-generator
523 gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ] ;
525 rule compile.c++.preprocess ( targets * : sources * : properties * )
527 # Some extensions are compiled as C++ by default. For others, we need to
528 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
529 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
531 LANG on $(<) = "-x c++" ;
533 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
536 rule compile.c.preprocess ( targets * : sources * : properties * )
538 # If we use the name g++ then default file suffix -> language mapping does
539 # not work. So have to pass -x option. Maybe, we can work around this by
540 # allowing the user to specify both C and C++ compiler names.
543 LANG on $(<) = "-x c" ;
545 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
548 rule compile.c++ ( targets * : sources * : properties * )
550 # Some extensions are compiled as C++ by default. For others, we need to
551 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
552 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
554 LANG on $(<) = "-x c++" ;
556 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
559 rule compile.c ( targets * : sources * : properties * )
561 # If we use the name g++ then default file suffix -> language mapping does
562 # not work. So have to pass -x option. Maybe, we can work around this by
563 # allowing the user to specify both C and C++ compiler names.
566 LANG on $(<) = "-x c" ;
568 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
571 rule compile.fortran ( targets * : sources * : properties * )
575 actions compile.c++ bind PCH_FILE
577 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
580 actions compile.c bind PCH_FILE
582 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
585 actions compile.c++.preprocess bind PCH_FILE
587 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)"
590 actions compile.c.preprocess bind PCH_FILE
592 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<)
595 actions compile.fortran
597 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
600 rule compile.asm ( targets * : sources * : properties * )
602 LANG on $(<) = "-x assembler-with-cpp" ;
607 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
611 ### Precompiled header use and generation.
614 # The compiler looks for a precompiled header in each directory just before it
615 # looks for the include file in that directory. The name searched for is the
616 # name specified in the #include directive with ".gch" suffix appended. The
617 # logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended
618 # to the full header name.
620 type.set-generated-target-suffix PCH : <toolset>gcc : gch ;
622 # GCC-specific pch generator.
623 class gcc-pch-generator : pch-generator
626 import property-set ;
629 rule run-pch ( project name ? : property-set : sources + )
631 # Find the header in sources. Ignore any CPP sources.
633 for local s in $(sources)
635 if [ type.is-derived [ $(s).type ] H ]
641 # Error handling: base header file name should be the same as the base
642 # precompiled header name.
643 local header-name = [ $(header).name ] ;
644 local header-basename = $(header-name:B) ;
645 if $(header-basename) != $(name)
647 local location = [ $(project).project-module ] ;
648 import errors : user-error : errors.user-error ;
649 errors.user-error "in" "$(location):" pch target name '$(name)' should
650 be the same as the base name of header file '$(header-name)' ;
653 local pch-file = [ generator.run $(project) $(name) : $(property-set)
656 # Return result of base class and pch-file property as
657 # usage-requirements.
659 [ $(pch-file[1]).add-raw <pch-file>$(pch-file[2-]) <cflags>-Winvalid-pch ]
664 # Calls the base version specifying source's name as the name of the created
665 # target. As a result, the PCH will be named whatever.hpp.gch, and not
667 rule generated-targets ( sources + : property-set : project name ? )
669 name = [ $(sources[1]).name ] ;
670 return [ generator.generated-targets $(sources)
671 : $(property-set) : $(project) $(name) ] ;
675 # Note: the 'H' source type will catch both '.h' header and '.hpp' header. The
676 # latter have HPP type, but HPP type is derived from H. The type of compilation
677 # is determined entirely by the destination type.
678 generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ;
679 generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ;
681 # Override default do-nothing generators.
682 generators.override gcc.compile.c.pch : pch.default-c-pch-generator ;
683 generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ;
685 toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ;
687 rule compile.c++.pch ( targets * : sources * : properties * )
691 actions compile.c++.pch
693 "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
696 rule compile.c.pch ( targets * : sources * : properties * )
700 actions compile.c.pch
702 "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
706 ### General options, like optimization.
709 # Declare flags and action for compilation.
710 toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ;
711 toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ;
712 toolset.flags gcc.compile OPTIONS <optimization>space : -Os ;
714 toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ;
715 toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ;
716 toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ;
718 toolset.flags gcc.compile OPTIONS <warnings>off : -w ;
719 toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ;
720 toolset.flags gcc.compile OPTIONS <warnings>all : -Wall ;
721 toolset.flags gcc.compile OPTIONS <warnings>extra : -Wall -Wextra ;
722 toolset.flags gcc.compile OPTIONS <warnings>pedantic : -Wall -Wextra -pedantic ;
723 toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ;
725 toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ;
726 toolset.flags gcc.compile OPTIONS <profiling>on : -pg ;
728 toolset.flags gcc.compile OPTIONS <local-visibility>hidden : -fvisibility=hidden ;
729 toolset.flags gcc.compile.c++ OPTIONS <local-visibility>hidden : -fvisibility-inlines-hidden ;
730 toolset.flags gcc.compile OPTIONS <local-visibility>protected : -fvisibility=protected ;
731 toolset.flags gcc.compile OPTIONS <local-visibility>protected/<target-os>darwin : ;
732 toolset.flags gcc.compile OPTIONS <local-visibility>global : -fvisibility=default ;
734 toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ;
735 toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ;
738 toolset.flags gcc.compile.c++ OPTIONS <address-sanitizer>on : -fsanitize=address -fno-omit-frame-pointer ;
739 toolset.flags gcc.compile.c++ OPTIONS <address-sanitizer>norecover : -fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer ;
740 toolset.flags gcc.compile.c++ OPTIONS <leak-sanitizer>on : -fsanitize=leak -fno-omit-frame-pointer ;
741 toolset.flags gcc.compile.c++ OPTIONS <leak-sanitizer>norecover : -fsanitize=leak -fno-sanitize-recover=leak -fno-omit-frame-pointer ;
742 toolset.flags gcc.compile.c++ OPTIONS <thread-sanitizer>on : -fsanitize=thread -fno-omit-frame-pointer ;
743 toolset.flags gcc.compile.c++ OPTIONS <thread-sanitizer>norecover : -fsanitize=thread -fno-sanitize-recover=thread -fno-omit-frame-pointer ;
744 toolset.flags gcc.compile.c++ OPTIONS <undefined-sanitizer>on : -fsanitize=undefined -fno-omit-frame-pointer ;
745 toolset.flags gcc.compile.c++ OPTIONS <undefined-sanitizer>norecover : -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer ;
747 toolset.flags gcc.compile.c++ OPTIONS <coverage>on : --coverage ;
749 # configure Dinkum STL to match compiler options
750 toolset.flags gcc.compile.c++ DEFINES <rtti>off/<target-os>vxworks : _NO_RTTI ;
751 toolset.flags gcc.compile.c++ DEFINES <exception-handling>off/<target-os>vxworks : _NO_EX=1 ;
754 toolset.flags gcc.compile OPTIONS <lto>on/<lto-mode>full : -flto ;
755 toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>full : -flto ;
757 toolset.flags gcc.compile OPTIONS <lto>on/<lto-mode>fat : -flto -ffat-lto-objects ;
758 toolset.flags gcc.link OPTIONS <lto>on/<lto-mode>fat : -flto ;
761 toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu : _GLIBCXX_USE_CXX11_ABI=0 ;
762 toolset.flags gcc.compile.c++ DEFINES <stdlib>gnu11 : _GLIBCXX_USE_CXX11_ABI=1 ;
765 ### User free feature options.
768 toolset.flags gcc.compile USER_OPTIONS <cflags> ;
769 toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ;
770 toolset.flags gcc.compile.asm USER_OPTIONS <asmflags> ;
771 toolset.flags gcc.compile DEFINES <define> ;
772 toolset.flags gcc.compile INCLUDES <include> ;
773 toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
774 toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ;
777 ### Linking generators and actions.
780 # Class checking that we do not try to use the <runtime-link>static property
781 # while creating or using a shared library, since it is not supported by
783 class gcc-linking-generator : unix-linking-generator
785 rule run ( project name ? : property-set : sources + )
787 local target-os = [ $(property-set).get <target-os> ] ;
788 local no-static-link = true ;
791 case vms : no-static-link = ;
792 case windows : no-static-link = ;
795 local properties = [ $(property-set).raw ] ;
797 if $(no-static-link) && <runtime-link>static in $(properties)
799 if <link>shared in $(properties)
801 reason = On gcc, DLLs can not be built with
802 '<runtime-link>static'. ;
804 else if [ type.is-derived $(self.target-types[1]) EXE ]
806 for local s in $(sources)
808 local type = [ $(s).type ] ;
809 if $(type) && [ type.is-derived $(type) SHARED_LIB ]
811 reason = On gcc, using DLLs together with the
812 '<runtime-link>static' option is not possible. ;
819 ECHO "warning:" $(reason) ;
820 ECHO "warning:" It is suggested to use '<runtime-link>static' together
821 with '<link>static'. ;
825 return [ unix-linking-generator.run $(project) $(name) :
826 $(property-set) : $(sources) ] ;
831 # The set of permissible input types is different on mingw. So, define two sets
832 # of generators, with mingw generators selected when target-os=windows.
835 g = [ new gcc-linking-generator gcc.mingw.link
836 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
838 : <toolset>gcc <target-os>windows ] ;
839 $(g).set-rule-name gcc.link ;
840 generators.register $(g) ;
842 g = [ new gcc-linking-generator gcc.mingw.link.dll
843 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
844 : IMPORT_LIB SHARED_LIB
845 : <toolset>gcc <target-os>windows ] ;
846 $(g).set-rule-name gcc.link.dll ;
847 generators.register $(g) ;
850 [ new gcc-linking-generator gcc.link
855 [ new gcc-linking-generator gcc.link.dll
860 generators.override gcc.mingw.link : gcc.link ;
861 generators.override gcc.mingw.link.dll : gcc.link.dll ;
863 # Cygwin is similar to msvc and mingw in that it uses import libraries. While in
864 # simple cases, it can directly link to a shared library, it is believed to be
865 # slower, and not always possible. Define cygwin-specific generators here.
867 g = [ new gcc-linking-generator gcc.cygwin.link
868 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
870 : <toolset>gcc <target-os>cygwin ] ;
871 $(g).set-rule-name gcc.link ;
872 generators.register $(g) ;
874 g = [ new gcc-linking-generator gcc.cygwin.link.dll
875 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
876 : IMPORT_LIB SHARED_LIB
877 : <toolset>gcc <target-os>cygwin ] ;
878 $(g).set-rule-name gcc.link.dll ;
879 generators.register $(g) ;
881 generators.override gcc.cygwin.link : gcc.link ;
882 generators.override gcc.cygwin.link.dll : gcc.link.dll ;
884 # Declare flags for linking.
885 # First, the common flags.
886 toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ;
887 toolset.flags gcc.link OPTIONS <profiling>on : -pg ;
888 toolset.flags gcc.link USER_OPTIONS <linkflags> ;
889 toolset.flags gcc.link LINKPATH <library-path> ;
890 toolset.flags gcc.link FINDLIBS-ST <find-static-library> ;
891 toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ;
892 toolset.flags gcc.link LIBRARIES <library-file> ;
894 # Specify compile flags for linker as well as they may be needed for LTO
895 toolset.flags gcc.link OPTIONS <local-visibility>hidden : -fvisibility=hidden -fvisibility-inlines-hidden ;
896 toolset.flags gcc.link OPTIONS <local-visibility>protected : -fvisibility=protected ;
897 toolset.flags gcc.link OPTIONS <local-visibility>protected/<target-os>darwin : ;
898 toolset.flags gcc.link OPTIONS <local-visibility>global : -fvisibility=default ;
901 toolset.flags gcc.link OPTIONS <address-sanitizer>on : -fsanitize=address -fno-omit-frame-pointer ;
902 toolset.flags gcc.link OPTIONS <address-sanitizer>norecover : -fsanitize=address -fno-sanitize-recover=address -fno-omit-frame-pointer ;
903 toolset.flags gcc.link OPTIONS <leak-sanitizer>on : -fsanitize=leak -fno-omit-frame-pointer ;
904 toolset.flags gcc.link OPTIONS <leak-sanitizer>norecover : -fsanitize=leak -fno-sanitize-recover=leak -fno-omit-frame-pointer ;
905 toolset.flags gcc.link OPTIONS <thread-sanitizer>on : -fsanitize=thread -fno-omit-frame-pointer ;
906 toolset.flags gcc.link OPTIONS <thread-sanitizer>norecover : -fsanitize=thread -fno-sanitize-recover=thread -fno-omit-frame-pointer ;
907 toolset.flags gcc.link OPTIONS <undefined-sanitizer>on : -fsanitize=undefined -fno-omit-frame-pointer ;
908 toolset.flags gcc.link OPTIONS <undefined-sanitizer>norecover : -fsanitize=undefined -fno-sanitize-recover=undefined -fno-omit-frame-pointer ;
910 toolset.flags gcc.link OPTIONS <coverage>on : --coverage ;
912 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ;
913 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ;
915 # target specific link flags
919 # On AIX we *have* to use the native linker.
921 # Using -brtl, the AIX linker will look for libraries with both the .a
922 # and .so extensions, such as libfoo.a and libfoo.so. Without -brtl, the
923 # AIX linker looks only for libfoo.a. Note that libfoo.a is an archived
924 # file that may contain shared objects and is different from static libs
927 # The -bnoipath strips the prepending (relative) path of libraries from
928 # the loader section in the target library or executable. Hence, during
929 # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded
930 # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without
931 # this option, the prepending (relative) path + library name is
932 # hard-coded in the loader section, causing *only* this path to be
933 # searched during load-time. Note that the AIX linker does not have an
934 # -soname equivalent, this is as close as it gets.
936 # The -bbigtoc option instrcuts the linker to create a TOC bigger than 64k.
937 # This is necessary for some submodules such as math, but it does make running
938 # the tests a tad slower.
940 # The above options are definitely for AIX 5.x, and most likely also for
941 # AIX 4.x and AIX 6.x. For details about the AIX linker see:
942 # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
944 toolset.flags gcc.link OPTIONS <target-os>aix : -Wl,-brtl -Wl,-bnoipath -Wl,-bbigtoc ;
947 toolset.flags gcc.link OPTIONS <target-os>aix/<runtime-link>static : -static ;
951 # On Darwin, the -s option to ld does not work unless we pass -static,
952 # and passing -static unconditionally is a bad idea. So, do not pass -s
953 # at all and darwin.jam will use a separate 'strip' invocation.
954 toolset.flags gcc.link RPATH <target-os>darwin : <dll-path> ;
955 # This does not support -R.
956 toolset.flags gcc.link RPATH_OPTION <target-os>darwin : -rpath ;
957 # -rpath-link is not supported at all.
960 toolset.flags gcc.link OPTIONS <target-os>darwin/<runtime-link>static : -static ;
963 # On VxWorks we want to reflect what ever special flags have been set in the
964 # environment for the CPU we are targeting in the cross build
965 toolset.flags gcc.link OPTIONS <target-os>vxworks/<strip>on : -Wl,--strip-all ;
966 toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>static : [ os.environ LDFLAGS_STATIC ] ;
967 toolset.flags gcc.link.dll OPTIONS <target-os>vxworks : [ os.environ LDFLAGS_SO ] ;
968 toolset.flags gcc.link OPTIONS <target-os>vxworks/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] ;
972 local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;
973 # Strip the binary when no debugging is needed. We use --strip-all flag
974 # as opposed to -s since icc (intel's compiler) is generally
975 # option-compatible with and inherits from the gcc toolset, but does not
977 toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<strip>on :
979 toolset.flags gcc.link RPATH <target-os>$(generic-os) : <dll-path> ;
980 toolset.flags gcc.link RPATH_OPTION <target-os>$(generic-os) : -rpath ;
981 toolset.flags gcc.link RPATH_LINK <target-os>$(generic-os) : <xdll-path> ;
982 toolset.flags gcc.link START-GROUP <target-os>$(generic-os) :
984 toolset.flags gcc.link END-GROUP <target-os>$(generic-os) : -Wl,--end-group ;
986 # gnu ld has the ability to change the search behaviour for libraries
987 # referenced by the -l switch. These modifiers are -Bstatic and
988 # -Bdynamic and change search for -l switches that follow them. The
989 # following list shows the tried variants. Search stops at the first
990 # variant that has a match.
992 # *nix: -Bstatic -lxxx
995 # *nix: -Bdynamic -lxxx
999 # windows (mingw, cygwin) -Bstatic -lxxx
1003 # windows (mingw, cygwin) -Bdynamic -lxxx
1013 # (*) This is for cygwin
1014 # Please note that -Bstatic and -Bdynamic are not a guarantee that a
1015 # static or dynamic lib indeed gets linked in. The switches only change
1018 # On *nix mixing shared libs with static runtime is not a good idea.
1019 toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bstatic ;
1020 toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>$(generic-os)/<runtime-link>shared : -Wl,-Bdynamic ;
1022 # On windows allow mixing of static and dynamic libs with static
1023 # runtime is not a good idea.
1024 toolset.flags gcc.link FINDLIBS-ST-PFX <target-os>windows/<runtime-link>static : -Wl,-Bstatic ;
1025 toolset.flags gcc.link FINDLIBS-SA-PFX <target-os>windows/<runtime-link>static : -Wl,-Bdynamic ;
1026 toolset.flags gcc.link OPTIONS <target-os>windows/<runtime-link>static : -Wl,-Bstatic ;
1028 toolset.flags gcc.link HAVE_SONAME <target-os>$(generic-os) : "" ;
1029 toolset.flags gcc.link SONAME_OPTION <target-os>$(generic-os) : -h ;
1032 toolset.flags gcc.link OPTIONS <target-os>$(generic-os)/<runtime-link>static : -static ;
1036 toolset.flags gcc.link OPTIONS <target-os>hpux/<strip>on : -Wl,-s ;
1038 toolset.flags gcc.link HAVE_SONAME <target-os>hpux : "" ;
1039 toolset.flags gcc.link SONAME_OPTION <target-os>hpux : +h ;
1043 # No --strip-all, just -s.
1044 toolset.flags gcc.link OPTIONS <target-os>osf/<strip>on : -Wl,-s ;
1045 toolset.flags gcc.link RPATH <target-os>osf : <dll-path> ;
1046 # This does not support -R.
1047 toolset.flags gcc.link RPATH_OPTION <target-os>osf : -rpath ;
1048 # -rpath-link is not supported at all.
1051 toolset.flags gcc.link OPTIONS <target-os>osf/<runtime-link>static : -static ;
1055 toolset.flags gcc.link OPTIONS <target-os>solaris/<strip>on : -Wl,-s ;
1057 toolset.flags gcc.link RPATH <target-os>solaris : <dll-path> ;
1058 # Solaris linker does not have a separate -rpath-link, but allows using
1059 # -L for the same purpose.
1060 toolset.flags gcc.link LINKPATH <target-os>solaris : <xdll-path> ;
1062 # This permits shared libraries with non-PIC code on Solaris.
1063 # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the
1064 # following is not needed. Whether -fPIC should be hardcoded, is a
1065 # separate question.
1066 # AH, 2004/10/16: it is still necessary because some tests link against
1067 # static libraries that were compiled without PIC.
1068 toolset.flags gcc.link OPTIONS <target-os>solaris : -mimpure-text ;
1071 toolset.flags gcc.link OPTIONS <target-os>solaris/<runtime-link>static : -static ;
1074 # For <runtime-link>static we made sure there are no dynamic libraries in the
1075 # link. On HP-UX not all system libraries exist as archived libraries (for
1076 # example, there is no libunwind.a), so, on this platform, the -static option
1077 # cannot be specified.
1081 # Enclose the RPATH variable on 'targets' in double quotes, unless it is already
1082 # enclosed in single quotes. This special casing is done because it is common to
1083 # pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell
1084 # expansion -- and if we add double quotes then the preventing properties of
1085 # single quotes disappear.
1087 rule quote-rpath ( targets * )
1089 local r = [ on $(targets[1]) return $(RPATH) ] ;
1090 if ! [ MATCH ('.*') : $(r) ]
1094 RPATH on $(targets) = $(r) ;
1097 # Declare actions for linking.
1098 rule link ( targets * : sources * : properties * )
1100 SPACE on $(targets) = " " ;
1101 # Serialize execution of the 'link' action, since running N links in
1102 # parallel is just slower. For now, serialize only gcc links, it might be a
1103 # good idea to serialize all links.
1104 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
1105 quote-rpath $(targets) ;
1108 actions link bind LIBRARIES
1110 "$(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)
1113 rule link.dll ( targets * : sources * : properties * )
1115 SPACE on $(targets) = " " ;
1116 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
1117 quote-rpath $(targets) ;
1120 # Differs from 'link' above only by -shared.
1121 actions link.dll bind LIBRARIES
1123 "$(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)
1127 ### Archive library generation.
1130 # Default value. Mostly for the sake of intel-linux that inherits from gcc, but
1131 # does not have the same logic to set the .AR variable. We can put the same
1132 # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar'
1133 # is always available.
1138 toolset.flags gcc.archive AROPTIONS <archiveflags> ;
1140 rule archive ( targets * : sources * : properties * )
1142 # Always remove archive and start again. Here is the rationale from
1146 # I had a file, say a1.c, that was included into liba.a. I moved a1.c to
1147 # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd
1148 # errors. After some debugging I traced it back to the fact that a1.o was
1153 # Originally removing the archive was done by splicing an RM onto the
1154 # archive action. That makes archives fail to build on NT when they have
1155 # many files because it will no longer execute the action directly and blow
1156 # the line length limit. Instead we remove the file in a different action,
1157 # just before building the archive.
1159 local clean.a = $(targets[1])(clean) ;
1160 TEMPORARY $(clean.a) ;
1162 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
1163 DEPENDS $(clean.a) : $(sources) ;
1164 DEPENDS $(targets) : $(clean.a) ;
1165 common.RmTemps $(clean.a) : $(targets) ;
1168 # Declare action for creating static libraries.
1169 # The letter 'r' means to add files to the archive with replacement. Since we
1170 # remove archive, we do not care about replacement, but there is no option "add
1171 # without replacement".
1172 # The letter 'c' suppresses the warning in case the archive does not exists yet.
1173 # That warning is produced only on some platforms, for whatever reasons.
1175 actions piecemeal archive
1177 "$(.AR)" $(AROPTIONS) $(.ARFLAGS) "$(<)" "$(>)"
1182 ### CPU architecture and instruction set options.
1185 local rule cpu-flags ( toolset variable : architecture : instruction-set + :
1186 values + : default ? )
1190 toolset.flags $(toolset) $(variable)
1191 <architecture>$(architecture)/<instruction-set> : $(values) ;
1193 toolset.flags $(toolset) $(variable)
1194 <architecture>/<instruction-set>$(instruction-set)
1195 <architecture>$(architecture)/<instruction-set>$(instruction-set)
1200 # Set architecture/instruction-set options.
1202 # x86 and compatible
1203 # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default.
1204 # Use i686 instead for 32-bit.
1205 toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i686 ;
1206 cpu-flags gcc OPTIONS : x86 : native : -march=native ;
1207 cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ;
1208 cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ;
1209 cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ;
1210 cpu-flags gcc OPTIONS : x86 : pentium : -march=pentium ;
1211 cpu-flags gcc OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ;
1212 cpu-flags gcc OPTIONS : x86 : pentiumpro : -march=pentiumpro ;
1213 cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ;
1214 cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ;
1215 cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ;
1216 cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ;
1217 cpu-flags gcc OPTIONS : x86 : pentium4 : -march=pentium4 ;
1218 cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ;
1219 cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ;
1220 cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ;
1221 cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ;
1222 cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ;
1223 cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ;
1224 cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ;
1225 cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ;
1226 cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ;
1227 cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ;
1228 cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ;
1229 cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ;
1230 cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ;
1231 cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ;
1232 cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ;
1233 cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ;
1234 cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ;
1235 cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ;
1236 cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ;
1237 cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ;
1238 cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ;
1239 cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ;
1240 cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ;
1241 cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ;
1242 cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ;
1243 cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ;
1244 cpu-flags gcc OPTIONS : x86 : icelake : -march=icelake ;
1245 cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ;
1246 cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ;
1247 cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ;
1248 cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ;
1249 cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ;
1250 cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ;
1251 cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ;
1252 cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ;
1254 cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ;
1255 cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ;
1256 cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ;
1257 cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ;
1258 cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ;
1259 cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ;
1260 cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ;
1261 cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ;
1262 cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ;
1263 cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ;
1264 cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ;
1265 cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ;
1266 cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ;
1267 cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ;
1268 cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ;
1269 cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ;
1270 cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ;
1271 cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ;
1272 cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ;
1273 cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ;
1275 cpu-flags gcc OPTIONS : x86 : atom : -march=atom ;
1277 cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ;
1278 cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ;
1279 cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ;
1280 cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ;
1281 cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ;
1282 cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ;
1283 cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ;
1284 cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ;
1285 cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ;
1286 cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ;
1287 cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ;
1288 cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ;
1289 cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ;
1290 cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ;
1292 cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ;
1293 cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ;
1294 cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ;
1295 cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ;
1296 cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ;
1297 cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ;
1298 cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ;
1299 cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ;
1300 cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ;
1301 cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ;
1302 cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ;
1303 cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ;
1304 cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ;
1305 cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ;
1306 cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ;
1307 cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ;
1308 cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ;
1309 cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ;
1310 cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ;
1311 cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ;
1312 cpu-flags gcc OPTIONS : power : power : -mcpu=power ;
1313 cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ;
1314 cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ;
1315 cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ;
1316 cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ;
1317 cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ;
1318 cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ;
1319 cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ;
1320 cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ;
1321 cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ;
1322 cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ;
1323 cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ;
1324 cpu-flags gcc OPTIONS : s390x : z196 : -march=z196 ;
1325 cpu-flags gcc OPTIONS : s390x : zEC12 : -march=zEC12 ;
1326 cpu-flags gcc OPTIONS : s390x : z13 : -march=z13 ;
1327 cpu-flags gcc OPTIONS : s390x : z14 : -march=z14 ;
1328 cpu-flags gcc OPTIONS : s390x : z15 : -march=z15 ;
1329 # AIX variant of RS/6000 & PowerPC
1330 toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X64" ;