From 233df6e75bb5531fd811eecf0888c753b866079a Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 25 Jun 2017 15:04:00 -0500 Subject: [PATCH] Get clang init-lib callin to work. Fixes using the proper toolset module instead of always gcc for the flags in the init-lib rule. Creates the target-os/linker-type mapping on new toolset kinds instead of just gcc. --- src/tools/clang-linux.jam | 2 +- src/tools/clang.jam | 3 -- src/tools/gcc.jam | 86 ++++++++++++++++++++------------------- 3 files changed, 46 insertions(+), 45 deletions(-) diff --git a/src/tools/clang-linux.jam b/src/tools/clang-linux.jam index 4e7965784..14109292c 100644 --- a/src/tools/clang-linux.jam +++ b/src/tools/clang-linux.jam @@ -60,7 +60,7 @@ rule init ( version ? : command * : options * ) { common.handle-options clang-linux : $(condition) : $(command) : $(options) ; - gcc.init-link-flags clang gnu $(condition) ; + gcc.init-link-flags clang linux $(condition) ; } ############################################################################### diff --git a/src/tools/clang.jam b/src/tools/clang.jam index e4ce453a0..2d89f3807 100644 --- a/src/tools/clang.jam +++ b/src/tools/clang.jam @@ -12,9 +12,6 @@ import toolset ; feature.extend toolset : clang ; feature.subfeature toolset clang : platform : : propagated link-incompatible ; -feature.subfeature toolset clang : linker-type : - gnu aix darwin hpux osf sun : propagated link-incompatible ; - rule init ( * : * ) { if [ os.name ] = MACOSX diff --git a/src/tools/gcc.jam b/src/tools/gcc.jam index 9237853d6..92f8a8568 100644 --- a/src/tools/gcc.jam +++ b/src/tools/gcc.jam @@ -195,7 +195,7 @@ rule init ( version ? : command * : options * ) common.handle-options gcc : $(condition) : $(command) : $(options) ; - init-link-flags gcc - $(condition) ; + init-link-flags gcc "" $(condition) ; # If gcc is installed in a non-standard location, we would need to add # LD_LIBRARY_PATH when running programs created with it (for unit-test/run @@ -740,21 +740,25 @@ toolset.flags gcc.link LIBRARIES ; toolset.flags gcc.link.dll .IMPLIB-COMMAND windows : "-Wl,--out-implib," ; toolset.flags gcc.link.dll .IMPLIB-COMMAND cygwin : "-Wl,--out-implib," ; -toolset.add-requirements - gcc,aix:aix - gcc,darwin:darwin - gcc,hpux:hpux - gcc,osf:osf - gcc,solaris:sun - ; - # Now, the vendor specific flags. # The parameter linker can be either aix, darwin, gnu, hpux, osf or sun. -rule init-link-flags ( toolset _ignored_ condition ) +rule init-link-flags ( toolset subtool condition ) { + local tool-module = $(toolset) ; + if $(subtool) != "" + { + tool-module = $(tool-module)-$(subtool) ; + } ## Need to define the linker-type feature once for each toolset module. if ! [ feature.valid ] { + toolset.add-requirements + $(condition),aix:aix + $(condition),darwin:darwin + $(condition),hpux:hpux + $(condition),osf:osf + $(condition),solaris:sun + ; feature.subfeature toolset $(toolset) : linker-type : gnu aix darwin hpux osf sun : propagated link-incompatible ; } @@ -785,12 +789,12 @@ rule init-link-flags ( toolset _ignored_ condition ) # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf # - toolset.flags $(toolset).link OPTIONS aix/$(condition) + toolset.flags $(tool-module).link OPTIONS aix/$(condition) : -Wl,-brtl -Wl,-bnoipath -Wl,-bbigtoc : unchecked ; # See note [1] - toolset.flags $(toolset).link OPTIONS aix/$(condition)/static + toolset.flags $(tool-module).link OPTIONS aix/$(condition)/static : -static : unchecked ; @@ -798,18 +802,18 @@ rule init-link-flags ( toolset _ignored_ condition ) # On Darwin, the -s option to ld does not work unless we pass -static, # and passing -static unconditionally is a bad idea. So, do not pass -s # at all and darwin.jam will use a separate 'strip' invocation. - toolset.flags $(toolset).link RPATH darwin/$(condition) + toolset.flags $(tool-module).link RPATH darwin/$(condition) : : unchecked ; # This does not support -R. - toolset.flags $(toolset).link RPATH_OPTION + toolset.flags $(tool-module).link RPATH_OPTION darwin/$(condition) : -rpath : unchecked ; # -rpath-link is not supported at all. # See note [1] - toolset.flags $(toolset).link OPTIONS darwin/$(condition)/static + toolset.flags $(tool-module).link OPTIONS darwin/$(condition)/static : -static : unchecked ; @@ -818,27 +822,27 @@ rule init-link-flags ( toolset _ignored_ condition ) # as opposed to -s since icc (intel's compiler) is generally # option-compatible with and inherits from the gcc toolset, but does not # support -s. - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS gnu/$(condition)/on : -Wl,--strip-all : unchecked ; - toolset.flags $(toolset).link RPATH + toolset.flags $(tool-module).link RPATH gnu/$(condition) : : unchecked ; - toolset.flags $(toolset).link RPATH_OPTION + toolset.flags $(tool-module).link RPATH_OPTION gnu/$(condition) : -rpath : unchecked ; - toolset.flags $(toolset).link RPATH_LINK + toolset.flags $(tool-module).link RPATH_LINK gnu/$(condition) : : unchecked ; - toolset.flags $(toolset).link START-GROUP + toolset.flags $(tool-module).link START-GROUP gnu/$(condition) : -Wl,--start-group : unchecked ; - toolset.flags $(toolset).link END-GROUP + toolset.flags $(tool-module).link END-GROUP gnu/$(condition) : -Wl,--end-group : unchecked ; @@ -876,7 +880,7 @@ rule init-link-flags ( toolset _ignored_ condition ) # search patterns! # On *nix mixing shared libs with static runtime is not a good idea. - toolset.flags $(toolset).link FINDLIBS-ST-PFX + toolset.flags $(tool-module).link FINDLIBS-ST-PFX gnu/$(condition)/shared : -Wl,-Bstatic : unchecked ; @@ -887,86 +891,86 @@ rule init-link-flags ( toolset _ignored_ condition ) # On windows allow mixing of static and dynamic libs with static # runtime is not a good idea. - toolset.flags $(toolset).link FINDLIBS-ST-PFX + toolset.flags $(tool-module).link FINDLIBS-ST-PFX gnu/$(condition)/static/windows : -Wl,-Bstatic : unchecked ; - toolset.flags $(toolset).link FINDLIBS-SA-PFX + toolset.flags $(tool-module).link FINDLIBS-SA-PFX gnu/$(condition)/static/windows : -Wl,-Bdynamic : unchecked ; - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS gnu/$(condition)/static/windows : -Wl,-Bstatic : unchecked ; - toolset.flags $(toolset).link HAVE_SONAME + toolset.flags $(tool-module).link HAVE_SONAME gnu/$(condition) : "" : unchecked ; - toolset.flags $(toolset).link SONAME_OPTION + toolset.flags $(tool-module).link SONAME_OPTION gnu/$(condition) : -h : unchecked ; # See note [1] - toolset.flags $(toolset).link OPTIONS gnu/$(condition)/static + toolset.flags $(tool-module).link OPTIONS gnu/$(condition)/static : -static : unchecked ; ## hpux : - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS hpux/$(condition)/on : -Wl,-s : unchecked ; - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS hpux/$(condition)/shared : -fPIC : unchecked ; - toolset.flags $(toolset).link HAVE_SONAME + toolset.flags $(tool-module).link HAVE_SONAME hpux/$(condition) : "" : unchecked ; - toolset.flags $(toolset).link SONAME_OPTION + toolset.flags $(tool-module).link SONAME_OPTION hpux/$(condition) : +h : unchecked ; ## osf : # No --strip-all, just -s. - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS osf/$(condition)/on : -Wl,-s : unchecked ; - toolset.flags $(toolset).link RPATH + toolset.flags $(tool-module).link RPATH osf/$(condition) : : unchecked ; # This does not support -R. - toolset.flags $(toolset).link RPATH_OPTION + toolset.flags $(tool-module).link RPATH_OPTION osf/$(condition) : -rpath : unchecked ; # -rpath-link is not supported at all. # See note [1] - toolset.flags $(toolset).link OPTIONS osf/$(condition)/static + toolset.flags $(tool-module).link OPTIONS osf/$(condition)/static : -static : unchecked ; ## sun : - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS sun/$(condition)/on : -Wl,-s : unchecked ; - toolset.flags $(toolset).link RPATH + toolset.flags $(tool-module).link RPATH sun/$(condition) : : unchecked ; # Solaris linker does not have a separate -rpath-link, but allows using # -L for the same purpose. - toolset.flags $(toolset).link LINKPATH + toolset.flags $(tool-module).link LINKPATH sun/$(condition) : : unchecked ; @@ -977,13 +981,13 @@ rule init-link-flags ( toolset _ignored_ condition ) # separate question. # AH, 2004/10/16: it is still necessary because some tests link against # static libraries that were compiled without PIC. - toolset.flags $(toolset).link OPTIONS + toolset.flags $(tool-module).link OPTIONS sun/$(condition)/shared : -mimpure-text : unchecked ; # See note [1] - toolset.flags $(toolset).link OPTIONS sun/$(condition)/static + toolset.flags $(tool-module).link OPTIONS sun/$(condition)/static : -static : unchecked ;