This change limits the libcoreclr.so exports on Unix to functions that are PInvoked
by the managed mscorlib / corefx and the DllMain, CoreDllMain and ExecuteAssembly.
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.
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")
--- /dev/null
+{
+ # Remove the CR character in case the sources are mapped from
+ # a Windows share and contain CRLF line endings
+ gsub(/\r/,"", $0);
+ print "_" $0;
+}
--- /dev/null
+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 "};";
+}
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)
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.
# 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)
${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)
--- /dev/null
+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
# 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)