summaryrefslogtreecommitdiff
path: root/src/dlls
diff options
context:
space:
mode:
authorMike McLaughlin <mikem@microsoft.com>2018-07-12 23:45:39 -0700
committerGitHub <noreply@github.com>2018-07-12 23:45:39 -0700
commitb89e2305a2c953272c997242d01b66b1bb1e661e (patch)
treeb4064df6f0917351a74722c91d9928789e53c8cc /src/dlls
parent0e22b107e811bc8ab7f3c1caf0943ef760d9f53d (diff)
downloadcoreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.tar.gz
coreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.tar.bz2
coreclr-b89e2305a2c953272c997242d01b66b1bb1e661e.zip
Add prefix to DAC's PAL exports for alpine (#18873)
Added some cmake logic to create assembly include mapping files. One that maps the prefixed name (DAC_foo) to the actual name (foo) which is included in the DAC module and another that maps the actual name to the prefixed name that is included in the SOS, DBI and createdump modules. The data exports like IID_IUnknown are not prefixed and don't need to be (immutable static data). There were some C++ exports functions exported with their decorated names in the CatchHardwareExceptionHolder and NativeExceptionHolderBase classes. Created PAL_* style export functions that implements the code. Fix lldb plugin cmake file to use LLDB_H/LLDB_LIB env vars to build it.
Diffstat (limited to 'src/dlls')
-rw-r--r--src/dlls/mscordac/CMakeLists.txt55
-rw-r--r--src/dlls/mscordac/libredefines.S12
-rw-r--r--src/dlls/mscordac/mscordac_unixexports.src338
-rw-r--r--src/dlls/mscordac/palredefines.S12
-rw-r--r--src/dlls/mscordbi/CMakeLists.txt37
5 files changed, 266 insertions, 188 deletions
diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt
index fba524a405..ec52903758 100644
--- a/src/dlls/mscordac/CMakeLists.txt
+++ b/src/dlls/mscordac/CMakeLists.txt
@@ -20,10 +20,10 @@ if(WIN32)
set(CURRENT_BINARY_DIR_FOR_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
- #Preprocess exports definition file
+ # Preprocess exports definition file
preprocess_def_file(${CMAKE_CURRENT_SOURCE_DIR}/${DEF_SOURCES} ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def)
- #create target to add file dependency on mscordac.def
+ # Create target to add file dependency on mscordac.def
add_custom_target(mscordaccore_def DEPENDS ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def)
# No library groups for Win32
@@ -32,7 +32,50 @@ if(WIN32)
else(WIN32)
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mscordac_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/mscordac.exports)
- generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
+
+ # Add dependency on export file
+ add_custom_target(mscordaccore_exports DEPENDS ${EXPORTS_FILE})
+
+ if(CLR_CMAKE_PLATFORM_DARWIN)
+ generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
+ endif(CLR_CMAKE_PLATFORM_DARWIN)
+
+ if(CLR_CMAKE_PLATFORM_LINUX)
+
+ # Generate DAC export file with the DAC_ prefix
+ generate_exports_file_prefix(${DEF_SOURCES} ${EXPORTS_FILE} DAC_)
+
+ set(REDEFINES_FILE_AWK_SCRIPT ${CMAKE_SOURCE_DIR}/generateredefinesfile.awk)
+
+ if (CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_ARM64)
+ set(JUMP_INSTRUCTION b)
+ else()
+ set(JUMP_INSTRUCTION jmp)
+ endif()
+
+ # Generate the palredefines.inc file to map from the imported prefixed APIs (foo to DAC_foo)
+ set(PAL_REDEFINES_INC ${GENERATED_INCLUDE_DIR}/palredefines.inc)
+ add_custom_command(
+ OUTPUT ${PAL_REDEFINES_INC}
+ COMMAND ${AWK} -f ${REDEFINES_FILE_AWK_SCRIPT} -v jump=${JUMP_INSTRUCTION} -v prefix2=DAC_ ${DEF_SOURCES} > ${PAL_REDEFINES_INC}
+ DEPENDS ${DEF_SOURCES} ${REDEFINES_FILE_AWK_SCRIPT}
+ COMMENT "Generating PAL redefines file -> ${PAL_REDEFINES_INC}"
+ )
+ add_custom_target(pal_redefines_file DEPENDS ${PAL_REDEFINES_INC})
+
+ # Generate the libredefines.inc file for the DAC to export the prefixed APIs (DAC_foo to foo)
+ set(LIB_REDEFINES_INC ${GENERATED_INCLUDE_DIR}/libredefines.inc)
+ add_custom_command(
+ OUTPUT ${LIB_REDEFINES_INC}
+ COMMAND ${AWK} -f ${REDEFINES_FILE_AWK_SCRIPT} -v jump=${JUMP_INSTRUCTION} -v prefix1=DAC_ ${DEF_SOURCES} > ${LIB_REDEFINES_INC}
+ DEPENDS ${DEF_SOURCES} ${REDEFINES_FILE_AWK_SCRIPT}
+ COMMENT "Generating DAC export redefines file -> ${LIB_REDEFINES_INC}"
+ )
+ add_custom_target(lib_redefines_inc DEPENDS ${LIB_REDEFINES_INC})
+
+ # Add lib redefines file to DAC
+ list(APPEND CLR_DAC_SOURCES libredefines.S)
+ endif(CLR_CMAKE_PLATFORM_LINUX)
endif(WIN32)
if(CLR_CMAKE_PLATFORM_LINUX OR CLR_CMAKE_PLATFORM_FREEBSD OR CLR_CMAKE_PLATFORM_NETBSD)
@@ -64,10 +107,12 @@ _add_library(mscordacobj OBJECT mscordac.cpp)
add_library_clr(mscordaccore SHARED ${CLR_DAC_SOURCES} $<TARGET_OBJECTS:mscordacobj>)
+if(CLR_CMAKE_PLATFORM_LINUX)
+ add_dependencies(mscordaccore lib_redefines_inc)
+endif(CLR_CMAKE_PLATFORM_LINUX)
+
if(CLR_CMAKE_PLATFORM_UNIX)
- add_custom_target(mscordaccore_exports DEPENDS ${EXPORTS_FILE})
add_dependencies(mscordaccore mscordaccore_exports)
-
set_property(TARGET mscordaccore APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
set_property(TARGET mscordaccore APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
endif(CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/dlls/mscordac/libredefines.S b/src/dlls/mscordac/libredefines.S
new file mode 100644
index 0000000000..2449b9e3b1
--- /dev/null
+++ b/src/dlls/mscordac/libredefines.S
@@ -0,0 +1,12 @@
+#if defined(_X86_) || defined(_AMD64_)
+.intel_syntax noprefix
+#endif
+
+#include "unixasmmacros.inc"
+
+#if defined(_ARM_)
+.syntax unified
+.thumb
+#endif
+
+#include "libredefines.inc"
diff --git a/src/dlls/mscordac/mscordac_unixexports.src b/src/dlls/mscordac/mscordac_unixexports.src
index 77a53d7871..60fae97efd 100644
--- a/src/dlls/mscordac/mscordac_unixexports.src
+++ b/src/dlls/mscordac/mscordac_unixexports.src
@@ -10,179 +10,179 @@ DllMain
PAL_RegisterModule
PAL_UnregisterModule
-PAL_BindResources
-PAL_bsearch
-PAL_errno
-PAL_fflush
-PAL__flushall
-PAL_free
-PAL_fwprintf
-PAL_GetPALDirectoryW
-PAL_GetResourceString
-PAL_get_stdout
-PAL_get_stderr
-PAL_GetCurrentThread
-PAL_GetCpuLimit
-PAL_GetSymbolModuleBase
-PAL_GetTransportPipeName
-PAL_InitializeDLL
-PAL_TerminateEx
-PAL_IsDebuggerPresent
-PAL_ProbeMemory
-PAL_Random
-PAL_iswspace
-PAL_memcpy
-PAL_malloc
-PAL_realloc
-PAL_printf
-PAL_qsort
-PAL_Reenter
-PAL_fprintf
-PAL__wcstoui64
-PAL_wcstoul
-PAL_iswprint
-PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange
-PAL_VirtualUnwindOutOfProc
-PAL_wcslen
-PAL_wcsncmp
-PAL_wcsrchr
-PAL_wcscmp
-PAL_wcschr
-PAL_wcscspn
-PAL_wcscat
-PAL_wcsstr
-
-_wcsicmp
-_stricmp
-sprintf_s
-swprintf_s
-vsprintf_s
-_snprintf_s
-_snwprintf_s
-_vsnprintf_s
-_vsnwprintf_s
-_itow_s
-_i64tow_s
-memcpy_s
-sscanf_s
-
-CopyFileW
-CreateDirectoryW
-CreateFileMappingA
-CreateFileMappingW
-CreateFileA
-CreateFileW
-CreateMutexW
-CreateMutexExW
-CreateEventW
-CreateEventExW
-CreateProcessW
-CreateSemaphoreExW
-CreateStreamOnHGlobal
-CreateThread
-CloseHandle
-DebugBreak
-DeleteCriticalSection
-DeleteFileW
-DuplicateHandle
-EnterCriticalSection
-FindClose
-FindFirstFileW
-FindNextFileW
-FlushFileBuffers
-FlushInstructionCache
-FormatMessageW
-FreeLibrary
-FileTimeToSystemTime
-GetACP
-GetCPInfo
-GetCurrentDirectoryW
-GetCurrentProcess
-GetCurrentProcessId
-GetCurrentThreadId
-GetEnvironmentVariableA
-GetEnvironmentVariableW
-GetFileAttributesExW
-GetFileAttributesW
-GetFileSize
-GetFullPathNameW
-GetLastError
-GetLongPathNameW
-GetModuleFileNameW
-GetProcAddress
-GetProcessAffinityMask
-GetProcessHeap
-GetShortPathNameW
-GetStdHandle
-GetSystemInfo
-GetSystemTime
-GetSystemTimeAsFileTime
-GetTempFileNameW
-GetTempPathW
-HeapAlloc
-HeapFree
-HeapSetInformation
-IIDFromString
+; Data exports (not prefixed)
+IID_IUnknown
IID_IClassFactory
IID_ISequentialStream
IID_IStream
-IID_IUnknown
IID_ICLRDataTarget
IID_ICorDebugDataTarget4
IID_ICLRDataEnumMemoryRegionsCallback
-InitializeCriticalSection
-IsDBCSLeadByte
-LeaveCriticalSection
-LoadLibraryA
-LoadLibraryW
-LoadLibraryExW
-LocalAlloc
-LocalReAlloc
-LocalFree
-MapViewOfFile
-MoveFileExW
-MultiByteToWideChar
-OpenProcess
-OutputDebugStringW
-OpenEventW
-OutputDebugStringA
-QueryPerformanceCounter
-QueryPerformanceFrequency
-RaiseException
-ReadFile
-ReleaseMutex
-ReleaseSemaphore
-RemoveDirectoryW
-ResetEvent
-ResumeThread
-SearchPathW
-SetEvent
-SetFileAttributesW
-SetFilePointer
-SetLastError
-SetErrorMode
-Sleep
-SleepEx
-SwitchToThread
-TerminateProcess
-TlsAlloc
-TlsFree
-TlsGetValue
-TlsSetValue
-VirtualAlloc
-VirtualFree
-VirtualProtect
-VirtualQuery
-UnmapViewOfFile
-WaitForMultipleObjectsEx
-WaitForSingleObject
-WaitForSingleObjectEx
-WideCharToMultiByte
-WriteFile
-
nativeStringResourceTable_mscorrc_debug
-_ZN25NativeExceptionHolderBase4PushEv
-_ZN25NativeExceptionHolderBaseC2Ev
-_ZN25NativeExceptionHolderBaseD2Ev
-_ZN28CatchHardwareExceptionHolderC1Ev
-_ZN28CatchHardwareExceptionHolderD1Ev
+
+; All the # exports are prefixed with DAC_
+#PAL_BindResources
+#PAL_CatchHardwareExceptionHolderEnter
+#PAL_CatchHardwareExceptionHolderExit
+#PAL_bsearch
+#PAL_errno
+#PAL_fflush
+#PAL__flushall
+#PAL_free
+#PAL_fwprintf
+#PAL_GetPALDirectoryW
+#PAL_GetResourceString
+#PAL_get_stdout
+#PAL_get_stderr
+#PAL_GetCurrentThread
+#PAL_GetCpuLimit
+#PAL_GetNativeExceptionHolderHead
+#PAL_GetSymbolModuleBase
+#PAL_GetTransportPipeName
+#PAL_InitializeDLL
+#PAL_TerminateEx
+#PAL_IsDebuggerPresent
+#PAL_ProbeMemory
+#PAL_Random
+#PAL_iswspace
+#PAL_memcpy
+#PAL_malloc
+#PAL_realloc
+#PAL_printf
+#PAL_qsort
+#PAL_Reenter
+#PAL_fprintf
+#PAL__wcstoui64
+#PAL_wcstoul
+#PAL_iswprint
+#PAL_VirtualReserveFromExecutableMemoryAllocatorWithinRange
+#PAL_VirtualUnwindOutOfProc
+#PAL_wcslen
+#PAL_wcsncmp
+#PAL_wcsrchr
+#PAL_wcscmp
+#PAL_wcschr
+#PAL_wcscspn
+#PAL_wcscat
+#PAL_wcsstr
+
+#_wcsicmp
+#_stricmp
+#sprintf_s
+#swprintf_s
+#vsprintf_s
+#_snprintf_s
+#_snwprintf_s
+#_vsnprintf_s
+#_vsnwprintf_s
+#_itow_s
+#_i64tow_s
+#memcpy_s
+#sscanf_s
+
+#CopyFileW
+#CreateDirectoryW
+#CreateFileMappingA
+#CreateFileMappingW
+#CreateFileA
+#CreateFileW
+#CreateMutexW
+#CreateMutexExW
+#CreateEventW
+#CreateEventExW
+#CreateProcessW
+#CreateSemaphoreExW
+#CreateThread
+#CloseHandle
+#DebugBreak
+#DeleteCriticalSection
+#DeleteFileW
+#DuplicateHandle
+#EnterCriticalSection
+#FindClose
+#FindFirstFileW
+#FindNextFileW
+#FlushFileBuffers
+#FlushInstructionCache
+#FormatMessageW
+#FreeLibrary
+#FileTimeToSystemTime
+#GetACP
+#GetCPInfo
+#GetCurrentDirectoryW
+#GetCurrentProcess
+#GetCurrentProcessId
+#GetCurrentThreadId
+#GetEnvironmentVariableA
+#GetEnvironmentVariableW
+#GetFileAttributesExW
+#GetFileAttributesW
+#GetFileSize
+#GetFullPathNameW
+#GetLastError
+#GetLongPathNameW
+#GetModuleFileNameW
+#GetProcAddress
+#GetProcessAffinityMask
+#GetProcessHeap
+#GetShortPathNameW
+#GetStdHandle
+#GetSystemInfo
+#GetSystemTime
+#GetSystemTimeAsFileTime
+#GetTempFileNameW
+#GetTempPathW
+#HeapAlloc
+#HeapFree
+#HeapSetInformation
+#InitializeCriticalSection
+#IsDBCSLeadByte
+#LeaveCriticalSection
+#LoadLibraryA
+#LoadLibraryW
+#LoadLibraryExW
+#LocalAlloc
+#LocalReAlloc
+#LocalFree
+#MapViewOfFile
+#MoveFileExW
+#MultiByteToWideChar
+#OpenProcess
+#OutputDebugStringW
+#OpenEventW
+#OutputDebugStringA
+#QueryPerformanceCounter
+#QueryPerformanceFrequency
+#RaiseException
+#ReadFile
+#ReleaseMutex
+#ReleaseSemaphore
+#RemoveDirectoryW
+#ResetEvent
+#ResumeThread
+#SearchPathW
+#SetEvent
+#SetFileAttributesW
+#SetFilePointer
+#SetLastError
+#SetErrorMode
+#Sleep
+#SleepEx
+#SwitchToThread
+#SysAllocStringLen
+#SysFreeString
+#TerminateProcess
+#TlsAlloc
+#TlsFree
+#TlsGetValue
+#TlsSetValue
+#VirtualAlloc
+#VirtualFree
+#VirtualProtect
+#VirtualQuery
+#UnmapViewOfFile
+#WaitForMultipleObjectsEx
+#WaitForSingleObject
+#WaitForSingleObjectEx
+#WideCharToMultiByte
+#WriteFile
diff --git a/src/dlls/mscordac/palredefines.S b/src/dlls/mscordac/palredefines.S
new file mode 100644
index 0000000000..b0cd6159d3
--- /dev/null
+++ b/src/dlls/mscordac/palredefines.S
@@ -0,0 +1,12 @@
+#if defined(_X86_) || defined(_AMD64_)
+.intel_syntax noprefix
+#endif
+
+#include "unixasmmacros.inc"
+
+#if defined(_ARM_)
+.syntax unified
+.thumb
+#endif
+
+#include "palredefines.inc"
diff --git a/src/dlls/mscordbi/CMakeLists.txt b/src/dlls/mscordbi/CMakeLists.txt
index 5f5ad5139e..e979960e07 100644
--- a/src/dlls/mscordbi/CMakeLists.txt
+++ b/src/dlls/mscordbi/CMakeLists.txt
@@ -11,9 +11,14 @@ if(CORECLR_SET_RPATH)
endif(CORECLR_SET_RPATH)
set(MSCORDBI_SOURCES
- mscordbi.cpp
+ mscordbi.cpp
)
+# Add the DAC PAL export mapping file
+if(CLR_CMAKE_PLATFORM_LINUX)
+ list(APPEND MSCORDBI_SOURCES ${PAL_REDEFINES_FILE})
+endif(CLR_CMAKE_PLATFORM_LINUX)
+
if(WIN32)
add_precompiled_header(stdafx.h stdafx.cpp MSCORDBI_SOURCES)
@@ -24,7 +29,7 @@ if(WIN32)
)
set(DEF_SOURCES
- mscordbi.src
+ mscordbi.src
)
convert_to_absolute_path(DEF_SOURCES ${DEF_SOURCES})
@@ -63,15 +68,15 @@ if(CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_PLATFORM_UNIX)
set(COREDBI_LIBRARIES
- debug-pal
- cordbdi
- utilcodestaticnohost
- ildbsymlib
- mdcompiler-dbi
- mdruntime-dbi
- mdruntimerw-dbi
- mddatasource_dbi
- corguids
+ debug-pal
+ cordbdi
+ utilcodestaticnohost
+ ildbsymlib
+ mdcompiler-dbi
+ mdruntime-dbi
+ mdruntimerw-dbi
+ mddatasource_dbi
+ corguids
)
if(WIN32)
@@ -101,14 +106,18 @@ elseif(CLR_CMAKE_PLATFORM_UNIX)
mscordaccore
)
- add_dependencies(mscordbi mscordaccore)
-
# 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)
+
+ if(CLR_CMAKE_PLATFORM_LINUX)
+ add_dependencies(mscordbi pal_redefines_file)
+ endif(CLR_CMAKE_PLATFORM_LINUX)
+
endif(WIN32)
# add the install targets
-install_clr(mscordbi) \ No newline at end of file
+install_clr(mscordbi)