Skip to content

Commit c99a1ec

Browse files
committed
guix: enable hardening options in GCC Build
Pass `--enable-default-pie` and `--enable-default-ssp` when configuring our GCCs. This achieves the following: --enable-default-pie Turn on -fPIE and -pie by default. --enable-default-ssp Turn on -fstack-protector-strong by default. Note that this isn't a replacement for passing hardneing flags ourselves, but introduces some redundency, and there isn't really a reason to not build a more "hardenings enabled" toolchain by default. See also: https://gcc.gnu.org/install/configure.html
1 parent aa87879 commit c99a1ec

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

contrib/guix/manifest.scm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,19 @@ chain for " target " development."))
132132
(define base-gcc gcc-10)
133133
(define base-linux-kernel-headers linux-libre-headers-5.15)
134134

135+
;; https://gcc.gnu.org/install/configure.html
136+
(define (hardened-gcc gcc)
137+
(package-with-extra-configure-variable (
138+
package-with-extra-configure-variable gcc
139+
"--enable-default-ssp" "yes")
140+
"--enable-default-pie" "yes"))
141+
135142
(define* (make-bitcoin-cross-toolchain target
136143
#:key
137144
(base-gcc-for-libc base-gcc)
138145
(base-kernel-headers base-linux-kernel-headers)
139146
(base-libc (make-glibc-with-bind-now (make-glibc-without-werror glibc-2.24)))
140-
(base-gcc (make-gcc-rpath-link base-gcc)))
147+
(base-gcc (make-gcc-rpath-link (hardened-gcc base-gcc))))
141148
"Convenience wrapper around MAKE-CROSS-TOOLCHAIN with default values
142149
desirable for building Bitcoin Core release binaries."
143150
(make-cross-toolchain target

0 commit comments

Comments
 (0)