diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt index 95e92034e238f..c577651141e5c 100644 --- a/src/coreclr/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt @@ -100,7 +100,21 @@ elseif(CLR_CMAKE_HOST_UNIX) mscordaccore ) - target_link_libraries(mscordbi ${COREDBI_LIBRARIES}) + # Before llvm 16, lld was setting `--undefined-version` by default. The default was + # flipped to `--no-undefined-version` in lld 16, so we will explicitly set it to + # `--undefined-version` for our use-case. + include(CheckLinkerFlag OPTIONAL) + if(COMMAND check_linker_flag) + check_linker_flag(CXX -Wl,--undefined-version LINKER_SUPPORTS_UNDEFINED_VERSION) + if (LINKER_SUPPORTS_UNDEFINED_VERSION) + add_linker_flag(-Wl,--undefined-version) + endif(LINKER_SUPPORTS_UNDEFINED_VERSION) + endif(COMMAND check_linker_flag) + + # COREDBI_LIBRARIES is mentioned twice because ld is one pass linker and will not find symbols + # if they are defined after they are used. Having all libs twice makes sure that ld will actually + # find all symbols. + target_link_libraries(mscordbi ${COREDBI_LIBRARIES} ${COREDBI_LIBRARIES}) add_dependencies(mscordbi mscordaccore) diff --git a/src/coreclr/dlls/mscordbi/mscordbi.cpp b/src/coreclr/dlls/mscordbi/mscordbi.cpp index 109fe6a5b5417..891c01e144f5c 100644 --- a/src/coreclr/dlls/mscordbi/mscordbi.cpp +++ b/src/coreclr/dlls/mscordbi/mscordbi.cpp @@ -32,18 +32,3 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) // Defer to the main debugging code. return DbgDllMain(hInstance, dwReason, lpReserved); } - -#if defined(HOST_LINUX) && defined(TARGET_LINUX) -PALIMPORT HINSTANCE PALAPI DAC_PAL_RegisterModule(IN LPCSTR lpLibFileName); -PALIMPORT VOID PALAPI DAC_PAL_UnregisterModule(IN HINSTANCE hInstance); - -HINSTANCE PALAPI PAL_RegisterModule(IN LPCSTR lpLibFileName) -{ - return DAC_PAL_RegisterModule(lpLibFileName); -} - -VOID PALAPI PAL_UnregisterModule(IN HINSTANCE hInstance) -{ - DAC_PAL_UnregisterModule(hInstance); -} -#endif