Module: wine
Branch: master
Commit: c20741b33a669f4a2a2d84908c17024043eb208a
URL: https://gitlab.winehq.org/wine/wine/-/commit/c20741b33a669f4a2a2d84908c1702…
Author: Alexandre Julliard <julliard(a)winehq.org>
Date: Sat Dec 3 16:12:16 2022 +0100
winebuild: Reinstate the __wine_spec_dll_entry() entrypoint for .so dlls.
---
dlls/winecrt0/Makefile.in | 1 +
dlls/winecrt0/dll_entry.c | 35 +++++++++++++++++++++++++++++++++++
tools/winebuild/main.c | 6 +++++-
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/dlls/winecrt0/Makefile.in b/dlls/winecrt0/Makefile.in
index 17da4da29c6..1faed0827ec 100644
--- a/dlls/winecrt0/Makefile.in
+++ b/dlls/winecrt0/Makefile.in
@@ -6,6 +6,7 @@ C_SRCS = \
debug.c \
delay_load.c \
dll_canunload.c \
+ dll_entry.c \
dll_main.c \
dll_register.c \
exception.c \
diff --git a/dlls/winecrt0/dll_entry.c b/dlls/winecrt0/dll_entry.c
new file mode 100644
index 00000000000..1c7fe676c2c
--- /dev/null
+++ b/dlls/winecrt0/dll_entry.c
@@ -0,0 +1,35 @@
+/*
+ * Default entry point for a .so dll
+ *
+ * Copyright 2022 Alexandre Julliard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#if 0
+#pragma makedep unix
+#endif
+
+/* this is actually part of a static lib linked into a .dll.so module, not a real Unix library */
+#undef WINE_UNIX_LIB
+
+#include <stdarg.h>
+#include "windef.h"
+#include "winbase.h"
+
+BOOL WINAPI DECLSPEC_HIDDEN __wine_spec_dll_entry( HINSTANCE inst, DWORD reason, LPVOID reserved )
+{
+ return DllMain( inst, reason, reserved );
+}
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 875bf45f0a1..aae223f9e57 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -340,7 +340,11 @@ static void set_exec_mode( enum exec_mode_values mode )
/* get the default entry point for a given spec file */
static const char *get_default_entry_point( const DLLSPEC *spec )
{
- if (spec->characteristics & IMAGE_FILE_DLL) return "DllMain";
+ if (spec->characteristics & IMAGE_FILE_DLL)
+ {
+ add_spec_extra_ld_symbol("DllMain");
+ return "__wine_spec_dll_entry";
+ }
if (spec->subsystem == IMAGE_SUBSYSTEM_NATIVE) return "DriverEntry";
if (spec->type == SPEC_WIN16)
{