From 276452f659274bdf39653a43f1a712d4bbe05a78 Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Wed, 6 Nov 2024 09:26:34 +0000 Subject: [PATCH 1/2] Build controls for AIX with xlclang and openxl toolchains --- src/engine/build.sh | 19 ++++- src/tools/common.jam | 2 + src/tools/openxl.jam | 161 ++++++++++++++++++++++++++++++++++++++++++ src/tools/xlclang.jam | 161 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 342 insertions(+), 1 deletion(-) create mode 100644 src/tools/openxl.jam create mode 100644 src/tools/xlclang.jam diff --git a/src/engine/build.sh b/src/engine/build.sh index 29d08fcbe9..1e0c3a3c92 100755 --- a/src/engine/build.sh +++ b/src/engine/build.sh @@ -66,7 +66,7 @@ You can specify the toolset as the argument, i.e.: Toolsets supported by this script are: acc, clang, como, gcc, intel-darwin, intel-linux, kcc, kylix, mipspro, - pathscale, pgi, qcc, sun, sunpro, tru64cxx, vacpp + pathscale, pgi, qcc, sun, sunpro, tru64cxx, vacpp, xlclang, openxl For any toolset you can override the path to the compiler with the '--cxx' option. You can also use additional flags for the compiler with the @@ -156,6 +156,11 @@ check_toolset () # Prefer Clang (clang) on macOS.. if test_toolset clang && test_uname Darwin && test_compiler clang++$TOOLSET_SUFFIX -x c++ -std=c++11 ; then B2_TOOLSET=clang$TOOLSET_SUFFIX ; return ${TRUE} ; fi + # Prefer IBMClang (ibm-clang_r) on AIX if present + if test_toolset openxl && test_uname AIX && test_compiler ibm-clang++_r$TOOLSET_SUFFIX -x c++ -std=c++11 ; then B2_TOOLSET=openxl$TOOLSET_SUFFIX ; return ${TRUE} ; fi + # Then prefer XLClang (xlclang) on AIX + if test_toolset xlclang && test_uname AIX && test_compiler xlclang++$TOOLSET_SUFFIX -x c++ -std=c++11 ; then B2_TOOLSET=xlclang$TOOLSET_SUFFIX ; return ${TRUE} ; fi + # GCC (gcc) with -pthread arg (for AIX and others).. if test_toolset gcc && test_compiler g++$TOOLSET_SUFFIX -x c++ -std=c++11 -pthread ; then B2_TOOLSET=gcc$TOOLSET_SUFFIX ; return ${TRUE} ; fi # GCC (gcc).. @@ -413,6 +418,18 @@ case "${B2_TOOLSET}" in B2_CXXFLAGS_DEBUG="O0 -Wc,-fno-inline -gstabs+" ;; + xlclang) + CXX_VERSION_OPT=-qversion + B2_CXXFLAGS_RELEASE="-O3 -s -qstrict -qinline" + B2_CXXFLAGS_DEBUG="-g -O0 -qnoinline -pg" + ;; + + openxl) + CXX_VERSION_OPT=--version + B2_CXXFLAGS_RELEASE="-O3 -Wl,-s" + B2_CXXFLAGS_DEBUG="-g -O0" + ;; + cxx) CXX_VERSION_OPT=${CXX_VERSION_OPT:---version} ;; diff --git a/src/tools/common.jam b/src/tools/common.jam index 42f2833c93..398550955c 100644 --- a/src/tools/common.jam +++ b/src/tools/common.jam @@ -957,6 +957,8 @@ local rule toolset-tag ( name : type ? : property-set ) case sun* : tag += sw ; case tru64cxx* : tag += tru ; case vacpp* : tag += xlc ; + case xlclang* : tag += xlclang ; + case openxl* : tag += openxl ; } local version = [ MATCH "([0123456789]+)[.]?([0123456789]*)" : $(properties) ] ; diff --git a/src/tools/openxl.jam b/src/tools/openxl.jam new file mode 100644 index 0000000000..41e3c9a1b6 --- /dev/null +++ b/src/tools/openxl.jam @@ -0,0 +1,161 @@ +# Copyright Vladimir Prus 2004. +# Copyright Toon Knapen 2004. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt +# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) + +#| tag::doc[] + +[[bbv2.reference.tools.compiler.openxl]] += IBM Visual Age + +The `openxl` module supports the http://www.ibm.com/software/ad/openxl[IBM +Visual Age] C++ Compiler, for the AIX operating system. Versions 7.1 and +8.0 are known to work. + +The module is initialized using the following syntax: + +---- +using openxl ; +---- + +The module does not accept any initialization options. The compiler +should be installed in the `/usr/openxl/bin` directory. + +Later versions of Visual Age are known as XL C/C++. They were not tested +with the the `openxl` module. + +|# # end::doc[] + +# +# B2 V2 toolset for the IBM XL C++ compiler +# + +import toolset : flags ; +import feature ; +import common ; +import generators ; +import os ; + +feature.extend toolset : openxl ; +toolset.inherit openxl : unix ; +generators.override openxl.prebuilt : builtin.prebuilt ; +generators.override openxl.searched-lib-generator : searched-lib-generator ; + +# Configure the openxl toolset +rule init ( version ? : command * : options * ) +{ + local condition = [ + common.check-init-parameters openxl : version $(version) ] ; + + command = [ common.get-invocation-command openxl : ibm-clang++_r + : $(command) : "/opt/IBM/openxlC/17.1.0/bin/ibm-clang++_r" ] ; + + common.handle-options openxl : $(condition) : $(command) : $(options) ; +} + +# Declare generators +generators.register-c-compiler openxl.compile.c : C : OBJ : openxl ; +generators.register-c-compiler openxl.compile.c++ : CPP : OBJ : openxl ; + +# Declare flags +flags openxl CFLAGS speed : -O3 ; +flags openxl CFLAGS space : -O2 -Os ; + +# Discretionary inlining (not recommended) +flags openxl CFLAGS off : -fno-inline-functions ; +flags openxl CFLAGS on : ; +#flags openxl CFLAGS full : -qinline ; +flags openxl CFLAGS full : ; + +# Exception handling +flags openxl C++FLAGS off : -fno-exceptions ; +flags openxl C++FLAGS on : ; + +# Run-time Type Identification +flags openxl C++FLAGS off : -fno-rtti ; +flags openxl C++FLAGS on : ; + +# Enable 64-bit memory addressing model +flags openxl CFLAGS 64 : -m64 ; +flags openxl LINKFLAGS 64 : -m64 ; +flags openxl ARFLAGS aix/64 : -X 64 ; + +# Use absolute path when generating debug information +flags openxl CFLAGS on : -g ; +flags openxl LINKFLAGS on : -g ; +flags openxl LINKFLAGS off : ; + +if [ os.name ] = AIX +{ + flags openxl.compile C++FLAGS : -ffunction-sections ; + + # The -bnoipath strips the prepending (relative) path of libraries from + # the loader section in the target library or executable. Hence, during + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without + # this option, the prepending (relative) path + library name is + # hard-coded in the loader section, causing *only* this path to be + # searched during load-time. Note that the AIX linker does not have an + # -soname equivalent, this is as close as it gets. + # + # The above options are definitely for AIX 5.x, and most likely also for + # AIX 4.x and AIX 6.x. For details about the AIX linker see: + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf + # + flags openxl.link LINKFLAGS shared : -bnoipath ; + + # Run-time linking + flags openxl.link EXE-LINKFLAGS shared : -brtl ; +} + +# Profiling +flags openxl CFLAGS on : -pg ; +flags openxl LINKFLAGS on : -pg ; + +flags openxl.compile OPTIONS ; +flags openxl.compile.c++ OPTIONS ; +flags openxl DEFINES ; +flags openxl UNDEFS ; +flags openxl HDRS ; +flags openxl STDHDRS ; +flags openxl.link OPTIONS ; +flags openxl ARFLAGS ; + +flags openxl LIBPATH ; +flags openxl NEEDLIBS ; +flags openxl FINDLIBS ; +flags openxl FINDLIBS ; + +# Select the compiler name according to the threading model. +flags openxl OPENXL_C_COMPILER single : ibm-clang_r ; +flags openxl OPENXL_C_COMPILER multi : ibm-clang_r ; +flags openxl OPENXL_CXX_COMPILER single : ibm-clang++_r ; +flags openxl OPENXL_CXX_COMPILER multi : ibm-clang++_r ; + +SPACE = " " ; + +actions openxl.link bind NEEDLIBS +{ + $(OPENXL_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions openxl.link.dll bind NEEDLIBS +{ + $(OPENXL_CXX_COMPILER) -shared -Wl,-G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions openxl.compile.c +{ + $(OPENXL_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions openxl.compile.c++ +{ + $(OPENXL_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions updated together piecemeal openxl.archive +{ + ar $(ARFLAGS) ru "$(<)" "$(>)" +} diff --git a/src/tools/xlclang.jam b/src/tools/xlclang.jam new file mode 100644 index 0000000000..40e7e185ae --- /dev/null +++ b/src/tools/xlclang.jam @@ -0,0 +1,161 @@ +# Copyright Vladimir Prus 2004. +# Copyright Toon Knapen 2004. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE.txt +# or copy at https://www.bfgroup.xyz/b2/LICENSE.txt) + +#| tag::doc[] + +[[bbv2.reference.tools.compiler.xlclang]] += IBM Visual Age + +The `xlclang` module supports the http://www.ibm.com/software/ad/xlclang[IBM +Visual Age] C++ Compiler, for the AIX operating system. Versions 7.1 and +8.0 are known to work. + +The module is initialized using the following syntax: + +---- +using xlclang ; +---- + +The module does not accept any initialization options. The compiler +should be installed in the `/usr/xlclang/bin` directory. + +Later versions of Visual Age are known as XL C/C++. They were not tested +with the the `xlclang` module. + +|# # end::doc[] + +# +# B2 V2 toolset for the IBM XL C++ compiler +# + +import toolset : flags ; +import feature ; +import common ; +import generators ; +import os ; + +feature.extend toolset : xlclang ; +toolset.inherit xlclang : unix ; +generators.override xlclang.prebuilt : builtin.prebuilt ; +generators.override xlclang.searched-lib-generator : searched-lib-generator ; + +# Configure the xlclang toolset +rule init ( version ? : command * : options * ) +{ + local condition = [ + common.check-init-parameters xlclang : version $(version) ] ; + + command = [ common.get-invocation-command xlclang : xlclang++ + : $(command) : "/opt/IBM/xlC/16.1.0/bin/xlclang++" ] ; + + common.handle-options xlclang : $(condition) : $(command) : $(options) ; +} + +# Declare generators +generators.register-c-compiler xlclang.compile.c : C : OBJ : xlclang ; +generators.register-c-compiler xlclang.compile.c++ : CPP : OBJ : xlclang ; + +# Declare flags +flags xlclang CFLAGS speed : -O3 -qstrict ; +flags xlclang CFLAGS space : -O2 -qcompact ; + +# Discretionary inlining (not recommended) +flags xlclang CFLAGS off : -qnoinline ; +flags xlclang CFLAGS on : -qinline ; +#flags xlclang CFLAGS full : -qinline ; +flags xlclang CFLAGS full : ; + +# Exception handling +flags xlclang C++FLAGS off : -qnoeh ; +flags xlclang C++FLAGS on : -qeh ; + +# Run-time Type Identification +flags xlclang C++FLAGS off : -qnortti ; +flags xlclang C++FLAGS on : -qrtti ; + +# Enable 64-bit memory addressing model +flags xlclang CFLAGS 64 : -q64 ; +flags xlclang LINKFLAGS 64 : -q64 ; +flags xlclang ARFLAGS aix/64 : -X 64 ; + +# Use absolute path when generating debug information +flags xlclang CFLAGS on : -g -qfullpath ; +flags xlclang LINKFLAGS on : -g -qfullpath ; +flags xlclang LINKFLAGS off : -s ; + +if [ os.name ] = AIX +{ + flags xlclang.compile C++FLAGS : -qfuncsect ; + + # The -bnoipath strips the prepending (relative) path of libraries from + # the loader section in the target library or executable. Hence, during + # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded + # -blibpath (*similar* to -lrpath/-lrpath-link) is searched. Without + # this option, the prepending (relative) path + library name is + # hard-coded in the loader section, causing *only* this path to be + # searched during load-time. Note that the AIX linker does not have an + # -soname equivalent, this is as close as it gets. + # + # The above options are definitely for AIX 5.x, and most likely also for + # AIX 4.x and AIX 6.x. For details about the AIX linker see: + # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf + # + flags xlclang.link LINKFLAGS shared : -bnoipath ; + + # Run-time linking + flags xlclang.link EXE-LINKFLAGS shared : -brtl ; +} + +# Profiling +flags xlclang CFLAGS on : -pg ; +flags xlclang LINKFLAGS on : -pg ; + +flags xlclang.compile OPTIONS ; +flags xlclang.compile.c++ OPTIONS ; +flags xlclang DEFINES ; +flags xlclang UNDEFS ; +flags xlclang HDRS ; +flags xlclang STDHDRS ; +flags xlclang.link OPTIONS ; +flags xlclang ARFLAGS ; + +flags xlclang LIBPATH ; +flags xlclang NEEDLIBS ; +flags xlclang FINDLIBS ; +flags xlclang FINDLIBS ; + +# Select the compiler name according to the threading model. +flags xlclang XLCLANG_C_COMPILER single : xlclang ; +flags xlclang XLCLANG_C_COMPILER multi : xlclang ; +flags xlclang XLCLANG_CXX_COMPILER single : xlclang++ ; +flags xlclang XLCLANG_CXX_COMPILER multi : xlclang++ ; + +SPACE = " " ; + +actions xlclang.link bind NEEDLIBS +{ + $(XLCLANG_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlclang.link.dll bind NEEDLIBS +{ + $(XLCLANG_CXX_COMPILER) -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS) +} + +actions xlclang.compile.c +{ + $(XLCLANG_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions xlclang.compile.c++ +{ + $(XLCLANG_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" +} + +actions updated together piecemeal xlclang.archive +{ + ar $(ARFLAGS) ru "$(<)" "$(>)" +} From ad0a8d00e23e4fdd9d0db5c673c69850438f272c Mon Sep 17 00:00:00 2001 From: Chris Ward Date: Tue, 12 Nov 2024 14:54:34 +0000 Subject: [PATCH 2/2] Link in the openxl and xlclang documentation --- doc/src/reference.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/reference.adoc b/doc/src/reference.adoc index b58544fb36..fb07db3584 100644 --- a/doc/src/reference.adoc +++ b/doc/src/reference.adoc @@ -335,9 +335,11 @@ include::../../src/tools/emscripten.jam[tag=doc] include::../../src/tools/gcc.jam[tag=doc] include::../../src/tools/hp_cxx.jam[tag=doc] include::../../src/tools/intel.jam[tag=doc] +include::../../src/tools/openxl.jam[tag=doc] include::../../src/tools/msvc.jam[tag=doc] include::../../src/tools/sun.jam[tag=doc] include::../../src/tools/vacpp.jam[tag=doc] +include::../../src/tools/xlclang.jam[tag=doc] :leveloffset: -3 === Third-party libraries