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)
13 import "class" : new ;
29 import virtual-target ;
33 if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
35 .debug-configuration = true ;
39 feature.extend toolset : gcc ;
40 # feature.subfeature toolset gcc : flavor : : optional ;
42 toolset.inherit-generators gcc : unix : unix.link unix.link.dll ;
43 toolset.inherit-flags gcc : unix ;
44 toolset.inherit-rules gcc : unix ;
46 generators.override gcc.prebuilt : builtin.prebuilt ;
47 generators.override gcc.searched-lib-generator : searched-lib-generator ;
49 # Make gcc toolset object files use the "o" suffix on all platforms.
50 type.set-generated-target-suffix OBJ : <toolset>gcc : o ;
51 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>windows : o ;
52 type.set-generated-target-suffix OBJ : <toolset>gcc <target-os>cygwin : o ;
55 # Initializes the gcc toolset for the given version. If necessary, command may
56 # be used to specify where the compiler is located. The parameter 'options' is a
57 # space-delimited list of options, each one specified as
58 # <option-name>option-value. Valid option names are: cxxflags, linkflags and
59 # linker-type. Accepted linker-type values are aix, darwin, gnu, hpux, osf or
60 # sun and the default value will be selected based on the current OS.
62 # using gcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
64 # The compiler command to use is detected in three steps:
65 # 1) If an explicit command is specified by the user, it will be used and must
67 # 2) If only a certain version is specified, it is enforced:
68 # - either the 'g++-VERSION' command must be available
69 # - or the default command 'g++' must be available and match the exact
71 # 3) Without user-provided restrictions use default 'g++'.
73 rule init ( version ? : command * : options * : requirement * )
75 #1): use user-provided command
76 local tool-command = ;
79 tool-command = [ common.get-invocation-command-nodefault gcc : g++ :
84 errors.error toolset gcc initialization:
85 : provided command '$(command)' not found
86 : initialized from [ errors.nearest-user-location ] ;
89 #2): enforce user-provided version
92 tool-command = [ common.get-invocation-command-nodefault gcc :
93 "g++-$(version[1])" ] ;
95 #2.1) fallback: check whether "g++" reports the requested version
98 tool-command = [ common.get-invocation-command-nodefault gcc : g++ ]
102 local tool-command-string = \"$(tool-command)\" ;
103 tool-command-string = $(tool-command-string:J=" ") ;
104 local tool-version = [ MATCH "^([0-9.]+)" :
105 [ SHELL "$(tool-command-string) -dumpversion" ] ] ;
106 if $(tool-version) != $(version)
108 # Permit a match betwen a two-digit version specified by the
109 # user (e.g. 4.4) and a 3-digit version reported by gcc.
110 # Since only two digits are present in the binary name
111 # anyway, insisting that user specify the 3-digit version
112 # when configuring Boost.Build, while it is not required on
113 # the command line, would be strange.
114 local stripped = [ MATCH "^([0-9]+\.[0-9]+).*" :
116 if $(stripped) != $(version)
119 errors.error toolset gcc initialization:
120 : version '$(version)' requested but
121 'g++-$(version)' not found and version
122 '$(tool-version)' of default '$(tool-command)'
124 : initialized from [ errors.nearest-user-location ]
128 # Use full 3-digit version to be compatible with the
130 version = $(tool-version) ;
136 errors.error toolset gcc initialization:
137 : version '$(version)' requested but neither
138 'g++-$(version)' nor default 'g++' found
139 : initialized from [ errors.nearest-user-location ] ;
143 #3) default: no command and no version specified, try using "g++"
146 tool-command = [ common.get-invocation-command-nodefault gcc : g++ ] ;
150 errors.error toolset gcc initialization:
151 : no command provided, default command 'g++' not found
152 : initialized from [ errors.nearest-user-location ] ;
157 # Information about the gcc command...
159 local command = $(tool-command) ;
160 # The 'command' variable can have multiple elements but when calling the
161 # SHELL builtin we need a single string, and we need to quote elements
163 local command-string = \"$(command)\" ;
164 command-string = $(command-string:J=" ") ;
165 # The root directory of the tool install.
166 local root = [ feature.get-values <root> : $(options) ] ;
167 # The bin directory where to find the command to execute.
169 # The compiler flavor.
170 local flavor = [ feature.get-values <flavor> : $(options) ] ;
171 # vxworks build on windows uses csh that is neither mingw or cygwin
172 if [ feature.get-values <target-os> : $(options) ] = vxworks
176 # Autodetect the root and bin dir if not given.
179 bin ?= [ common.get-absolute-tool-path $(command[-1]) ] ;
182 # Autodetect the version and flavor if not given.
185 local machine = [ MATCH "^([^ ]+)" :
186 [ SHELL "$(command-string) -dumpmachine" ] ] ;
187 version ?= [ MATCH "^([0-9.]+)" :
188 [ SHELL "$(command-string) -dumpversion" ] ] ;
191 case *mingw* : flavor ?= mingw ;
198 condition = flavor $(flavor) ;
200 condition = [ common.check-init-parameters gcc $(requirement) : version $(version)
203 common.handle-options gcc : $(condition) : $(command) : $(options) ;
205 init-link-flags gcc "" $(condition) ;
207 # If gcc is installed in a non-standard location, we would need to add
208 # LD_LIBRARY_PATH when running programs created with it (for unit-test/run
212 # On multilib 64-bit boxes, there are both 32-bit and 64-bit libraries
213 # and all must be added to LD_LIBRARY_PATH. The linker will pick the
214 # right onces. Note that we do not provide a clean way to build a 32-bit
215 # binary using a 64-bit compiler, but user can always pass -m32
217 local lib_path = $(root)/bin $(root)/lib $(root)/lib32 $(root)/lib64 ;
218 if $(.debug-configuration)
220 ECHO notice: using gcc libraries :: $(condition) :: $(lib_path) ;
222 toolset.flags gcc.link RUN_PATH $(condition) : $(lib_path) ;
225 # If we are not using a system gcc installation we should adjust the various
226 # programs as needed to prefer using their installation specific versions.
227 # This is essential for correct use of MinGW and for cross-compiling.
230 local archiver = [ common.get-invocation-command gcc
231 : [ .get-prog-name $(command-string) : ar : $(flavor) ]
232 : [ feature.get-values <archiver> : $(options) ]
235 toolset.flags gcc.archive .AR $(condition) : $(archiver[1]) ;
236 if $(.debug-configuration)
238 ECHO notice: using gcc archiver :: $(condition) :: $(archiver[1]) ;
242 local ranlib = [ common.get-invocation-command gcc
243 : [ .get-prog-name $(command-string) : ranlib : $(flavor) ]
244 : [ feature.get-values <ranlib> : $(options) ]
247 toolset.flags gcc.archive .RANLIB $(condition) : $(ranlib[1]) ;
248 if $(.debug-configuration)
250 ECHO notice: using gcc ranlib :: $(condition) :: $(ranlib[1]) ;
253 # - Resource compiler.
254 local rc = [ common.get-invocation-command-nodefault gcc : windres :
255 [ feature.get-values <rc> : $(options) ] : $(bin) : search-path ] ;
256 local rc-type = [ feature.get-values <rc-type> : $(options) ] ;
260 # If we can not find an RC compiler we fallback to a null one that
261 # creates empty object files. This allows the same Jamfiles to work
262 # across the board. The null RC uses assembler to create the empty
263 # objects, so configure that.
264 rc = [ common.get-invocation-command gcc : as : : $(bin) : search-path ]
268 rc.configure $(rc) : $(condition) : <rc-type>$(rc-type) ;
270 toolset.flags gcc VERSION $(condition) : [ regex.split $(version) "[.]" ] ;
275 # This causes single-line command invocation to not go through .bat files,
276 # thus avoiding command-line length limitations.
277 # TODO: Set JAMSHELL on specific targets instead of globally.
281 # Uses -print-prog-name to get the name of the tool.
282 # Converts the path to native form if using cygwin.
283 rule .get-prog-name ( command-string : tool : flavor ? )
285 local prog-name = [ NORMALIZE_PATH [ MATCH "(.*)[\n]+" :
286 [ SHELL "$(command-string) -print-prog-name=$(tool)" ] ] ] ;
288 if $(flavor) != vxworks && $(flavor) != mingw && [ os.name ] = NT
290 prog-name = [ cygwin.cygwin-to-windows-path $(prog-name) ] ;
292 return $(prog-name) ;
296 ### Functions that set options on the targets.
299 rule set-fpic-options ( targets * : sources * : properties * )
301 local link = [ feature.get-values link : $(properties) ] ;
304 local target-os = [ feature.get-values target-os : $(properties) ] ;
306 # This logic will add -fPIC for all compilations:
310 # exe c : c.cpp a d ;
313 # This all is fine, except that 'd' will be compiled with -fPIC even
314 # though it is not needed, as 'd' is used only in exe. However, it is
315 # hard to detect where a target is going to be used. Alternatively, we
316 # can set -fPIC only when main target type is LIB but than 'b' would be
317 # compiled without -fPIC which would lead to link errors on x86-64. So,
318 # compile everything with -fPIC.
320 # Yet another alternative would be to create a propagated <sharedable>
321 # feature and set it when building shared libraries, but that would be
322 # hard to implement and would increase the target path length even more.
324 # On Windows, fPIC is the default, and specifying -fPIC explicitly leads
326 if ! $(target-os) in cygwin windows
328 OPTIONS on $(targets) += -fPIC ;
333 rule set-address-model-options ( targets * : sources * : properties * )
335 local model = [ feature.get-values address-model : $(properties) ] ;
339 local target-os = [ feature.get-values target-os : $(properties) ] ;
340 if $(target-os) = aix
351 else if $(target-os) = hpux
364 local arch = [ feature.get-values architecture : $(properties) ] ;
365 if $(arch) = power || $(arch) = sparc || $(arch) = x86
371 else if $(model) = 64
376 # For darwin, the model can be 32_64. darwin.jam will handle that
379 OPTIONS on $(targets) += $(option) ;
383 rule set-threading-options ( targets * : sources * : properties * )
385 local threading = [ feature.get-values threading : $(properties) ] ;
386 if $(threading) = multi
388 local target-os = [ feature.get-values target-os : $(properties) ] ;
389 local host-os = [ feature.get-values host-os : $(properties) ] ;
390 local toolset = [ feature.get-values toolset : $(properties) ] ;
394 if $(toolset) = clang && $(target-os) = windows
401 case android : # No threading options, everything is in already.
402 case windows : option ?= -mthreads ;
403 case cygwin : option ?= -mthreads ;
404 case solaris : option ?= -pthreads ; libs = rt ;
405 case beos : # No threading options.
406 case haiku : # No threading options.
407 case *bsd : option ?= -pthread ; # There is no -lrt on BSD.
408 case sgi : # gcc on IRIX does not support multi-threading.
409 case darwin : # No threading options.
410 case vxworks : # No threading options.
411 case * : option ?= -pthread ; libs = rt ;
415 OPTIONS on $(targets) += $(option) ;
419 FINDLIBS-SA on $(targets) += $(libs) ;
424 local rule zero-pad ( numbers * )
427 for local n in $(numbers)
431 case ???? : result += $(n) ;
432 case ??? : result += 0$(n) ;
433 case ?? : result += 00$(n) ;
434 case ? : result += 000$(n) ;
440 rule set-cxxstd-options ( targets * : sources * : properties * : action )
442 local *targets = [ $(action).targets ] ;
443 local *sources = [ $(action).sources ] ;
444 local target-type = [ $(*targets[1]).type ] ;
445 local source-type = [ $(*sources[1]).type ] ;
446 local toolset = [ feature.get-values toolset : $(properties) ] ;
447 local version = [ zero-pad [ on $(targets[1]) return $(VERSION) ] ] ;
448 version = $(version[1]).$(version[2]) ;
449 local cxxstd = [ feature.get-values cxxstd : $(properties) ] ;
450 local cxxstd-dialect = [ feature.get-values cxxstd-dialect : $(properties) ] ;
451 cxxstd-dialect ?= iso ;
452 switch $(cxxstd-dialect)
454 case gnu : cxxstd-dialect = gnu++ ;
455 case iso : cxxstd-dialect = c++ ;
457 errors.warning Unknown cxxstd-dialect $(cxxstd-dialect:E=?) .. using
458 ISO dialect instead. ;
459 cxxstd-dialect = c++ ;
462 if $(cxxstd) = latest
466 if $(version) >= 0008.0000 { option = 2a ; }
467 else if $(version) >= 0005.0001 { option = 1z ; }
468 else if $(version) >= 0004.0008 { option = 1y ; }
469 else if $(version) >= 0004.0007 { option = 11 ; }
470 else if $(version) >= 0003.0003 { option = 98 ; }
472 if $(toolset) = clang
474 if $(version) >= 0003.0005 { option = 1z ; }
475 if $(version) >= 0003.0004 { option = 14 ; }
476 if $(version) >= 0003.0003 { option = 11 ; }
484 if $(source-type) in CPP || $(target-type) in CPP_PCH EXE SHARED_LIB
486 OPTIONS on $(targets) += -std=$(cxxstd-dialect)$(option) ;
491 ### Compiling generators and actions.
494 class gcc-c-compiling-generator : C-compiling-generator
496 rule action-class ( )
498 return gcc-c-compile-action ;
502 class gcc-c-compile-action : compile-action
506 rule execute ( action-name targets + : sources * : properties * )
508 gcc.set-threading-options $(targets) : $(sources) : $(properties) ;
509 gcc.set-fpic-options $(targets) : $(sources) : $(properties) ;
510 gcc.set-address-model-options $(targets) : $(sources) : $(properties) ;
511 gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ;
512 compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ;
516 local rule register-gcc-c-compiler ( id : source-types + : target-types + : requirements *
517 : optional-properties * )
519 generators.register [ new gcc-c-compiling-generator $(id) : $(source-types) :
520 $(target-types) : $(requirements) : $(optional-properties) ] ;
523 register-gcc-c-compiler gcc.compile.c++.preprocess : CPP : PREPROCESSED_CPP : <toolset>gcc ;
524 register-gcc-c-compiler gcc.compile.c.preprocess : C : PREPROCESSED_C : <toolset>gcc ;
525 register-gcc-c-compiler gcc.compile.c++ : CPP : OBJ : <toolset>gcc ;
526 register-gcc-c-compiler gcc.compile.c : C : OBJ : <toolset>gcc ;
527 register-gcc-c-compiler gcc.compile.asm : ASM : OBJ : <toolset>gcc ;
529 class gcc-fortran-compiling-generator : fortran-compiling-generator
531 rule action-class ( )
533 return gcc-fortran-compile-action ;
537 class gcc-fortran-compile-action : compile-action
541 rule execute ( action-name targets + : sources * : properties * )
543 gcc.set-threading-options $(targets) : $(sources) : $(properties) ;
544 gcc.set-fpic-options $(targets) : $(sources) : $(properties) ;
545 gcc.set-address-model-options $(targets) : $(sources) : $(properties) ;
546 gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ;
547 compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ;
551 generators.register [ new gcc-fortran-compiling-generator
552 gcc.compile.fortran : FORTRAN FORTRAN90 : OBJ : <toolset>gcc ] ;
554 rule compile.c++.preprocess ( targets * : sources * : properties * )
556 # Some extensions are compiled as C++ by default. For others, we need to
557 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
558 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
560 LANG on $(<) = "-x c++" ;
562 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
565 rule compile.c.preprocess ( targets * : sources * : properties * )
567 # If we use the name g++ then default file suffix -> language mapping does
568 # not work. So have to pass -x option. Maybe, we can work around this by
569 # allowing the user to specify both C and C++ compiler names.
572 LANG on $(<) = "-x c" ;
574 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
577 rule compile.c++ ( targets * : sources * : properties * )
579 # Some extensions are compiled as C++ by default. For others, we need to
580 # pass -x c++. We could always pass -x c++ but distcc does not work with it.
581 if ! $(>:S) in .cc .cp .cxx .cpp .c++ .C
583 LANG on $(<) = "-x c++" ;
585 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
588 rule compile.c ( targets * : sources * : properties * )
590 # If we use the name g++ then default file suffix -> language mapping does
591 # not work. So have to pass -x option. Maybe, we can work around this by
592 # allowing the user to specify both C and C++ compiler names.
595 LANG on $(<) = "-x c" ;
597 DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
600 rule compile.fortran ( targets * : sources * : properties * )
604 actions compile.c++ bind PCH_FILE
606 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<:W)" "$(>:W)"
609 actions compile.c bind PCH_FILE
611 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
614 actions compile.c++.preprocess bind PCH_FILE
616 "$(CONFIG_COMMAND)" $(LANG) -ftemplate-depth-$(TEMPLATE_DEPTH) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>:W)" -E >"$(<:W)"
619 actions compile.c.preprocess bind PCH_FILE
621 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" "$(>)" -E >$(<)
624 actions compile.fortran
626 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(PCH_FILE:D)" -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
629 rule compile.asm ( targets * : sources * : properties * )
631 LANG on $(<) = "-x assembler-with-cpp" ;
636 "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
640 ### Preconpiled header use and generation.
643 # The compiler looks for a precompiled header in each directory just before it
644 # looks for the include file in that directory. The name searched for is the
645 # name specified in the #include directive with ".gch" suffix appended. The
646 # logic in gcc-pch-generator will make sure that the BASE_PCH suffix is appended
647 # to the full header name.
649 type.set-generated-target-suffix PCH : <toolset>gcc : gch ;
651 # GCC-specific pch generator.
652 class gcc-pch-generator : pch-generator
655 import property-set ;
658 rule run-pch ( project name ? : property-set : sources + )
660 # Find the header in sources. Ignore any CPP sources.
662 for local s in $(sources)
664 if [ type.is-derived [ $(s).type ] H ]
670 # Error handling: base header file name should be the same as the base
671 # precompiled header name.
672 local header-name = [ $(header).name ] ;
673 local header-basename = $(header-name:B) ;
674 if $(header-basename) != $(name)
676 local location = [ $(project).project-module ] ;
677 import errors : user-error : errors.user-error ;
678 errors.user-error "in" $(location): pch target name '$(name)' should
679 be the same as the base name of header file '$(header-name)' ;
682 local pch-file = [ generator.run $(project) $(name) : $(property-set)
685 # Return result of base class and pch-file property as
686 # usage-requirements.
688 [ property-set.create <pch-file>$(pch-file) <cflags>-Winvalid-pch ]
693 # Calls the base version specifying source's name as the name of the created
694 # target. As a result, the PCH will be named whatever.hpp.gch, and not
696 rule generated-targets ( sources + : property-set : project name ? )
698 name = [ $(sources[1]).name ] ;
699 return [ generator.generated-targets $(sources)
700 : $(property-set) : $(project) $(name) ] ;
703 rule action-class ( )
705 return gcc-pch-compile-action ;
709 class gcc-pch-compile-action : compile-action
713 rule execute ( action-name targets + : sources * : properties * )
715 gcc.set-threading-options $(targets) : $(sources) : $(properties) ;
716 gcc.set-fpic-options $(targets) : $(sources) : $(properties) ;
717 gcc.set-address-model-options $(targets) : $(sources) : $(properties) ;
718 gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ;
719 compile-action.execute $(action-name) $(targets) : $(sources) : $(properties) ;
723 # Note: the 'H' source type will catch both '.h' header and '.hpp' header. The
724 # latter have HPP type, but HPP type is derived from H. The type of compilation
725 # is determined entirely by the destination type.
726 generators.register [ new gcc-pch-generator gcc.compile.c.pch : H : C_PCH : <pch>on <toolset>gcc ] ;
727 generators.register [ new gcc-pch-generator gcc.compile.c++.pch : H : CPP_PCH : <pch>on <toolset>gcc ] ;
729 # Override default do-nothing generators.
730 generators.override gcc.compile.c.pch : pch.default-c-pch-generator ;
731 generators.override gcc.compile.c++.pch : pch.default-cpp-pch-generator ;
733 toolset.flags gcc.compile PCH_FILE <pch>on : <pch-file> ;
735 rule compile.c++.pch ( targets * : sources * : properties * )
739 actions compile.c++.pch
741 "$(CONFIG_COMMAND)" -x c++-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
744 rule compile.c.pch ( targets * : sources * : properties * )
748 actions compile.c.pch
750 "$(CONFIG_COMMAND)" -x c-header $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
754 ### General options, like optimization.
757 # Declare flags and action for compilation.
758 toolset.flags gcc.compile OPTIONS <optimization>off : -O0 ;
759 toolset.flags gcc.compile OPTIONS <optimization>speed : -O3 ;
760 toolset.flags gcc.compile OPTIONS <optimization>space : -Os ;
762 toolset.flags gcc.compile OPTIONS <inlining>off : -fno-inline ;
763 toolset.flags gcc.compile OPTIONS <inlining>on : -Wno-inline ;
764 toolset.flags gcc.compile OPTIONS <inlining>full : -finline-functions -Wno-inline ;
766 toolset.flags gcc.compile OPTIONS <warnings>off : -w ;
767 toolset.flags gcc.compile OPTIONS <warnings>on : -Wall ;
768 toolset.flags gcc.compile OPTIONS <warnings>all : -Wall -pedantic ;
769 toolset.flags gcc.compile OPTIONS <warnings-as-errors>on : -Werror ;
771 toolset.flags gcc.compile OPTIONS <debug-symbols>on : -g ;
772 toolset.flags gcc.compile OPTIONS <profiling>on : -pg ;
774 toolset.flags gcc.compile.c++ OPTIONS <rtti>off : -fno-rtti ;
775 toolset.flags gcc.compile.c++ OPTIONS <exception-handling>off : -fno-exceptions ;
778 ### User free feature options.
781 toolset.flags gcc.compile USER_OPTIONS <cflags> ;
782 toolset.flags gcc.compile.c++ USER_OPTIONS <cxxflags> ;
783 toolset.flags gcc.compile.asm USER_OPTIONS <asmflags> ;
784 toolset.flags gcc.compile DEFINES <define> ;
785 toolset.flags gcc.compile INCLUDES <include> ;
786 toolset.flags gcc.compile.c++ TEMPLATE_DEPTH <c++-template-depth> ;
787 toolset.flags gcc.compile.fortran USER_OPTIONS <fflags> ;
790 ### Linking generators and actions.
793 # Class checking that we do not try to use the <runtime-link>static property
794 # while creating or using a shared library, since it is not supported by
796 class gcc-linking-generator : unix-linking-generator
798 rule run ( project name ? : property-set : sources + )
800 local target-os = [ $(property-set).get <target-os> ] ;
801 local no-static-link = true ;
804 case vms : no-static-link = ;
805 case windows : no-static-link = ;
808 local properties = [ $(property-set).raw ] ;
810 if $(no-static-link) && <runtime-link>static in $(properties)
812 if <link>shared in $(properties)
814 reason = On gcc, DLLs can not be built with
815 '<runtime-link>static'. ;
817 else if [ type.is-derived $(self.target-types[1]) EXE ]
819 for local s in $(sources)
821 local type = [ $(s).type ] ;
822 if $(type) && [ type.is-derived $(type) SHARED_LIB ]
824 reason = On gcc, using DLLs together with the
825 '<runtime-link>static' option is not possible. ;
832 ECHO warning: $(reason) ;
833 ECHO warning: It is suggested to use '<runtime-link>static' together
834 with '<link>static'. ;
838 return [ unix-linking-generator.run $(project) $(name) :
839 $(property-set) : $(sources) ] ;
843 rule action-class ( )
845 return gcc-link-action ;
849 class gcc-link-action : action
853 rule execute ( action-name targets + : sources * : properties * )
855 gcc.set-threading-options $(targets) : $(sources) : $(properties) ;
856 gcc.set-fpic-options $(targets) : $(sources) : $(properties) ;
857 gcc.set-address-model-options $(targets) : $(sources) : $(properties) ;
858 gcc.set-cxxstd-options $(targets) : $(sources) : $(properties) : $(__name__) ;
859 gcc.set-link-options $(action-name) $(targets) : $(sources) : $(properties) ;
860 action.execute $(action-name) $(targets) : $(sources) : $(properties) ;
864 # The set of permissible input types is different on mingw. So, define two sets
865 # of generators, with mingw generators selected when target-os=windows.
868 g = [ new gcc-linking-generator gcc.mingw.link
869 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
871 : <toolset>gcc <target-os>windows ] ;
872 $(g).set-rule-name gcc.link ;
873 generators.register $(g) ;
875 g = [ new gcc-linking-generator gcc.mingw.link.dll
876 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
877 : IMPORT_LIB SHARED_LIB
878 : <toolset>gcc <target-os>windows ] ;
879 $(g).set-rule-name gcc.link.dll ;
880 generators.register $(g) ;
883 [ new gcc-linking-generator gcc.link
888 [ new gcc-linking-generator gcc.link.dll
893 generators.override gcc.mingw.link : gcc.link ;
894 generators.override gcc.mingw.link.dll : gcc.link.dll ;
896 # Cygwin is similar to msvc and mingw in that it uses import libraries. While in
897 # simple cases, it can directly link to a shared library, it is believed to be
898 # slower, and not always possible. Define cygwin-specific generators here.
900 g = [ new gcc-linking-generator gcc.cygwin.link
901 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
903 : <toolset>gcc <target-os>cygwin ] ;
904 $(g).set-rule-name gcc.link ;
905 generators.register $(g) ;
907 g = [ new gcc-linking-generator gcc.cygwin.link.dll
908 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
909 : IMPORT_LIB SHARED_LIB
910 : <toolset>gcc <target-os>cygwin ] ;
911 $(g).set-rule-name gcc.link.dll ;
912 generators.register $(g) ;
914 generators.override gcc.cygwin.link : gcc.link ;
915 generators.override gcc.cygwin.link.dll : gcc.link.dll ;
917 # Declare flags for linking.
918 # First, the common flags.
919 toolset.flags gcc.link OPTIONS <debug-symbols>on : -g ;
920 toolset.flags gcc.link OPTIONS <profiling>on : -pg ;
921 toolset.flags gcc.link USER_OPTIONS <linkflags> ;
922 toolset.flags gcc.link LINKPATH <library-path> ;
923 toolset.flags gcc.link FINDLIBS-ST <find-static-library> ;
924 toolset.flags gcc.link FINDLIBS-SA <find-shared-library> ;
925 toolset.flags gcc.link LIBRARIES <library-file> ;
927 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>windows : "-Wl,--out-implib," ;
928 toolset.flags gcc.link.dll .IMPLIB-COMMAND <target-os>cygwin : "-Wl,--out-implib," ;
930 # Now, the vendor specific flags.
931 # The parameter linker can be either aix, darwin, gnu, hpux, osf or sun.
932 rule init-link-flags ( toolset subtool condition )
934 ## Need to define the linker-type feature once for each toolset module.
935 if ! [ feature.valid <toolset-$(toolset):linker-type> ]
937 feature.subfeature toolset $(toolset) : linker-type :
938 gnu aix darwin hpux osf sun : propagated link-incompatible ;
940 ## The specification to add the linker-type is per toolset "instance".
941 toolset.add-requirements
942 $(condition),<target-os>aix:<toolset-$(toolset):linker-type>aix
943 $(condition),<target-os>darwin:<toolset-$(toolset):linker-type>darwin
944 $(condition),<target-os>hpux:<toolset-$(toolset):linker-type>hpux
945 $(condition),<target-os>osf:<toolset-$(toolset):linker-type>osf
946 $(condition),<target-os>solaris:<toolset-$(toolset):linker-type>sun
950 rule set-link-options ( action-name targets + : sources * : properties * )
952 local toolset = [ feature.get-values <toolset> : $(properties) ] ;
953 local linker-type = [ feature.get-values <toolset-$(toolset):linker-type> : $(properties) ] ;
954 local target-os = [ feature.get-values <target-os> : $(properties) ] ;
956 switch $(linker-type:G=)
960 # On AIX we *have* to use the native linker.
962 # Using -brtl, the AIX linker will look for libraries with both the .a
963 # and .so extensions, such as libfoo.a and libfoo.so. Without -brtl, the
964 # AIX linker looks only for libfoo.a. Note that libfoo.a is an archived
965 # file that may contain shared objects and is different from static libs
968 # The -bnoipath strips the prepending (relative) path of libraries from
969 # the loader section in the target library or executable. Hence, during
970 # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded
971 # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without
972 # this option, the prepending (relative) path + library name is
973 # hard-coded in the loader section, causing *only* this path to be
974 # searched during load-time. Note that the AIX linker does not have an
975 # -soname equivalent, this is as close as it gets.
977 # The -bbigtoc option instrcuts the linker to create a TOC bigger than 64k.
978 # This is neccesary for some submodules such as math, but it does make running
979 # the tests a tad slower.
981 # The above options are definately for AIX 5.x, and most likely also for
982 # AIX 4.x and AIX 6.x. For details about the AIX linker see:
983 # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
986 OPTIONS on $(targets) += -Wl,-brtl -Wl,-bnoipath -Wl,-bbigtoc ;
989 if <runtime-link>static in $(properties)
991 OPTIONS on $(targets) += -static ;
996 # On Darwin, the -s option to ld does not work unless we pass -static,
997 # and passing -static unconditionally is a bad idea. So, do not pass -s
998 # at all and darwin.jam will use a separate 'strip' invocation.
999 RPATH on $(targets) +=
1000 [ feature.get-values <dll-path> : $(properties) ] ;
1001 # This does not support -R.
1002 RPATH_OPTION on $(targets) += -rpath ;
1003 # -rpath-link is not supported at all.
1006 if <runtime-link>static in $(properties)
1008 OPTIONS on $(targets) += -static ;
1012 # On VxWorks we want to reflect what ever special flags have been set in the
1013 # environment for the CPU we are targeting in the cross build
1014 toolset.flags $(toolset).link OPTIONS $(condition)/<strip>on : -Wl,--strip-all : unchecked ;
1015 toolset.flags $(toolset).link OPTIONS $(condition)/<link>static : [ os.environ LDFLAGS_STATIC ] : unchecked ;
1016 toolset.flags $(toolset).link.dll OPTIONS $(condition) : [ os.environ LDFLAGS_SO ] : unchecked ;
1017 toolset.flags $(toolset).link OPTIONS $(condition)/<link>shared : [ os.environ LDFLAGS_DYNAMIC ] : unchecked ;
1021 # Strip the binary when no debugging is needed. We use --strip-all flag
1022 # as opposed to -s since icc (intel's compiler) is generally
1023 # option-compatible with and inherits from the gcc toolset, but does not
1025 if <strip>on in $(properties)
1027 OPTIONS on $(targets) += -Wl,--strip-all ;
1029 RPATH on $(targets) +=
1030 [ feature.get-values <dll-path> : $(properties) ] ;
1031 RPATH_OPTION on $(targets) += -rpath ;
1032 RPATH_LINK on $(targets) +=
1033 [ feature.get-values <xdll-path> : $(properties) ] ;
1034 START-GROUP on $(targets) += -Wl,--start-group ;
1035 END-GROUP on $(targets) += -Wl,--end-group ;
1037 # gnu ld has the ability to change the search behaviour for libraries
1038 # referenced by the -l switch. These modifiers are -Bstatic and
1039 # -Bdynamic and change search for -l switches that follow them. The
1040 # following list shows the tried variants. Search stops at the first
1041 # variant that has a match.
1043 # *nix: -Bstatic -lxxx
1046 # *nix: -Bdynamic -lxxx
1050 # windows (mingw, cygwin) -Bstatic -lxxx
1054 # windows (mingw, cygwin) -Bdynamic -lxxx
1064 # (*) This is for cygwin
1065 # Please note that -Bstatic and -Bdynamic are not a guarantee that a
1066 # static or dynamic lib indeed gets linked in. The switches only change
1069 # On *nix mixing shared libs with static runtime is not a good idea.
1070 if <runtime-link>shared in $(properties)
1072 FINDLIBS-ST-PFX on $(targets) += -Wl,-Bstatic ;
1073 FINDLIBS-SA-PFX on $(targets) += -Wl,-Bdynamic ;
1076 # On windows allow mixing of static and dynamic libs with static
1077 # runtime is not a good idea.
1078 if <runtime-link>static in $(properties) && <target-os>windows in $(properties)
1080 FINDLIBS-ST-PFX on $(targets) += -Wl,-Bstatic ;
1081 FINDLIBS-SA-PFX on $(targets) += -Wl,-Bdynamic ;
1082 OPTIONS on $(targets) += -Wl,-Bstatic ;
1085 HAVE_SONAME on $(targets) += "" ;
1086 SONAME_OPTION on $(targets) += -h ;
1089 if <runtime-link>static in $(properties)
1091 OPTIONS on $(targets) += -static ;
1096 if <strip>on in $(properties)
1098 OPTIONS on $(targets) += -Wl,-s ;
1100 if <link>shared in $(properties)
1102 OPTIONS on $(targets) += -fPIC ;
1105 HAVE_SONAME on $(targets) += "" ;
1106 SONAME_OPTION on $(targets) += +h ;
1110 # No --strip-all, just -s.
1112 <toolset-$(toolset):linker-type>osf/$(condition)/<strip>on
1115 RPATH on $(targets) += [ feature.get-values <dll-path> ] ;
1116 # This does not support -R.
1117 RPATH_OPTION on $(targets) += -rpath ;
1118 # -rpath-link is not supported at all.
1121 if <runtime-link>static in $(properties)
1123 OPTIONS on $(targets) += -static ;
1128 if <strip>on in $(properties)
1130 OPTIONS on $(targets) += -Wl,-s ;
1132 RPATH on $(targets) += [ feature.get-values <dll-path> ] ;
1133 # Solaris linker does not have a separate -rpath-link, but allows using
1134 # -L for the same purpose.
1135 LINKPATH on $(targets) += [ feature.get-values <xdll-path> ] ;
1137 # This permits shared libraries with non-PIC code on Solaris.
1138 # VP, 2004/09/07: Now that we have -fPIC hardcode in link.dll, the
1139 # following is not needed. Whether -fPIC should be hardcoded, is a
1140 # separate question.
1141 # AH, 2004/10/16: it is still necessary because some tests link against
1142 # static libraries that were compiled without PIC.
1143 if <link>shared in $(properties)
1145 OPTIONS on $(targets) += -mimpure-text ;
1149 if <runtime-link>static in $(properties)
1151 OPTIONS on $(targets) += -static ;
1156 # For <runtime-link>static we made sure there are no dynamic libraries in the
1157 # link. On HP-UX not all system libraries exist as archived libraries (for
1158 # example, there is no libunwind.a), so, on this platform, the -static option
1159 # cannot be specified.
1163 # Enclose the RPATH variable on 'targets' in double quotes, unless it is already
1164 # enclosed in single quotes. This special casing is done because it is common to
1165 # pass '$ORIGIN' to linker -- and it has to have single quotes to prevent shell
1166 # expansion -- and if we add double quotes then the preventing properties of
1167 # single quotes disappear.
1169 rule quote-rpath ( targets * )
1171 local r = [ on $(targets[1]) return $(RPATH) ] ;
1172 if ! [ MATCH ('.*') : $(r) ]
1176 RPATH on $(targets) = $(r) ;
1179 # Declare actions for linking.
1180 rule link ( targets * : sources * : properties * )
1182 SPACE on $(targets) = " " ;
1183 # Serialize execution of the 'link' action, since running N links in
1184 # parallel is just slower. For now, serialize only gcc links, it might be a
1185 # good idea to serialize all links.
1186 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
1187 quote-rpath $(targets) ;
1190 actions link bind LIBRARIES
1192 "$(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)
1195 rule link.dll ( targets * : sources * : properties * )
1197 SPACE on $(targets) = " " ;
1198 JAM_SEMAPHORE on $(targets) = <s>gcc-link-semaphore ;
1199 quote-rpath $(targets) ;
1202 # Differs from 'link' above only by -shared.
1203 actions link.dll bind LIBRARIES
1205 "$(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)
1209 ### Archive library generation.
1212 # Default value. Mostly for the sake of intel-linux that inherits from gcc, but
1213 # does not have the same logic to set the .AR variable. We can put the same
1214 # logic in intel-linux, but that is hardly worth the trouble as on Linux, 'ar'
1215 # is always available.
1219 toolset.flags gcc.archive AROPTIONS <archiveflags> ;
1221 rule archive ( targets * : sources * : properties * )
1223 # Always remove archive and start again. Here is the rationale from
1227 # I had a file, say a1.c, that was included into liba.a. I moved a1.c to
1228 # a2.c, updated my Jamfiles and rebuilt. My program was crashing with absurd
1229 # errors. After some debugging I traced it back to the fact that a1.o was
1234 # Originally removing the archive was done by splicing an RM onto the
1235 # archive action. That makes archives fail to build on NT when they have
1236 # many files because it will no longer execute the action directly and blow
1237 # the line length limit. Instead we remove the file in a different action,
1238 # just before building the archive.
1240 local clean.a = $(targets[1])(clean) ;
1241 TEMPORARY $(clean.a) ;
1243 LOCATE on $(clean.a) = [ on $(targets[1]) return $(LOCATE) ] ;
1244 DEPENDS $(clean.a) : $(sources) ;
1245 DEPENDS $(targets) : $(clean.a) ;
1246 common.RmTemps $(clean.a) : $(targets) ;
1249 # Declare action for creating static libraries.
1250 # The letter 'r' means to add files to the archive with replacement. Since we
1251 # remove archive, we do not care about replacement, but there is no option "add
1252 # without replacement".
1253 # The letter 'c' suppresses the warning in case the archive does not exists yet.
1254 # That warning is produced only on some platforms, for whatever reasons.
1256 actions piecemeal archive
1258 "$(.AR)" $(AROPTIONS) rc "$(<)" "$(>)"
1263 ### CPU architecture and instruction set options.
1266 local rule cpu-flags ( toolset variable : architecture : instruction-set + :
1267 values + : default ? )
1271 toolset.flags $(toolset) $(variable)
1272 <architecture>$(architecture)/<instruction-set> : $(values) ;
1274 toolset.flags $(toolset) $(variable)
1275 <architecture>/<instruction-set>$(instruction-set)
1276 <architecture>$(architecture)/<instruction-set>$(instruction-set)
1281 # Set architecture/instruction-set options.
1283 # x86 and compatible
1284 # The 'native' option appeared in gcc 4.2 so we cannot safely use it as default.
1285 # Use i686 instead for 32-bit.
1286 toolset.flags gcc OPTIONS <architecture>x86/<address-model>32/<instruction-set> : -march=i686 ;
1287 cpu-flags gcc OPTIONS : x86 : native : -march=native ;
1288 cpu-flags gcc OPTIONS : x86 : i486 : -march=i486 ;
1289 cpu-flags gcc OPTIONS : x86 : i586 : -march=i586 ;
1290 cpu-flags gcc OPTIONS : x86 : i686 : -march=i686 ;
1291 cpu-flags gcc OPTIONS : x86 : pentium : -march=pentium ;
1292 cpu-flags gcc OPTIONS : x86 : pentium-mmx : -march=pentium-mmx ;
1293 cpu-flags gcc OPTIONS : x86 : pentiumpro : -march=pentiumpro ;
1294 cpu-flags gcc OPTIONS : x86 : pentium2 : -march=pentium2 ;
1295 cpu-flags gcc OPTIONS : x86 : pentium3 : -march=pentium3 ;
1296 cpu-flags gcc OPTIONS : x86 : pentium3m : -march=pentium3m ;
1297 cpu-flags gcc OPTIONS : x86 : pentium-m : -march=pentium-m ;
1298 cpu-flags gcc OPTIONS : x86 : pentium4 : -march=pentium4 ;
1299 cpu-flags gcc OPTIONS : x86 : pentium4m : -march=pentium4m ;
1300 cpu-flags gcc OPTIONS : x86 : prescott : -march=prescott ;
1301 cpu-flags gcc OPTIONS : x86 : nocona : -march=nocona ;
1302 cpu-flags gcc OPTIONS : x86 : core2 : -march=core2 ;
1303 cpu-flags gcc OPTIONS : x86 : conroe : -march=core2 ;
1304 cpu-flags gcc OPTIONS : x86 : conroe-xe : -march=core2 ;
1305 cpu-flags gcc OPTIONS : x86 : conroe-l : -march=core2 ;
1306 cpu-flags gcc OPTIONS : x86 : allendale : -march=core2 ;
1307 cpu-flags gcc OPTIONS : x86 : wolfdale : -march=core2 -msse4.1 ;
1308 cpu-flags gcc OPTIONS : x86 : merom : -march=core2 ;
1309 cpu-flags gcc OPTIONS : x86 : merom-xe : -march=core2 ;
1310 cpu-flags gcc OPTIONS : x86 : kentsfield : -march=core2 ;
1311 cpu-flags gcc OPTIONS : x86 : kentsfield-xe : -march=core2 ;
1312 cpu-flags gcc OPTIONS : x86 : yorksfield : -march=core2 ;
1313 cpu-flags gcc OPTIONS : x86 : penryn : -march=core2 ;
1314 cpu-flags gcc OPTIONS : x86 : corei7 : -march=corei7 ;
1315 cpu-flags gcc OPTIONS : x86 : nehalem : -march=corei7 ;
1316 cpu-flags gcc OPTIONS : x86 : corei7-avx : -march=corei7-avx ;
1317 cpu-flags gcc OPTIONS : x86 : sandy-bridge : -march=corei7-avx ;
1318 cpu-flags gcc OPTIONS : x86 : core-avx-i : -march=core-avx-i ;
1319 cpu-flags gcc OPTIONS : x86 : ivy-bridge : -march=core-avx-i ;
1320 cpu-flags gcc OPTIONS : x86 : haswell : -march=core-avx-i -mavx2 -mfma -mbmi -mbmi2 -mlzcnt ;
1321 cpu-flags gcc OPTIONS : x86 : broadwell : -march=broadwell ;
1322 cpu-flags gcc OPTIONS : x86 : skylake : -march=skylake ;
1323 cpu-flags gcc OPTIONS : x86 : skylake-avx512 : -march=skylake-avx512 ;
1324 cpu-flags gcc OPTIONS : x86 : cannonlake : -march=skylake-avx512 -mavx512vbmi -mavx512ifma -msha ;
1325 cpu-flags gcc OPTIONS : x86 : k6 : -march=k6 ;
1326 cpu-flags gcc OPTIONS : x86 : k6-2 : -march=k6-2 ;
1327 cpu-flags gcc OPTIONS : x86 : k6-3 : -march=k6-3 ;
1328 cpu-flags gcc OPTIONS : x86 : athlon : -march=athlon ;
1329 cpu-flags gcc OPTIONS : x86 : athlon-tbird : -march=athlon-tbird ;
1330 cpu-flags gcc OPTIONS : x86 : athlon-4 : -march=athlon-4 ;
1331 cpu-flags gcc OPTIONS : x86 : athlon-xp : -march=athlon-xp ;
1332 cpu-flags gcc OPTIONS : x86 : athlon-mp : -march=athlon-mp ;
1334 cpu-flags gcc OPTIONS : x86 : k8 : -march=k8 ;
1335 cpu-flags gcc OPTIONS : x86 : opteron : -march=opteron ;
1336 cpu-flags gcc OPTIONS : x86 : athlon64 : -march=athlon64 ;
1337 cpu-flags gcc OPTIONS : x86 : athlon-fx : -march=athlon-fx ;
1338 cpu-flags gcc OPTIONS : x86 : k8-sse3 : -march=k8-sse3 ;
1339 cpu-flags gcc OPTIONS : x86 : opteron-sse3 : -march=opteron-sse3 ;
1340 cpu-flags gcc OPTIONS : x86 : athlon64-sse3 : -march=athlon64-sse3 ;
1341 cpu-flags gcc OPTIONS : x86 : amdfam10 : -march=amdfam10 ;
1342 cpu-flags gcc OPTIONS : x86 : barcelona : -march=barcelona ;
1343 cpu-flags gcc OPTIONS : x86 : bdver1 : -march=bdver1 ;
1344 cpu-flags gcc OPTIONS : x86 : bdver2 : -march=bdver2 ;
1345 cpu-flags gcc OPTIONS : x86 : bdver3 : -march=bdver3 ;
1346 cpu-flags gcc OPTIONS : x86 : bdver4 : -march=bdver4 ;
1347 cpu-flags gcc OPTIONS : x86 : btver1 : -march=btver1 ;
1348 cpu-flags gcc OPTIONS : x86 : btver2 : -march=btver2 ;
1349 cpu-flags gcc OPTIONS : x86 : znver1 : -march=znver1 ;
1350 cpu-flags gcc OPTIONS : x86 : winchip-c6 : -march=winchip-c6 ;
1351 cpu-flags gcc OPTIONS : x86 : winchip2 : -march=winchip2 ;
1352 cpu-flags gcc OPTIONS : x86 : c3 : -march=c3 ;
1353 cpu-flags gcc OPTIONS : x86 : c3-2 : -march=c3-2 ;
1355 cpu-flags gcc OPTIONS : x86 : atom : -march=atom ;
1357 cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 : default ;
1358 cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ;
1359 cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ;
1360 cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ;
1361 cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ;
1362 cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ;
1363 cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ;
1364 cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ;
1365 cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ;
1366 cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ;
1367 cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ;
1368 cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ;
1369 cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ;
1370 cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ;
1372 cpu-flags gcc OPTIONS : power : 403 : -mcpu=403 ;
1373 cpu-flags gcc OPTIONS : power : 505 : -mcpu=505 ;
1374 cpu-flags gcc OPTIONS : power : 601 : -mcpu=601 ;
1375 cpu-flags gcc OPTIONS : power : 602 : -mcpu=602 ;
1376 cpu-flags gcc OPTIONS : power : 603 : -mcpu=603 ;
1377 cpu-flags gcc OPTIONS : power : 603e : -mcpu=603e ;
1378 cpu-flags gcc OPTIONS : power : 604 : -mcpu=604 ;
1379 cpu-flags gcc OPTIONS : power : 604e : -mcpu=604e ;
1380 cpu-flags gcc OPTIONS : power : 620 : -mcpu=620 ;
1381 cpu-flags gcc OPTIONS : power : 630 : -mcpu=630 ;
1382 cpu-flags gcc OPTIONS : power : 740 : -mcpu=740 ;
1383 cpu-flags gcc OPTIONS : power : 7400 : -mcpu=7400 ;
1384 cpu-flags gcc OPTIONS : power : 7450 : -mcpu=7450 ;
1385 cpu-flags gcc OPTIONS : power : 750 : -mcpu=750 ;
1386 cpu-flags gcc OPTIONS : power : 801 : -mcpu=801 ;
1387 cpu-flags gcc OPTIONS : power : 821 : -mcpu=821 ;
1388 cpu-flags gcc OPTIONS : power : 823 : -mcpu=823 ;
1389 cpu-flags gcc OPTIONS : power : 860 : -mcpu=860 ;
1390 cpu-flags gcc OPTIONS : power : 970 : -mcpu=970 ;
1391 cpu-flags gcc OPTIONS : power : 8540 : -mcpu=8540 ;
1392 cpu-flags gcc OPTIONS : power : power : -mcpu=power ;
1393 cpu-flags gcc OPTIONS : power : power2 : -mcpu=power2 ;
1394 cpu-flags gcc OPTIONS : power : power3 : -mcpu=power3 ;
1395 cpu-flags gcc OPTIONS : power : power4 : -mcpu=power4 ;
1396 cpu-flags gcc OPTIONS : power : power5 : -mcpu=power5 ;
1397 cpu-flags gcc OPTIONS : power : powerpc : -mcpu=powerpc ;
1398 cpu-flags gcc OPTIONS : power : powerpc64 : -mcpu=powerpc64 ;
1399 cpu-flags gcc OPTIONS : power : rios : -mcpu=rios ;
1400 cpu-flags gcc OPTIONS : power : rios1 : -mcpu=rios1 ;
1401 cpu-flags gcc OPTIONS : power : rios2 : -mcpu=rios2 ;
1402 cpu-flags gcc OPTIONS : power : rsc : -mcpu=rsc ;
1403 cpu-flags gcc OPTIONS : power : rs64a : -mcpu=rs64 ;
1404 # AIX variant of RS/6000 & PowerPC
1405 toolset.flags gcc AROPTIONS <address-model>64/<target-os>aix : "-X64" ;