Skip to content

Commit c63eb28

Browse files
author
2b57
committed
add default hardening flags
1 parent 048fa15 commit c63eb28

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

profiles/features/clang/make.defaults

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,16 @@ CXX="clang++"
55
# this works with libtool
66
LD="ld.lld"
77

8-
# some linker flags
9-
LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
8+
# linker flags
9+
LDFLAGS="${LDFLAGS} -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed"
10+
11+
# hardening flags
12+
SOME_HARDENING_FLAGS="-fPIC -fstack-protector-strong -D_FORTIFY_SOURCE=2"
13+
14+
# add some hardening by default
15+
LDFLAGS="${LDFLAGS} -Wl,-z,relro,-z,now -pie"
16+
CFLAGS="${CFLAGS} ${SOME_HARDENING_FLAGS}"
17+
CXXFLAGS="${CXXFLAGS} ${SOME_HARDENING_FLAGS}"
1018

1119
# use LLVM-provided binutils
1220
AR="llvm-ar"
@@ -21,4 +29,4 @@ READELF="llvm-readelf"
2129
ADDR2LINE="llvm-addr2line"
2230

2331
# curl needed by cmake
24-
BOOTSTRAP_USE="$BOOTSTRAP_USE ssl curl_ssl_openssl"
32+
BOOTSTRAP_USE="$BOOTSTRAP_USE ssl curl_ssl_openssl"

0 commit comments

Comments
 (0)