summaryrefslogtreecommitdiff
blob: 014816b372536f64856e0bde9110331f3b67e257 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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"