darwin.libiconv: update patch for static build

This commit is contained in:
Emily 2024-10-17 13:29:49 +01:00
parent f63d99842f
commit 7635bd4d45

View File

@ -1,17 +1,17 @@
From a3e945c630180e9aa182603207238302e58fe8fe Mon Sep 17 00:00:00 2001
From cf3bcbf4444d73cb3d1a9369c569338ae0fcb668 Mon Sep 17 00:00:00 2001
From: Randy Eckenrode <randy@largeandhighquality.com>
Date: Sat, 25 May 2024 19:03:58 -0400
Subject: [PATCH 1/2] Support static module loading
---
citrus/citrus_module.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
citrus/citrus_module.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/citrus/citrus_module.c b/citrus/citrus_module.c
index 5103d30..c22c9da 100644
index 8ca4702..7667868 100644
--- a/citrus/citrus_module.c
+++ b/citrus/citrus_module.c
@@ -324,22 +324,36 @@ out:
@@ -324,16 +324,24 @@ out:
return (path[0] ? path : NULL);
}
@ -37,9 +37,10 @@ index 5103d30..c22c9da 100644
return (p);
}
int
_citrus_load_module(_citrus_module_t *rhandle, const char *encname)
{
@@ -345,6 +353,12 @@ _citrus_load_module(_citrus_module_t *rhandle, const char *encname)
return (0);
#else
+#if defined(ENABLE_STATIC)
+ if (is_known_encoding(encname, strnlen(encname, MAX_WORD_LENGTH)) > MAX_HASH_VALUE) {
+ return (EINVAL);
@ -49,24 +50,24 @@ index 5103d30..c22c9da 100644
const char *p;
char path[PATH_MAX];
void *handle;
@@ -368,14 +382,15 @@ _citrus_load_module(_citrus_module_t *rhandle, const char *encname)
@@ -373,7 +387,7 @@ _citrus_load_module(_citrus_module_t *rhandle, const char *encname)
}
*rhandle = (_citrus_module_t)handle;
-
+#endif
return (0);
#endif
}
void
_citrus_unload_module(_citrus_module_t handle)
{
-
@@ -390,6 +404,8 @@ _citrus_unload_module(_citrus_module_t handle)
assert(handle != RTLD_SELF);
#endif /* FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
#endif /* __APPLE__ */
+#if !defined(ENABLE_STATIC)
if (handle)
dlclose((void *)handle);
+#endif
}
--
2.44.1
2.46.0