summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2022-10-05 21:43:42 +0200
committerAndreas K. Hüttel <dilfridge@gentoo.org>2022-10-05 21:43:42 +0200
commit8ddde81c3680e41dab4e71315c7416ba35d40dc5 (patch)
tree5ac35ba8c3fdc4388e25accefefaaa74cf267f64 /profiles/features/llvm
parentsys-kernel/gentoo-kernel-bin: Bump to 5.19.14 (diff)
downloadgentoo-8ddde81c3680e41dab4e71315c7416ba35d40dc5.tar.gz
gentoo-8ddde81c3680e41dab4e71315c7416ba35d40dc5.tar.bz2
gentoo-8ddde81c3680e41dab4e71315c7416ba35d40dc5.zip
profiles: rename clang feature to llvm, adjust parent files
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
Diffstat (limited to 'profiles/features/llvm')
-rw-r--r--profiles/features/llvm/eapi1
-rw-r--r--profiles/features/llvm/make.defaults74
-rw-r--r--profiles/features/llvm/package.accept_keywords8
-rw-r--r--profiles/features/llvm/package.use14
-rw-r--r--profiles/features/llvm/package.use.mask9
-rw-r--r--profiles/features/llvm/packages14
-rw-r--r--profiles/features/llvm/packages.build14
-rw-r--r--profiles/features/llvm/use.force2
8 files changed, 136 insertions, 0 deletions
diff --git a/profiles/features/llvm/eapi b/profiles/features/llvm/eapi
new file mode 100644
index 000000000000..7ed6ff82de6b
--- /dev/null
+++ b/profiles/features/llvm/eapi
@@ -0,0 +1 @@
+5
diff --git a/profiles/features/llvm/make.defaults b/profiles/features/llvm/make.defaults
new file mode 100644
index 000000000000..77b32d47a3c2
--- /dev/null
+++ b/profiles/features/llvm/make.defaults
@@ -0,0 +1,74 @@
+# Copyright 2021-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# this is for now highly experimental -dilfridge
+
+# use clang as the 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"
+#
+# we need to eventually do this the same way as in gcc, for now let's
+# keep it to a minimum
+SOME_HARDENING_CFLAGS="-D_FORTIFY_SOURCE=2"
+SOME_HARDENING_LDFLAGS=""
+
+# enable hardening by default, cf. gcc[pie,ssp]
+CFLAGS="${CFLAGS} ${SOME_HARDENING_FLAGS}"
+CXXFLAGS="${CXXFLAGS} ${SOME_HARDENING_FLAGS}"
+LDFLAGS="${LDFLAGS} ${SOME_HARDENING_LDFLAGS}"
+
+# use LLVM-provided binutils
+AR="llvm-ar"
+AS="clang -c"
+CPP="clang-cpp"
+NM="llvm-nm"
+STRIP="llvm-strip"
+RANLIB="llvm-ranlib"
+OBJCOPY="llvm-objcopy"
+STRINGS="llvm-strings"
+OBJDUMP="llvm-objdump"
+READELF="llvm-readelf"
+ADDR2LINE="llvm-addr2line"
+
+# Rust needs this to build some crates (like uutils)
+# https://github.com/rust-lang/rust/blob/master/compiler/rustc_llvm/build.rs
+LLVM_USE_LIBCXX=1
+# https://github.com/rust-lang/cc-rs#c-support
+# https://github.com/rust-lang/cc-rs/blob/main/src/lib.rs
+CXXSTDLIB="c++"
+
+# 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_10"
+
+# sys-devel/llvm
+BOOTSTRAP_USE="${BOOTSTRAP_USE} -binutils-plugin"
+
+# 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
+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/llvm/package.accept_keywords b/profiles/features/llvm/package.accept_keywords
new file mode 100644
index 000000000000..231f53933017
--- /dev/null
+++ b/profiles/features/llvm/package.accept_keywords
@@ -0,0 +1,8 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# this version contains the path fix for portage needed for stage1 builds
+=sys-apps/portage-3.0.33 ~amd64
+
+# this version contains the fix for CPP resetting
+=sys-libs/glibc-2.35-r10 ~amd64
diff --git a/profiles/features/llvm/package.use b/profiles/features/llvm/package.use
new file mode 100644
index 000000000000..267fafefe792
--- /dev/null
+++ b/profiles/features/llvm/package.use
@@ -0,0 +1,14 @@
+# use lld by default
+sys-devel/llvm -binutils-plugin
+
+# use all defaults
+sys-devel/clang default-compiler-rt default-lld default-libcxx llvm-libunwind
+sys-devel/clang-common 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
diff --git a/profiles/features/llvm/package.use.mask b/profiles/features/llvm/package.use.mask
new file mode 100644
index 000000000000..0975580eab0d
--- /dev/null
+++ b/profiles/features/llvm/package.use.mask
@@ -0,0 +1,9 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# Sam James <sam@gentoo.org> (2022-09-15)
+# Works on pure LLVM systems: bug #870211.
+dev-lang/rust -llvm-libunwind
+
+# libquadmath is gcc-specific
+dev-lang/perl quadmath
diff --git a/profiles/features/llvm/packages b/profiles/features/llvm/packages
new file mode 100644
index 000000000000..9536b85862f3
--- /dev/null
+++ b/profiles/features/llvm/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/llvm/packages.build b/profiles/features/llvm/packages.build
new file mode 100644
index 000000000000..fd1e69e329e3
--- /dev/null
+++ b/profiles/features/llvm/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/llvm/use.force b/profiles/features/llvm/use.force
new file mode 100644
index 000000000000..b1067fb9ea86
--- /dev/null
+++ b/profiles/features/llvm/use.force
@@ -0,0 +1,2 @@
+clang
+llvm-libunwind