diff --git a/build/clang/build-19.sh b/build/clang/build-19.sh new file mode 100755 index 000000000..2c5e1aeb4 --- /dev/null +++ b/build/clang/build-19.sh @@ -0,0 +1,118 @@ +#!/usr/bin/bash +# +# {{{ CDDL HEADER +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# }}} + +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. + +. ../../lib/build.sh + +PROG=clang +PKG=ooce/developer/clang-19 +VER=19.1.0 +SUMMARY="C language family frontend for LLVM" +DESC="The Clang project provides a language front-end and tooling " +DESC+="infrastructure for languages in the C language family (C, C++, " +DESC+="Objective C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project" + +min_rel 151051 + +set_arch 64 +set_clangver +set_builddir llvm-project-$VER.src/$PROG + +SKIP_RTIME_CHECK=1 +NO_SONAME_EXPECTED=1 + +MAJVER=${VER%%.*} +MINVER=${VER%.*} +set_patchdir patches-$MAJVER + +# Using the = prefix to require the specific matching version of llvm +BUILD_DEPENDS_IPS="=ooce/developer/llvm-$MAJVER@$VER" + +RUN_DEPENDS_IPS=" + =ooce/developer/llvm-$MAJVER@$MINVER + developer/gcc$GCCVER +" + +OPREFIX=$PREFIX +PREFIX+=/llvm-$MAJVER + +PKGDIFFPATH="${PREFIX#/}/lib/$PROG" +PKGDIFF_HELPER=" + s:$PKGDIFFPATH/[0-9][0-9.]*:$PKGDIFFPATH/VERSION: +" + +XFORM_ARGS=" + -DPREFIX=${PREFIX#/} + -DOPREFIX=${OPREFIX#/} + -DPROG=$PROG + -DPKGROOT=llvm-$MAJVER + -DMEDIATOR=$PROG -DMEDIATOR_VERSION=$MAJVER + -DVERSION=$MAJVER +" + +post_install() { + for a in "${!TRIPLETS[@]}"; do + cfgfile="$DESTDIR$PREFIX/bin/${TRIPLETS[$a]}.cfg" + if cross_arch $a; then + # TODO: globbing only works reliably as long as we just have + # one cross compiler version per arch. + crossgccver=`pkg_ver $a/gcc*` + crossgccver=${crossgccver%%.*} + cxxinc="$CROSSTOOLS/$a/${TRIPLETS[$a]}/include/c++/$crossgccver" + $CAT << EOF >| $cfgfile +--gcc-install-dir=$CROSSTOOLS/$a/lib/gcc/${TRIPLETS[$a]}/$crossgccver +-fuse-ld=$CROSSTOOLS/$a/bin/ld +-stdlib++-isystem$cxxinc +-stdlib++-isystem$cxxinc/${TRIPLETS[$a]} +-stdlib++-isystem$cxxinc/backward +EOF + else + $CAT << EOF >| $cfgfile +--gcc-install-dir=$GCCPATH/lib/gcc/${TRIPLETS[$BUILD_ARCH]}/$DEFAULT_GCC_VER +EOF + fi + done +} + +CONFIGURE_OPTS[amd64]= +CONFIGURE_OPTS[amd64_WS]=" + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=\"$PREFIX\" + -DCMAKE_C_COMPILER=\"$CC\" + -DCMAKE_CXX_COMPILER=\"$CXX\" + -DCMAKE_C_LINK_FLAGS=\"${LDFLAGS[amd64]}\" + -DCMAKE_CXX_LINK_FLAGS=\"${LDFLAGS[amd64]}\" + -DCLANG_VENDOR=\"$DISTRO/$RELVER\" + -DCLANG_DEFAULT_RTLIB=libgcc + -DCLANG_DEFAULT_CXX_STDLIB=libstdc++ + -DLLVM_DIR=\"$PREFIX/lib/cmake/llvm\" + -DLLVM_INCLUDE_TESTS=OFF +" +LDFLAGS+=" -lm" +# we want to end up with '$ORIGIN/../lib' as runpath and not with +# '$PREFIX/lib:$ORIGIN/../lib'; yet we need to find libLLVM during build time +export LD_LIBRARY_PATH="$PREFIX/lib" + +init +download_source llvm llvm-project $VER.src +patch_source +prep_build cmake+ninja +build -noctf # C++ +strip_install +make_package +clean_up + +# Vim hints +# vim:ts=4:sw=4:et:fdm=marker diff --git a/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch b/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch new file mode 100644 index 000000000..02a30cc2f --- /dev/null +++ b/build/clang/patches-19/add-__illumos__-preprocessor-definition.patch @@ -0,0 +1,11 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h +--- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 ++++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 +@@ -590,6 +590,7 @@ protected: + void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, + MacroBuilder &Builder) const override { + DefineStd(Builder, "sun", Opts); ++ Builder.defineMacro("__illumos__"); + DefineStd(Builder, "unix", Opts); + Builder.defineMacro("__svr4__"); + Builder.defineMacro("__SVR4"); diff --git a/build/clang/patches-19/add-rpath-for-libstdcxx.patch b/build/clang/patches-19/add-rpath-for-libstdcxx.patch new file mode 100644 index 000000000..82c7a5832 --- /dev/null +++ b/build/clang/patches-19/add-rpath-for-libstdcxx.patch @@ -0,0 +1,66 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChain.cpp a/lib/Driver/ToolChain.cpp +--- a~/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00 ++++ a/lib/Driver/ToolChain.cpp 1970-01-01 00:00:00 +@@ -1233,9 +1233,7 @@ void ToolChain::AddClangCXXStdlibIsystem + } + + bool ToolChain::ShouldLinkCXXStdlib(const llvm::opt::ArgList &Args) const { +- return getDriver().CCCIsCXX() && +- !Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, +- options::OPT_nostdlibxx); ++ return getDriver().CCCIsCXX() && !Args.hasArg(options::OPT_nostdlibxx); + } + + void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp +--- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 ++++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 +@@ -207,6 +207,9 @@ void solaris::Linker::ConstructJob(Compi + bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs); + AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); + ++ if (ToolChain.ShouldLinkCXXStdlib(Args) && !Args.hasArg(options::OPT_r)) ++ ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); ++ + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, + options::OPT_r)) { + // Use the static OpenMP runtime with -static-openmp +@@ -215,8 +218,6 @@ void solaris::Linker::ConstructJob(Compi + addOpenMPRuntime(CmdArgs, ToolChain, Args, StaticOpenMP); + + if (D.CCCIsCXX()) { +- if (ToolChain.ShouldLinkCXXStdlib(Args)) +- ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); + CmdArgs.push_back("-lm"); + } + // Silence warnings when linking C code with a C++ '-stdlib' argument. +@@ -419,3 +420,16 @@ void Solaris::addLibStdCxxIncludePaths( + TripleStr, Multilib.includeSuffix(), DriverArgs, + CC1Args); + } ++ ++void Solaris::AddCXXStdlibLibArgs(const ArgList &Args, ++ ArgStringList &CmdArgs) const { ++ Generic_ELF::AddCXXStdlibLibArgs(Args, CmdArgs); ++ ++ if (GetCXXStdlibType(Args) != ToolChain::CST_Libstdcxx) ++ return; ++ ++ StringRef LibSuffix = getSolarisLibSuffix(getTriple()); ++ std::string MajVer = GCCInstallation.getVersion().MajorStr; ++ CmdArgs.push_back(Args.MakeArgString(StringRef("-R") ++ + "/usr/gcc/" + MajVer + "/lib" + LibSuffix)); ++} +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.h a/lib/Driver/ToolChains/Solaris.h +--- a~/lib/Driver/ToolChains/Solaris.h 1970-01-01 00:00:00 ++++ a/lib/Driver/ToolChains/Solaris.h 1970-01-01 00:00:00 +@@ -64,6 +64,9 @@ public: + addLibStdCxxIncludePaths(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + ++ void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, ++ llvm::opt::ArgStringList &CmdArgs) const override; ++ + SanitizerMask getSupportedSanitizers() const override; + + const char *getDefaultLinker() const override; diff --git a/build/clang/patches-19/default-preprocessor-definition.patch b/build/clang/patches-19/default-preprocessor-definition.patch new file mode 100644 index 000000000..8050a3d11 --- /dev/null +++ b/build/clang/patches-19/default-preprocessor-definition.patch @@ -0,0 +1,34 @@ +$NetBSD: patch-lib_Basic_Targets_OSTargets.h,v 1.4 2019/10/19 13:54:29 adam Exp $ + +Sync SunOS default defines with a working reality. + +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Basic/Targets/OSTargets.h a/lib/Basic/Targets/OSTargets.h +--- a~/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 ++++ a/lib/Basic/Targets/OSTargets.h 1970-01-01 00:00:00 +@@ -593,22 +593,15 @@ protected: + DefineStd(Builder, "unix", Opts); + Builder.defineMacro("__svr4__"); + Builder.defineMacro("__SVR4"); +- // Solaris headers require _XOPEN_SOURCE to be set to 600 for C99 and +- // newer, but to 500 for everything else. feature_test.h has a check to +- // ensure that you are not using C99 with an old version of X/Open or C89 +- // with a new version. +- if (Opts.C99) +- Builder.defineMacro("_XOPEN_SOURCE", "600"); +- else +- Builder.defineMacro("_XOPEN_SOURCE", "500"); ++ // Compatibility with GCC to satisfy requirements. + if (Opts.CPlusPlus) { +- Builder.defineMacro("__C99FEATURES__"); ++ Builder.defineMacro("__STDC_VERSION__", "199901L"); ++ Builder.defineMacro("_XOPEN_SOURCE", "600"); + Builder.defineMacro("_FILE_OFFSET_BITS", "64"); +- } +- // GCC restricts the next two to C++. + Builder.defineMacro("_LARGEFILE_SOURCE"); + Builder.defineMacro("_LARGEFILE64_SOURCE"); + Builder.defineMacro("__EXTENSIONS__"); ++ } + if (Opts.POSIXThreads) + Builder.defineMacro("_REENTRANT"); + if (this->HasFloat128) diff --git a/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch b/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch new file mode 100644 index 000000000..6d841cc57 --- /dev/null +++ b/build/clang/patches-19/no-sanitizer-runtime-lib-linking.patch @@ -0,0 +1,13 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/CommonArgs.cpp a/lib/Driver/ToolChains/CommonArgs.cpp +--- a~/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00 ++++ a/lib/Driver/ToolChains/CommonArgs.cpp 1970-01-01 00:00:00 +@@ -1366,6 +1366,9 @@ void tools::addAsNeededOption(const Tool + void tools::linkSanitizerRuntimeDeps(const ToolChain &TC, + const llvm::opt::ArgList &Args, + ArgStringList &CmdArgs) { ++ if (TC.getTriple().isOSSolaris()) ++ return; ++ + // Force linking against the system libraries sanitizers depends on + // (see PR15823 why this is necessary). + addAsNeededOption(TC, Args, CmdArgs, false); diff --git a/build/clang/patches-19/no-ssp-linking.patch b/build/clang/patches-19/no-ssp-linking.patch new file mode 100644 index 000000000..2c8ef88a4 --- /dev/null +++ b/build/clang/patches-19/no-ssp-linking.patch @@ -0,0 +1,17 @@ +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/Driver/ToolChains/Solaris.cpp a/lib/Driver/ToolChains/Solaris.cpp +--- a~/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 ++++ a/lib/Driver/ToolChains/Solaris.cpp 1970-01-01 00:00:00 +@@ -229,13 +229,6 @@ void solaris::Linker::ConstructJob(Compi + addFortranRuntimeLibs(getToolChain(), Args, CmdArgs); + CmdArgs.push_back("-lm"); + } +- if (Args.hasArg(options::OPT_fstack_protector) || +- Args.hasArg(options::OPT_fstack_protector_strong) || +- Args.hasArg(options::OPT_fstack_protector_all)) { +- // Explicitly link ssp libraries, not folded into Solaris libc. +- CmdArgs.push_back("-lssp_nonshared"); +- CmdArgs.push_back("-lssp"); +- } + // LLVM support for atomics on 32-bit SPARC V8+ is incomplete, so + // forcibly link with libatomic as a workaround. + if (Arch == llvm::Triple::sparc) { diff --git a/build/clang/patches-19/series b/build/clang/patches-19/series new file mode 100644 index 000000000..2c8dc747a --- /dev/null +++ b/build/clang/patches-19/series @@ -0,0 +1,5 @@ +no-ssp-linking.patch +default-preprocessor-definition.patch +add-rpath-for-libstdcxx.patch +no-sanitizer-runtime-lib-linking.patch +add-__illumos__-preprocessor-definition.patch diff --git a/build/llvm/build-19.sh b/build/llvm/build-19.sh new file mode 100755 index 000000000..07628e503 --- /dev/null +++ b/build/llvm/build-19.sh @@ -0,0 +1,74 @@ +#!/usr/bin/bash +# +# {{{ CDDL HEADER +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# }}} + +# Copyright 2024 OmniOS Community Edition (OmniOSce) Association. + +. ../../lib/build.sh + +PROG=llvm +PKG=ooce/developer/llvm-19 +VER=19.1.0 +SUMMARY="Low Level Virtual Machine compiler infrastructure" +DESC="A collection of modular and reusable compiler and toolchain technologies" + +min_rel 151051 + +set_arch 64 +set_clangver +set_builddir $PROG-project-$VER.src/$PROG + +SKIP_RTIME_CHECK=1 +NO_SONAME_EXPECTED=1 + +MAJVER=${VER%%.*} +set_patchdir patches-$MAJVER + +OPREFIX=$PREFIX +PREFIX+=/$PROG-$MAJVER + +XFORM_ARGS=" + -DPREFIX=${PREFIX#/} + -DOPREFIX=${OPREFIX#/} + -DPROG=$PROG + -DPKGROOT=$PROG-$MAJVER + -DMEDIATOR=$PROG -DMEDIATOR_VERSION=$MAJVER + -DVERSION=$MAJVER +" + +CONFIGURE_OPTS[amd64]= +CONFIGURE_OPTS[amd64_WS]=" + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_INSTALL_PREFIX=$PREFIX + -DCMAKE_C_COMPILER=\"$CC\" + -DCMAKE_CXX_COMPILER=\"$CXX\" + -DCMAKE_C_LINK_FLAGS=\"${LDFLAGS[amd64]}\" + -DCMAKE_CXX_LINK_FLAGS=\"${LDFLAGS[amd64]}\" + -DLLVM_BUILD_LLVM_DYLIB=ON + -DLLVM_INCLUDE_BENCHMARKS=OFF + -DLLVM_INSTALL_UTILS=ON + -DLLVM_LINK_LLVM_DYLIB=ON + -DLLVM_ENABLE_RTTI=ON +" + +init +download_source $PROG $PROG-project $VER.src +patch_source +prep_build cmake+ninja +build -noctf # C++ +strip_install +make_package +clean_up + +# Vim hints +# vim:ts=4:sw=4:et:fdm=marker diff --git a/build/llvm/patches-19/aarch64-eh_frame-ro.patch b/build/llvm/patches-19/aarch64-eh_frame-ro.patch new file mode 100644 index 000000000..aed40b36c --- /dev/null +++ b/build/llvm/patches-19/aarch64-eh_frame-ro.patch @@ -0,0 +1,17 @@ +Ensure .eh_frame is consistently read-only for aarch64 + +diff -wpruN --no-dereference '--exclude=*.orig' a~/lib/MC/MCObjectFileInfo.cpp a/lib/MC/MCObjectFileInfo.cpp +--- a~/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00 ++++ a/lib/MC/MCObjectFileInfo.cpp 1970-01-01 00:00:00 +@@ -383,8 +383,10 @@ void MCObjectFileInfo::initELFMCObjectFi + // Solaris requires different flags for .eh_frame to seemingly every other + // platform. + unsigned EHSectionFlags = ELF::SHF_ALLOC; +- if (T.isOSSolaris() && T.getArch() != Triple::x86_64) ++ if (T.isOSSolaris() && T.getArch() != Triple::x86_64 && ++ T.getArch() != Triple::aarch64) { + EHSectionFlags |= ELF::SHF_WRITE; ++ } + + // ELF + BSSSection = Ctx->getELFSection(".bss", ELF::SHT_NOBITS, diff --git a/build/llvm/patches-19/series b/build/llvm/patches-19/series new file mode 100644 index 000000000..1d127c654 --- /dev/null +++ b/build/llvm/patches-19/series @@ -0,0 +1 @@ +aarch64-eh_frame-ro.patch diff --git a/build/meta/extra-build-tools.p5m b/build/meta/extra-build-tools.p5m index ab811c8e0..6f6e4ec56 100644 --- a/build/meta/extra-build-tools.p5m +++ b/build/meta/extra-build-tools.p5m @@ -128,3 +128,7 @@ depend fmri=ooce/developer/llvm-18 type=conditional \ depend fmri=ooce/developer/clang-18 type=conditional \ predicate=release/name@0.5.11-151049 +# Added llvm/clang 19 from r151051 onwards +depend fmri=ooce/developer/llvm-19 type=conditional \ + predicate=release/name@0.5.11-151051 + diff --git a/doc/baseline b/doc/baseline index fe5dbb0be..89646fe75 100644 --- a/doc/baseline +++ b/doc/baseline @@ -79,6 +79,7 @@ extra.omnios ooce/developer/clang-15 extra.omnios ooce/developer/clang-16 extra.omnios ooce/developer/clang-17 extra.omnios ooce/developer/clang-18 +extra.omnios ooce/developer/clang-19 extra.omnios ooce/developer/cmake extra.omnios ooce/developer/cscope extra.omnios ooce/developer/cunit @@ -97,6 +98,7 @@ extra.omnios ooce/developer/llvm-15 extra.omnios ooce/developer/llvm-16 extra.omnios ooce/developer/llvm-17 extra.omnios ooce/developer/llvm-18 +extra.omnios ooce/developer/llvm-19 extra.omnios ooce/developer/ninja extra.omnios ooce/developer/omni extra.omnios ooce/developer/pkgmgr diff --git a/doc/packages.md b/doc/packages.md index 2e193c354..bc641dc87 100644 --- a/doc/packages.md +++ b/doc/packages.md @@ -57,6 +57,7 @@ | ooce/developer/clang-16 | 16.0.6 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/clang-17 | 17.0.6 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/clang-18 | 18.1.8 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) +| ooce/developer/clang-19 | 19.1.0 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/cmake | 3.30.2 | https://cmake.org/download/ | [omniosorg](https://github.com/omniosorg) | ooce/developer/cscope | 15.9 | https://sourceforge.net/projects/cscope/files/cscope/ | [omniosorg](https://github.com/omniosorg) | ooce/developer/cunit | 2.1-3 | https://sourceforge.net/projects/cunit/files/CUnit/ | [omniosorg](https://github.com/omniosorg) @@ -72,6 +73,7 @@ | ooce/developer/llvm-16 | 16.0.6 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/llvm-17 | 17.0.6 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/llvm-18 | 18.1.8 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) +| ooce/developer/llvm-19 | 19.1.0 | https://github.com/llvm/llvm-project/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/ninja | 1.12.1 | https://github.com/ninja-build/ninja/releases https://ninja-build.org/ | [omniosorg](https://github.com/omniosorg) | ooce/developer/omni | github-latest | https://github.com/omniosorg/omni/releases | [omniosorg](https://github.com/omniosorg) | ooce/developer/pkgmgr | github-latest | https://github.com/omniosorg/pkgmgr/releases | [omniosorg](https://github.com/omniosorg) diff --git a/tools/audit b/tools/audit index e955b9616..177abad50 100755 --- a/tools/audit +++ b/tools/audit @@ -235,6 +235,8 @@ audit() case $pkg:$pver in # clang/llvm-18 are not published until r151049 */clang-18:|*/llvm-18:|*/zig-013:) [ $r -lt 151049 ] || ok=0 ;; + # clang/llvm-19 are not published until r151051 + */clang-19:|*/llvm-19:) [ $r -lt 151051 ] || ok=0 ;; *) ok=0 ;; esac ;;