diff --git a/native/src/init/preload.c b/native/src/init/preload.c
index 2751b366c..dde74d5d4 100644
--- a/native/src/init/preload.c
+++ b/native/src/init/preload.c
@@ -3,11 +3,14 @@
 #include <unistd.h>
 #include <dlfcn.h>
 
-int security_load_policy(void *data, size_t len) {
+__attribute__((constructor))
+static void preload_init() {
     // Make sure our next exec won't get bugged
     unsetenv("LD_PRELOAD");
     unlink("/dev/preload.so");
+}
 
+int security_load_policy(void *data, size_t len) {
     int (*load_policy)(void *, size_t) = dlsym(RTLD_NEXT, "security_load_policy");
     // Skip checking errors, because if we cannot find the symbol, there
     // isn't much we can do other than crashing anyways.