Repository: bitcoin/bitcoin (language: cpp)

Issue:
win: non-static libssp in libbitcoinconsensus DLL
If you Guix build for Windows, and call objdump on `libbitcoinconsensus-0.dll`, you'll find it uses a non-static libssp:
```bash
objdump -x src/.libs/libbitcoinconsensus-0.dll
...
The Import Tables (interpreted .idata section contents)
 vma:            Hint    Time      Forward  DLL       First
                 Table   Stamp     Chain    Name      Thunk
 00263000	00263050 00000000 00000000 0026409c 00263490

	DLL Name: libssp-0.dll
	vma:  Hint/Ord Member-Name Bound-To
	2638d0	    3  __memcpy_chk
	2638e0	    7  __stack_chk_fail
	2638f4	    8  __stack_chk_guard
```

DLLs should be built with a static libgcc/stdc++/ssp:

https://github.com/bitcoin/bitcoin/blob/84c5416b03248c91aa7efe46555699f9f121d8a4/configure.ac#L724-L730

This has been an issue since we switched to using Guix for the 22.0 release.


Discussion / hints:

Fix patch:
diff --git a/configure.ac b/configure.ac
index 6add570d00fc8..147a514686345 100644
--- a/configure.ac
+++ b/configure.ac
@@ -988,12 +988,6 @@ if test "$use_hardening" != "no"; then
   AX_CHECK_LINK_FLAG([-Wl,-z,now], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"], [], [$LDFLAG_WERROR])
   AX_CHECK_LINK_FLAG([-Wl,-z,separate-code], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,separate-code"], [], [$LDFLAG_WERROR])
   AX_CHECK_LINK_FLAG([-fPIE -pie], [PIE_FLAGS="-fPIE"; HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"], [], [$CXXFLAG_WERROR])
-
-  case $host in
-    *mingw*)
-       AC_CHECK_LIB([ssp], [main], [], [AC_MSG_ERROR([libssp missing])])
-    ;;
-  esac
 fi
 
 dnl These flags are specific to ld64, and may cause issues with other linkers.
diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm
index ceb178155de88..3795e6d049f87 100644
--- a/contrib/guix/manifest.scm
+++ b/contrib/guix/manifest.scm
@@ -461,12 +461,8 @@ inspecting signatures in Mach-O binaries.")
           `(append ,flags
             ;; https://gcc.gnu.org/install/configure.html
             (list "--enable-threads=posix",
-                  building-on)))
-        ((#:make-flags flags)
-          ;; Uses the SSP functions from glibc instead of from libssp.so.
-          ;; Our 'symbol-check' script will complain if we link against libssp.so,
-          ;; and thus will ensure that this works properly.
-          `(cons "gcc_cv_libc_provides_ssp=yes" ,flags))))))
+                  "--enable-default-ssp=yes",
+                  building-on)))))))
 
 (define-public linux-base-gcc
   (package


Test patch: