Skip to content

Commit f9eda42

Browse files
committed
Delete --whole-archive linking in libmscordaccore.so
Fixes #115316
1 parent 81899bb commit f9eda42

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/coreclr/debug/daccess/daccess.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,7 @@ extern TADDR g_ClrModuleBase;
4545
CRITICAL_SECTION g_dacCritSec;
4646
ClrDataAccess* g_dacImpl;
4747

48-
EXTERN_C
49-
#ifdef TARGET_UNIX
50-
DLLEXPORT // For Win32 PAL LoadLibrary emulation
51-
#endif
52-
BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
48+
EXTERN_C BOOL WINAPI DllMain2(HANDLE instance, DWORD reason, LPVOID reserved)
5349
{
5450
static bool g_procInitialized = false;
5551

src/coreclr/debug/daccess/fntableaccess.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ class CheckDuplicatedStructLayouts
9494

9595
#else // CHECK_DUPLICATED_STRUCT_LAYOUTS
9696

97-
BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved);
98-
//NTSTATUS OutOfProcessFindHeader(HANDLE hProcess, DWORD_PTR pMapIn, DWORD_PTR addr, DWORD_PTR &codeHead);
9997
extern "C" NTSTATUS OutOfProcessFunctionTableCallback(IN HANDLE hProcess, IN PVOID TableAddress, OUT PULONG pnEntries, OUT PT_RUNTIME_FUNCTION* ppFunctions);
10098

10199

src/coreclr/dlls/mscordac/CMakeLists.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,6 @@ else(CLR_CMAKE_HOST_WIN32)
116116
# ensure proper resolving of circular references between a subset of the libraries.
117117
set(START_LIBRARY_GROUP -Wl,--start-group)
118118
set(END_LIBRARY_GROUP -Wl,--end-group)
119-
120-
# These options are used to force every object to be included even if it's unused.
121-
set(START_WHOLE_ARCHIVE -Wl,--whole-archive)
122-
set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive)
123119
endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU)
124120

125121
set_exports_linker_option(${EXPORTS_FILE})
@@ -150,10 +146,8 @@ set(COREDAC_LIBRARIES
150146
${START_LIBRARY_GROUP} # Start group of libraries that have circular references
151147
cee_dac
152148
cordbee_dac
153-
${START_WHOLE_ARCHIVE} # force all exports to be available
154149
corguids
155150
daccess
156-
${END_WHOLE_ARCHIVE}
157151
dbgutil
158152
mdcompiler_dac
159153
mdruntime_dac
@@ -200,10 +194,8 @@ if(CLR_CMAKE_HOST_WIN32)
200194
else(CLR_CMAKE_HOST_WIN32)
201195
list(APPEND COREDAC_LIBRARIES
202196
mscorrc
203-
${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available
204197
coreclrpal
205198
coreclrminipal
206-
${END_WHOLE_ARCHIVE}
207199
)
208200
endif(CLR_CMAKE_HOST_WIN32)
209201

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
#include <windows.h>
5+
6+
EXTERN_C BOOL WINAPI DllMain2(HANDLE instance, DWORD reason, LPVOID reserved);
7+
8+
// This is a workaround for missing exports on Linux. Defining DllMain forwarder here makes Linux linker export DllMain and other
9+
// methods built under debug/daccess in the final binary.
10+
EXTERN_C
11+
#ifdef HOST_UNIX
12+
DLLEXPORT // For Win32 PAL LoadLibrary emulation
13+
#endif
14+
BOOL WINAPI DllMain(HANDLE instance, DWORD reason, LPVOID reserved)
15+
{
16+
return DllMain2(instance, reason, reserved);
17+
}

0 commit comments

Comments
 (0)