Skip to content

Commit

Permalink
Merge branch 'mingw-no-fortify'
Browse files Browse the repository at this point in the history
  • Loading branch information
shlevy committed Aug 12, 2021
2 parents c395dc5 + 5f073a6 commit fcf5efa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkgs/build-support/cc-wrapper/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ stdenv.mkDerivation {
+ optionalString hostPlatform.isCygwin ''
hardening_unsupported_flags+=" pic"
'' + optionalString targetPlatform.isMinGW ''
hardening_unsupported_flags+=" stackprotector"
hardening_unsupported_flags+=" stackprotector fortify"
'' + optionalString targetPlatform.isAvr ''
hardening_unsupported_flags+=" stackprotector pic"
'' + optionalString (targetPlatform.libc == "newlib") ''
Expand Down
7 changes: 6 additions & 1 deletion pkgs/development/libraries/libsodium/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl }:
{ lib, stdenv, fetchurl, autoreconfHook }:

stdenv.mkDerivation rec {
pname = "libsodium";
Expand All @@ -10,6 +10,11 @@ stdenv.mkDerivation rec {
};

outputs = [ "out" "dev" ];

patches = lib.optional stdenv.targetPlatform.isMinGW ./mingw-no-fortify.patch;

nativeBuildInputs = lib.optional stdenv.targetPlatform.isMinGW autoreconfHook;

separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";

enableParallelBuilding = true;
Expand Down
15 changes: 15 additions & 0 deletions pkgs/development/libraries/libsodium/mingw-no-fortify.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff -Naur libsodium-1.0.18-orig/configure.ac libsodium-1.0.18/configure.ac
--- libsodium-1.0.18-orig/configure.ac 2019-05-30 16:20:24.000000000 -0400
+++ libsodium-1.0.18/configure.ac 2021-08-11 08:09:54.653907245 -0400
@@ -217,11 +217,6 @@

AC_CHECK_DEFINE([__wasi__], [WASI="yes"], [])

-AC_CHECK_DEFINE([_FORTIFY_SOURCE], [], [
- AX_CHECK_COMPILE_FLAG([-D_FORTIFY_SOURCE=2],
- [CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"])
-])
-
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
[CFLAGS="$CFLAGS -fvisibility=hidden"])

0 comments on commit fcf5efa

Please sign in to comment.