From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 7371D158086 for ; Sun, 5 Dec 2021 11:19:14 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 02DB3E07EC; Sun, 5 Dec 2021 11:19:13 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 41098E07EC for ; Sun, 5 Dec 2021 11:19:12 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id CEF0A34358E for ; Sun, 5 Dec 2021 11:19:10 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4B88814D for ; Sun, 5 Dec 2021 11:19:09 +0000 (UTC) From: "Andreas K. Hüttel" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas K. Hüttel" Message-ID: <1638703125.6890ef4bc1a8b3a67c9da1059091ffe775d4083b.dilfridge@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/features/clang/ X-VCS-Repository: repo/gentoo X-VCS-Files: profiles/features/clang/eapi profiles/features/clang/make.defaults profiles/features/clang/package.mask profiles/features/clang/package.use profiles/features/clang/packages profiles/features/clang/packages.build profiles/features/clang/use.force X-VCS-Directories: profiles/features/clang/ X-VCS-Committer: dilfridge X-VCS-Committer-Name: Andreas K. Hüttel X-VCS-Revision: 6890ef4bc1a8b3a67c9da1059091ffe775d4083b X-VCS-Branch: master Date: Sun, 5 Dec 2021 11:19:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ae922318-a63f-485b-9a29-48456d17d453 X-Archives-Hash: 097d1f8606bf24a283cead3233ecfdc8 commit: 6890ef4bc1a8b3a67c9da1059091ffe775d4083b Author: Alex Revin <2b57 pm me> AuthorDate: Sat Dec 4 23:13:04 2021 +0000 Commit: Andreas K. Hüttel gentoo org> CommitDate: Sun Dec 5 11:18:45 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6890ef4b profiles: add clang profile feature Signed-off-by: Alex Revin <2b57 pm.me> Closes: https://github.com/gentoo/gentoo/pull/23187 Signed-off-by: Andreas K. Hüttel gentoo.org> profiles/features/clang/eapi | 1 + profiles/features/clang/make.defaults | 58 ++++++++++++++++++++++++++++++++++ profiles/features/clang/package.mask | 16 ++++++++++ profiles/features/clang/package.use | 17 ++++++++++ profiles/features/clang/packages | 14 ++++++++ profiles/features/clang/packages.build | 14 ++++++++ profiles/features/clang/use.force | 1 + 7 files changed, 121 insertions(+) diff --git a/profiles/features/clang/eapi b/profiles/features/clang/eapi new file mode 100644 index 000000000000..7f8f011eb73d --- /dev/null +++ b/profiles/features/clang/eapi @@ -0,0 +1 @@ +7 diff --git a/profiles/features/clang/make.defaults b/profiles/features/clang/make.defaults new file mode 100644 index 000000000000..014816b37253 --- /dev/null +++ b/profiles/features/clang/make.defaults @@ -0,0 +1,58 @@ +# use Clang as a primary compiler +CC="clang" +CXX="clang++" + +# libtool needs this +LD="ld.lld" + +# linker flags +LDFLAGS="${LDFLAGS} -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed" + +# hardening flags +SOME_HARDENING_CFLAGS="-fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2" +SOME_HARDENING_LDFLAGS="-Wl,-z,relro,-z,now -pie" + +# enable some hardening by default +CFLAGS="${CFLAGS} ${SOME_HARDENING_FLAGS}" +CXXFLAGS="${CXXFLAGS} ${SOME_HARDENING_FLAGS}" +LDFLAGS="${LDFLAGS} ${SOME_HARDENING_LDFLAGS}" + +# use LLVM-provided binutils +AR="llvm-ar" +AS="llvm-as" +NM="llvm-nm" +STRIP="llvm-strip" +RANLIB="llvm-ranlib" +OBJCOPY="llvm-objcopy" +STRINGS="llvm-strings" +OBJDUMP="llvm-objdump" +READELF="llvm-readelf" +ADDR2LINE="llvm-addr2line" + + +# bootstrap USE for stage1 + +# curl needed by cmake +BOOTSTRAP_USE="$BOOTSTRAP_USE ssl curl_ssl_openssl" + +# Clang needs this +BOOTSTRAP_USE="${BOOTSTRAP_USE} python_single_target_python3_9" + +# sys-devel/llvm +BOOTSTRAP_USE="${BOOTSTRAP_USE} -gold" + +# sys-devel/clang, sys-devel/clang-runtime, sys-libs/llvm-libunwind, sys-libs/libcxx, sys-libs/libcxxabi +BOOTSTRAP_USE="${BOOTSTRAP_USE} compiler-rt clang libunwind" + +# sys-devel/clang +BOOTSTRAP_USE="${BOOTSTRAP_USE} default-compiler-rt default-lld default-libcxx llvm-libunwind" + +# sys-devel/clang-runtime +# sanitizers are disabled for now +BOOTSTRAP_USE="${BOOTSTRAP_USE} libcxx -sanitize" + +# sys-libs/libcxxabi +BOOTSTRAP_USE="${BOOTSTRAP_USE} libcxxabi" + +# llvm & clang: explicitly disable all extra targets, otherwise linking stage2 fails +BOOTSTRAP_USE="${BOOTSTRAP_USE} -llvm_targets_BPF -llvm_targets_AMDGPU -llvm_targets_NVPTX -llvm_targets_BPF" diff --git a/profiles/features/clang/package.mask b/profiles/features/clang/package.mask new file mode 100644 index 000000000000..0b6b883d274a --- /dev/null +++ b/profiles/features/clang/package.mask @@ -0,0 +1,16 @@ +# mask LLVM 13, since it breaks tcl, which breaks sqlite and so on + +>sys-devel/llvm-12.0.1 +>sys-devel/llvm-common-12.0.1 + +>sys-libs/compiler-rt-12.0.1 +>sys-libs/compiler-rt-sanitizers-12.0.1 + +>sys-devel/clang-12.0.1 +>sys-devel/clang-common-12.0.1 +>sys-devel/clang-runtime-12.0.1 + +>sys-devel/lld-12.0.1 +>sys-libs/libcxx-12.0.1 +>sys-libs/libcxxabi-12.0.1 +>sys-libs/llvm-libunwind-12.0.1 diff --git a/profiles/features/clang/package.use b/profiles/features/clang/package.use new file mode 100644 index 000000000000..5d568cb8cb66 --- /dev/null +++ b/profiles/features/clang/package.use @@ -0,0 +1,17 @@ +# use lld by default +sys-devel/llvm -gold + +# use all defaults +sys-devel/clang compiler-rt default-compiler-rt default-lld default-libcxx llvm-libunwind +sys-libs/compiler-rt clang + +# disable sanitizers for now +sys-devel/clang-runtime compiler-rt libcxx -sanitize +# sys-libs/compiler-rt-sanitizers clang + +sys-libs/libcxx libunwind libcxxabi +sys-libs/libcxxabi libunwind +sys-libs/llvm-libunwind compiler-rt + +# libgcrypt doesn't like optimizations +dev-libs/libgcrypt o-flag-munging diff --git a/profiles/features/clang/packages b/profiles/features/clang/packages new file mode 100644 index 000000000000..9536b85862f3 --- /dev/null +++ b/profiles/features/clang/packages @@ -0,0 +1,14 @@ +# now part of @system set +*sys-devel/lld +*sys-devel/llvm +*sys-devel/clang +*sys-libs/libcxx +*sys-libs/libcxxabi +*sys-libs/compiler-rt +*sys-libs/llvm-libunwind + +# not needed with clang +-*sys-devel/gcc +-*sys-devel/gcc-config +-*sys-devel/binutils +-*sys-devel/binutils-config diff --git a/profiles/features/clang/packages.build b/profiles/features/clang/packages.build new file mode 100644 index 000000000000..fd1e69e329e3 --- /dev/null +++ b/profiles/features/clang/packages.build @@ -0,0 +1,14 @@ +# will be pulled by stage1 +sys-libs/compiler-rt +sys-libs/libcxxabi +sys-libs/libcxx +sys-devel/llvm +sys-devel/lld +sys-devel/clang +sys-libs/llvm-libunwind + +# remove gcc & friends +-sys-devel/gcc +-sys-devel/gcc-config +-sys-devel/binutils +-sys-devel/binutils-config diff --git a/profiles/features/clang/use.force b/profiles/features/clang/use.force new file mode 100644 index 000000000000..e671fa21003e --- /dev/null +++ b/profiles/features/clang/use.force @@ -0,0 +1 @@ +clang