summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt24
-rw-r--r--generateexportedsymbols.awk6
-rw-r--r--generateversionscript.awk14
-rw-r--r--src/dlls/mscoree/CMakeLists.txt6
-rw-r--r--src/dlls/mscoree/coreclr/CMakeLists.txt13
-rw-r--r--src/dlls/mscoree/mscorwks_unixexports.src79
-rw-r--r--src/dlls/mscorrc/CMakeLists.txt5
7 files changed, 141 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f757063173..652da4fd64 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -49,6 +49,12 @@ if(WIN32)
enable_language(ASM_MASM)
else()
enable_language(ASM)
+
+ # Ensure that awk is present
+ find_program(AWK awk)
+ if (AWK STREQUAL "AWK-NOTFOUND")
+ message(FATAL_ERROR "AWK not found")
+ endif()
endif(WIN32)
# Build a list of compiler definitions by putting -D in front of each define.
@@ -103,6 +109,24 @@ function(preprocess_def_file inputFilename outputFilename)
PROPERTIES GENERATED TRUE)
endfunction()
+function(generate_exports_file inputFilename outputFilename)
+
+ if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ set(AWK_SCRIPT generateexportedsymbols.awk)
+ else()
+ set(AWK_SCRIPT generateversionscript.awk)
+ endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+
+ add_custom_command(
+ OUTPUT ${outputFilename}
+ COMMAND ${AWK} -f ${CMAKE_SOURCE_DIR}/${AWK_SCRIPT} ${inputFilename} >${outputFilename}
+ DEPENDS ${inputFilename}
+ COMMENT "Generating exports file ${outputFilename}"
+ )
+ set_source_files_properties(${outputFilename}
+ PROPERTIES GENERATED TRUE)
+endfunction()
+
function(add_precompiled_header header cppFile targetSources)
if(MSVC)
set(precompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/stdafx.pch")
diff --git a/generateexportedsymbols.awk b/generateexportedsymbols.awk
new file mode 100644
index 0000000000..19312c381e
--- /dev/null
+++ b/generateexportedsymbols.awk
@@ -0,0 +1,6 @@
+{
+ # Remove the CR character in case the sources are mapped from
+ # a Windows share and contain CRLF line endings
+ gsub(/\r/,"", $0);
+ print "_" $0;
+}
diff --git a/generateversionscript.awk b/generateversionscript.awk
new file mode 100644
index 0000000000..2aa1f4f0a2
--- /dev/null
+++ b/generateversionscript.awk
@@ -0,0 +1,14 @@
+BEGIN {
+ print "V1.0 {";
+ print " global:";
+}
+{
+ # Remove the CR character in case the sources are mapped from
+ # a Windows share and contain CRLF line endings
+ gsub(/\r/,"", $0);
+ print " " $0 ";";
+}
+END {
+ print " local: *;"
+ print "};";
+}
diff --git a/src/dlls/mscoree/CMakeLists.txt b/src/dlls/mscoree/CMakeLists.txt
index 346ec0de88..5959c0af39 100644
--- a/src/dlls/mscoree/CMakeLists.txt
+++ b/src/dlls/mscoree/CMakeLists.txt
@@ -14,12 +14,16 @@ list(APPEND CLR_SOURCES
set (DEF_SOURCES
mscorwks_ntdef.src
)
-convert_to_absolute_path(DEF_SOURCES ${DEF_SOURCES})
else()
list(APPEND CLR_SOURCES
unixinterface.cpp
)
+
+set (DEF_SOURCES
+ mscorwks_unixexports.src
+)
endif(WIN32)
+convert_to_absolute_path(DEF_SOURCES ${DEF_SOURCES})
convert_to_absolute_path(CLR_SOURCES ${CLR_SOURCES})
add_subdirectory(coreclr)
diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt
index 0e6184c6b4..9337fc54b4 100644
--- a/src/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/dlls/mscoree/coreclr/CMakeLists.txt
@@ -12,6 +12,9 @@ if (WIN32)
else()
add_definitions(-DNO_CRT_INIT)
+ set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/coreclr.exports)
+ generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
+
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
# This option is necessary to ensure that the overloaded delete operator defined inside
# of the utilcode will be used instead of the standard library delete operator.
@@ -25,12 +28,16 @@ else()
# These options are used to force every object to be included even if it's unused.
set(START_WHOLE_ARCHIVE -Wl,--whole-archive)
set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive)
+
+ set(EXPORTS_LINKER_OPTION -Wl,--version-script=${EXPORTS_FILE})
endif(CMAKE_SYSTEM_NAME STREQUAL Linux OR CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
# These options are used to force every object to be included even if it's unused.
set(START_WHOLE_ARCHIVE -force_load)
set(END_WHOLE_ARCHIVE )
+
+ set(EXPORTS_LINKER_OPTION -Wl,-exported_symbols_list,${EXPORTS_FILE})
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
endif (WIN32)
@@ -42,6 +49,12 @@ add_library(coreclr
${CLR_SOURCES}
)
+add_custom_target(coreclr_exports DEPENDS ${EXPORTS_FILE})
+add_dependencies(coreclr coreclr_exports)
+
+set_property(TARGET coreclr APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION})
+set_property(TARGET coreclr APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE})
+
if (CLR_CMAKE_PLATFORM_UNIX)
set(LIB_UNWINDER unwinder_wks)
endif (CLR_CMAKE_PLATFORM_UNIX)
diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src
new file mode 100644
index 0000000000..00eb072438
--- /dev/null
+++ b/src/dlls/mscoree/mscorwks_unixexports.src
@@ -0,0 +1,79 @@
+CloseHandle
+CoCreateGuid
+CopyFileW
+CoreDllMain
+CoTaskMemAlloc
+CoTaskMemFree
+CreateDirectoryW
+CreateEventW
+CreateFileW
+CreateMutexW
+CreateSemaphoreW
+DeleteFileW
+DllMain
+DuplicateHandle
+ExecuteAssembly
+FindClose
+FindFirstFileW
+FindNextFileW
+FlushFileBuffers
+ForkAndExecProcess
+FormatMessageW
+FreeEnvironmentStringsW
+GetACP
+GetConsoleCP
+GetConsoleOutputCP
+GetCurrentDirectoryW
+GetCurrentProcess
+GetCurrentProcessId
+GetEnvironmentStringsW
+GetEnvironmentVariableW
+GetFileAttributesExW
+GetFileInformationFromFd
+GetFileInformationFromPath
+GetFileSize
+GetFileType
+GetFullPathNameW
+GetLongPathNameW
+GetProcAddress
+GetStdHandle
+GetSystemInfo
+GetTempFileNameW
+GetTempPathW
+LocalAlloc
+LocalFree
+LockFile
+lstrlenA
+lstrlenW
+MapViewOfFile
+MoveFileExW
+MultiByteToWideChar
+OpenEventW
+OpenMutexW
+OpenSemaphoreW
+PAL_Random
+QueryPerformanceCounter
+QueryPerformanceFrequency
+RaiseException
+ReadFile
+ReleaseMutex
+ReleaseSemaphore
+RemoveDirectoryW
+ResetEvent
+RtlZeroMemory
+SetConsoleCtrlHandler
+SetCurrentDirectoryW
+SetEndOfFile
+SetEnvironmentVariableW
+SetErrorMode
+SetEvent
+SetFileAttributesW
+SetFilePointer
+SetFileTime
+UnlockFile
+UnmapViewOfFile
+VirtualAlloc
+VirtualFree
+VirtualQuery
+WideCharToMultiByte
+WriteFile
diff --git a/src/dlls/mscorrc/CMakeLists.txt b/src/dlls/mscorrc/CMakeLists.txt
index f3078151e0..47d87ae30b 100644
--- a/src/dlls/mscorrc/CMakeLists.txt
+++ b/src/dlls/mscorrc/CMakeLists.txt
@@ -12,11 +12,6 @@ else()
# given Windows .rc file. The target C++ file path is returned in the
# variable specified by the TARGET_FILE parameter.
function(build_resources SOURCE TARGET_NAME TARGET_FILE)
- # Ensure that the necessary tools are present
- find_program(AWK awk)
- if (AWK STREQUAL "AWK-NOTFOUND")
- message(FATAL_ERROR "AWK not found")
- endif()
get_compile_definitions(PREPROCESS_DEFINITIONS)
get_include_directories(INCLUDE_DIRECTORIES)