summaryrefslogtreecommitdiffhomepage
path: root/src/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/slibtool_coff_impl.c46
-rw-r--r--src/internal/slibtool_coff_impl.h6
2 files changed, 52 insertions, 0 deletions
diff --git a/src/internal/slibtool_coff_impl.c b/src/internal/slibtool_coff_impl.c
new file mode 100644
index 0000000..8d405ac
--- /dev/null
+++ b/src/internal/slibtool_coff_impl.c
@@ -0,0 +1,46 @@
+/*******************************************************************/
+/* slibtool: a strong libtool implementation, written in C */
+/* Copyright (C) 2016--2024 SysDeer Technologies, LLC */
+/* Released under the Standard MIT License; see COPYING.SLIBTOOL. */
+/*******************************************************************/
+
+#include <string.h>
+#include "slibtool_visibility_impl.h"
+
+slbt_hidden int slbt_coff_strcmp(const void * a, const void * b)
+{
+ const char * dot;
+ const char * mark;
+ const char * stra;
+ const char * strb;
+ const char ** pstra;
+ const char ** pstrb;
+ char strbufa[4096];
+ char strbufb[4096];
+
+ pstra = (const char **)a;
+ pstrb = (const char **)b;
+
+ stra = *pstra;
+ strb = *pstrb;
+
+ if (!strncmp(*pstra,".weak.",6)) {
+ stra = strbufa;
+ mark = &(*pstra)[6];
+ dot = strchr(mark,'.');
+
+ strncpy(strbufa,mark,dot-mark);
+ strbufa[dot-mark] = '\0';
+ }
+
+ if (!strncmp(*pstrb,".weak.",6)) {
+ strb = strbufb;
+ mark = &(*pstrb)[6];
+ dot = strchr(mark,'.');
+
+ strncpy(strbufb,mark,dot-mark);
+ strbufb[dot-mark] = '\0';
+ }
+
+ return strcmp(stra,strb);
+}
diff --git a/src/internal/slibtool_coff_impl.h b/src/internal/slibtool_coff_impl.h
new file mode 100644
index 0000000..c733b0f
--- /dev/null
+++ b/src/internal/slibtool_coff_impl.h
@@ -0,0 +1,6 @@
+#ifndef SLIBTOOL_COFF_IMPL_H
+#define SLIBTOOL_COFF_IMPL_H
+
+int slbt_coff_strcmp(const void * a, const void * b);
+
+#endif