Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3d6869a
supautils: match prod debug symbols and glibc symbol versions
brainrake Sep 8, 2026
274e75a
supautils: drop unversioned dlsym fallback in glibc-compat shim
brainrake Sep 8, 2026
66af523
supautils: shorten glibc-compat comment
brainrake Sep 8, 2026
cf5b0c1
supautils: fix glibc-compat version pin for x86_64
brainrake Sep 8, 2026
991af3b
Merge branch 'develop' into martonboros/supautils-debug-glibc-compat
brainrake Sep 14, 2026
da26217
Merge branch 'develop' into martonboros/supautils-debug-glibc-compat
brainrake Sep 18, 2026
b73056b
supautils: use single glibc symver for both arches
brainrake Sep 18, 2026
e5b49db
Revert: keep per-arch glibc symver for dlvsym
brainrake Sep 18, 2026
a15d645
supautils: drop explanatory comment from glibc-compat patch
brainrake Sep 18, 2026
b357e3e
supautils/gatekeeper: strip RPATH, split debug info from runtime closure
brainrake Sep 18, 2026
720d0ed
supautils/gatekeeper: actually purge the glibc RPATH, not just its dy…
brainrake Sep 18, 2026
b244932
supautils/gatekeeper: replace dd byte-surgery with nix's own referenc…
brainrake Sep 18, 2026
0ca31f9
supautils: drop patchelf/unsafeDiscardReferences, NIX_DONT_SET_RPATH …
brainrake Sep 18, 2026
5f6aa9d
gatekeeper: drop no-op patchelf step
brainrake Sep 18, 2026
0876b82
gatekeeper: guard NIX_DONT_SET_RPATH by isLinux, matching supautils
brainrake Sep 18, 2026
754855f
supautils/gatekeeper: comment why NIX_DONT_SET_RPATH is set
brainrake Sep 18, 2026
51aceed
supautils/gatekeeper: say "libs" not "glibc" in comment, gatekeeper n…
brainrake Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions nix/ext/patches/supautils-strtol-glibc-compat.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/src/constrained_extensions.c b/src/constrained_extensions.c
index 18e5aee..cdfb63f 100644
--- a/src/constrained_extensions.c
+++ b/src/constrained_extensions.c
@@ -9,6 +9,24 @@
#include "constrained_extensions.h"
#include "utils.h"

+#if defined(__linux__) && defined(__GLIBC__) && (defined(__x86_64__) || defined(__aarch64__))
+# if defined(__x86_64__)
+# define SUPAUTILS_GLIBC_COMPAT_VER "GLIBC_2.2.5"
+# else
+# define SUPAUTILS_GLIBC_COMPAT_VER "GLIBC_2.17"
+# endif
+extern void *dlvsym(void *handle, const char *symbol, const char *version);
+__asm__(".symver dlvsym,dlvsym@" SUPAUTILS_GLIBC_COMPAT_VER);
+static int
+_supautils_compat_atoi(const char *nptr)
+{
+ long (*fn)(const char *, char **, int) =
+ (long (*)(const char *, char **, int)) dlvsym((void *) 0, "strtol", SUPAUTILS_GLIBC_COMPAT_VER);
+ return fn ? (int) fn(nptr, NULL, 10) : 0;
+}
+#define atoi(a) _supautils_compat_atoi(a)
+#endif
+
static JSON_ACTION_RETURN_TYPE json_array_start(void *state) {
json_constrained_extension_parse_state *parse = state;

7 changes: 7 additions & 0 deletions nix/ext/supautils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ stdenv.mkDerivation rec {

buildInputs = [ postgresql ];

separateDebugInfo = true;

# dlopen'd into postgres, which already links these libs
NIX_DONT_SET_RPATH = stdenv.isLinux;

src = fetchFromGitHub {
owner = "supabase";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-aCOQY6eNA7KgiEWtQoYpSHbJWwSnrcUPMm57RcesqKY=";
};

patches = [ ./patches/supautils-strtol-glibc-compat.patch ];

installPhase = ''
mkdir -p $out/lib

Expand Down
3 changes: 3 additions & 0 deletions nix/packages/gatekeeper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ let

buildInputs = [ pkgs.pam ];

# dlopen'd into PAM, which already links these libs
NIX_DONT_SET_RPATH = pkgs.stdenv.isLinux;

buildPhase = ''
runHook preBuild
go build -buildmode=c-shared -o pam_jit_pg.so
Expand Down
Loading