diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2024-06-21 09:13:08 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2024-07-09 18:17:06 -0400 |
commit | 676df1cf2d5b59632a9f7e36d655e10f6c6d2063 (patch) | |
tree | 723d5effaa7eff171fd61201421102bd2ddad5ff /pkgs/build-support | |
parent | b178ec7776ab9793d49f3f25d8b785042ad2431f (diff) |
openbsd: Add static linking support
I've had better luck creating statically-linked binaries that work than dynamically-linked ones, so this is needed quite practically.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index 2a1fe1344e205..952bd85d4b011 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -45,16 +45,20 @@ "relro" "stackprotector" "strictoverflow" - ] ++ lib.optional (with stdenvNoCC; - # Musl-based platforms will keep "pie", other platforms will not. - # If you change this, make sure to update section `{#sec-hardening-in-nixpkgs}` - # in the nixpkgs manual to inform users about the defaults. - targetPlatform.libc == "musl" - # Except when: - # - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries. - # - static armv7l, where compilation fails. - && !(targetPlatform.isAarch && targetPlatform.isStatic) - ) "pie" + ] ++ lib.optional (with stdenvNoCC; lib.any (x: x) [ + # OpenBSD static linking requires PIE + (with targetPlatform; isOpenBSD && isStatic) + (lib.all (x: x) [ + # Musl-based platforms will keep "pie", other platforms will not. + # If you change this, make sure to update section `{#sec-hardening-in-nixpkgs}` + # in the nixpkgs manual to inform users about the defaults. + (targetPlatform.libc == "musl") + # Except when: + # - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries. + # - static armv7l, where compilation fails. + (!(targetPlatform.isAarch && targetPlatform.isStatic)) + ]) + ]) "pie" # Darwin code signing support utilities , postLinkSignHook ? null, signingUtils ? null |