From e0c80c5f5c7d395d79aa350a26f46101a78af95d Mon Sep 17 00:00:00 2001 From: "John Chen (JOCHEN7)" Date: Tue, 28 Apr 2015 13:20:01 -0700 Subject: Build crossgen for Linux - Crossgen is now built as part of coreclr - Crossgen successfully compiles mscorlib.dll - Resulting mscorlib.ni.dll not yet usable --- clr.coreclr.props | 2 +- crossgen.cmake | 2 + src/CMakeLists.txt | 2 +- src/binder/CMakeLists.txt | 4 +- src/dlls/mscoree/mscoree.cpp | 16 ++- src/gcinfo/CMakeLists.txt | 4 +- src/inc/clr_std/vector | 2 + src/inc/clrconfigvalues.h | 2 +- src/inc/crosscomp.h | 2 +- src/inc/ex.h | 4 +- src/jit/CMakeLists.txt | 4 +- src/jit/error.cpp | 2 +- src/md/compiler/CMakeLists.txt | 4 +- src/md/enc/CMakeLists.txt | 4 +- src/md/hotdata/CMakeLists.txt | 2 +- src/md/runtime/CMakeLists.txt | 4 +- src/mscorlib/Tools/BclRewriter/BclRewriter.targets | 7 +- src/pal/inc/pal.h | 12 +++ src/pal/inc/rt/ntimage.h | 4 +- src/pal/inc/rt/palrt.h | 4 +- src/pal/src/CMakeLists.txt | 1 + src/pal/src/file/path.cpp | 39 +++++++ src/pal/src/misc/msgbox.cpp | 84 ++++++++++++--- src/strongname/api/CMakeLists.txt | 4 +- src/strongname/api/strongname.cpp | 14 +-- src/strongname/api/strongnameinternal.cpp | 10 +- src/strongname/inc/strongnameholders.h | 2 +- src/strongname/inc/strongnameinternal.h | 4 +- src/tools/CMakeLists.txt | 7 +- src/tools/crossgen/CMakeLists.txt | 61 ++++++----- src/tools/crossgen/crossgen.cpp | 51 ++++++++-- src/tools/util/consoleargs.cpp | 84 +++++++++------ src/tools/util/consoleargs.h | 8 +- src/utilcode/CMakeLists.txt | 4 +- src/vm/ceeload.cpp | 4 +- src/vm/ceemain.cpp | 2 +- src/vm/coreclr/corebindresult.inl | 2 +- src/vm/crossgen/CMakeLists.txt | 113 +++++++++++---------- src/vm/crossgencompile.cpp | 4 +- src/vm/frames.h | 4 +- src/vm/jitinterface.cpp | 2 +- src/vm/loaderallocator.cpp | 2 - src/vm/loaderallocator.hpp | 4 +- src/vm/pefile.cpp | 4 +- src/vm/peimage.inl | 4 +- src/vm/threads.h | 1 + src/zap/nativeformatwriter.cpp | 2 +- src/zap/zapheaders.cpp | 2 + src/zap/zapimage.cpp | 5 +- src/zap/zapimport.cpp | 4 +- src/zap/zapinfo.cpp | 2 + src/zap/zapper.cpp | 8 +- src/zap/zaprelocs.cpp | 4 +- src/zap/zapwriter.cpp | 4 +- 54 files changed, 412 insertions(+), 225 deletions(-) diff --git a/clr.coreclr.props b/clr.coreclr.props index da1b6816d3..931a62c526 100644 --- a/clr.coreclr.props +++ b/clr.coreclr.props @@ -50,7 +50,7 @@ true true true - true + true true true diff --git a/crossgen.cmake b/crossgen.cmake index f8bdbd0567..af285fceea 100644 --- a/crossgen.cmake +++ b/crossgen.cmake @@ -4,6 +4,7 @@ add_definitions( -DCROSSGEN_COMPILE -DCROSS_COMPILE -DFEATURE_NATIVE_IMAGE_GENERATION + -DFEATURE_MERGE_JIT_AND_ENGINE -DSELF_NO_HOST) remove_definitions( @@ -11,6 +12,7 @@ remove_definitions( -DFEATURE_EVENT_TRACE=1 -DFEATURE_LOADER_OPTIMIZATION -DFEATURE_MULTICOREJIT + -DFEATURE_PERFMAP -DFEATURE_RANDOMIZED_STRING_HASHING -DFEATURE_VERSIONING_LOG ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95a9640e32..6cebd0669a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,11 +34,11 @@ add_subdirectory(binder) add_subdirectory(classlibnative) add_subdirectory(dlls) add_subdirectory(ToolBox) +add_subdirectory(tools) add_subdirectory(unwinder) if(WIN32) add_subdirectory(ipcman) - add_subdirectory(tools) endif(WIN32) if(CLR_CMAKE_PLATFORM_UNIX) diff --git a/src/binder/CMakeLists.txt b/src/binder/CMakeLists.txt index 7641e02e63..af38572b4c 100644 --- a/src/binder/CMakeLists.txt +++ b/src/binder/CMakeLists.txt @@ -35,7 +35,5 @@ if(CLR_CMAKE_PLATFORM_UNIX) endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(v3binder) -if(WIN32) - add_subdirectory(v3binder_crossgen) -endif() +add_subdirectory(v3binder_crossgen) diff --git a/src/dlls/mscoree/mscoree.cpp b/src/dlls/mscoree/mscoree.cpp index 2c78e7db5b..42c9ade480 100644 --- a/src/dlls/mscoree/mscoree.cpp +++ b/src/dlls/mscoree/mscoree.cpp @@ -907,9 +907,23 @@ STDAPI GetCORSystemDirectoryInternal(__out_ecount_part_opt(cchBuffer, *pdwLength if (pBuffer == NULL) IfFailGo(E_POINTER); +#ifdef CROSSGEN_COMPILE + if (WszGetModuleFileName(NULL, pBuffer, cchBuffer) == 0) + { + IfFailGo(HRESULT_FROM_GetLastError()); + } + WCHAR *pSeparator; + pSeparator = wcsrchr(pBuffer, DIRECTORY_SEPARATOR_CHAR_W); + if (pSeparator == NULL) + { + IfFailGo(HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)); + } + *pSeparator = W('\0'); +#else if (!PAL_GetPALDirectory(pBuffer, cchBuffer)) { IfFailGo(HRESULT_FROM_GetLastError()); } +#endif // Include the null terminator in the length *pdwLength = (DWORD)wcslen(pBuffer)+1; @@ -1267,7 +1281,7 @@ HRESULT SetInternalSystemDirectory() } #if defined(CROSSGEN_COMPILE) && defined(FEATURE_CORECLR) -void SetMscorlibPath(LPCWCHAR wzSystemDirectory) +void SetMscorlibPath(LPCWSTR wzSystemDirectory) { wcscpy_s(g_pSystemDirectory, COUNTOF(g_pSystemDirectory), wzSystemDirectory); diff --git a/src/gcinfo/CMakeLists.txt b/src/gcinfo/CMakeLists.txt index 2764b68cf5..47789d8ccb 100644 --- a/src/gcinfo/CMakeLists.txt +++ b/src/gcinfo/CMakeLists.txt @@ -13,6 +13,4 @@ if(CLR_CMAKE_PLATFORM_UNIX) endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(lib) -if(WIN32) - add_subdirectory(crossgen) -endif() +add_subdirectory(crossgen) diff --git a/src/inc/clr_std/vector b/src/inc/clr_std/vector index b189c413f6..6b36880033 100644 --- a/src/inc/clr_std/vector +++ b/src/inc/clr_std/vector @@ -27,6 +27,8 @@ namespace std class vector { public: + class const_iterator; + class iterator { friend class std::vector::const_iterator; diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h index 75836e0c07..b3331840d9 100644 --- a/src/inc/clrconfigvalues.h +++ b/src/inc/clrconfigvalues.h @@ -764,7 +764,7 @@ CONFIG_DWORD_INFO(INTERNAL_NoASLRForNgen, W("NoASLRForNgen"), 0, "Turn off IMAGE RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NgenAllowOutput, W("NgenAllowOutput"), 0, "If set to 1, the NGEN worker will bind to the parent console, thus allowing stdout output to work", CLRConfig::REGUTIL_default) #ifdef CROSSGEN_COMPILE -RETAIL_CONFIG_DWORD_INFO(INTERNAL_CrossGenAssumeInputSigned, L"CrossGenAssumeInputSigned", 1, "CrossGen should assume that its input assemblies will be signed before deployment") +RETAIL_CONFIG_DWORD_INFO(INTERNAL_CrossGenAssumeInputSigned, W("CrossGenAssumeInputSigned"), 1, "CrossGen should assume that its input assemblies will be signed before deployment") #endif // diff --git a/src/inc/crosscomp.h b/src/inc/crosscomp.h index 1c21ab681f..07801ef18e 100644 --- a/src/inc/crosscomp.h +++ b/src/inc/crosscomp.h @@ -360,5 +360,5 @@ typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS { #ifdef CROSSGEN_COMPILE -void CrossGenNotSupported(char * message); +void CrossGenNotSupported(const char * message); #endif diff --git a/src/inc/ex.h b/src/inc/ex.h index 8babb687b1..644e19eea3 100644 --- a/src/inc/ex.h +++ b/src/inc/ex.h @@ -7,6 +7,8 @@ #if !defined(_EX_H_) #define _EX_H_ +void RetailAssertIfExpectedClean(); // Defined in src/utilcode/debug.cpp + #ifdef CLR_STANDALONE_BINDER #define INCONTRACT(x) @@ -51,7 +53,6 @@ inline void IfFailThrow(HRESULT hr) } } -void RetailAssertIfExpectedClean(); // Defined in src\util\Debug.cpp /* inline HRESULT OutOfMemory() { @@ -1252,7 +1253,6 @@ Exception *ExThrowWithInnerHelper(Exception *inner); // a RetailAssert when a reg key is set if we get an unexpected HRESULT // from one of the RPC calls. //=================================================================================== -void RetailAssertIfExpectedClean(); // Defined in src\util\Debug.cpp #define EX_CATCH_HRESULT_AND_NGEN_CLEAN(_hr) \ EX_CATCH \ diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt index d5f26233cc..b1c3e09658 100644 --- a/src/jit/CMakeLists.txt +++ b/src/jit/CMakeLists.txt @@ -90,6 +90,4 @@ endif() set(CLR_EXPORTED_SYMBOL_FILE ${CLRJIT_EXPORTS_DEF}) add_subdirectory(dll) -if(WIN32) - add_subdirectory(crossgen) -endif() +add_subdirectory(crossgen) diff --git a/src/jit/error.cpp b/src/jit/error.cpp index 223afb1efb..370a452dd1 100644 --- a/src/jit/error.cpp +++ b/src/jit/error.cpp @@ -356,7 +356,7 @@ void logf_stdout(const char* fmt, va_list args) } else { -#ifdef CROSSGEN_COMPILE +#if defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX) // Crossgen has forced stdout into UNICODE only mode: // _setmode(_fileno(stdout), _O_U8TEXT); // diff --git a/src/md/compiler/CMakeLists.txt b/src/md/compiler/CMakeLists.txt index 130a8d2d64..b9fb91b705 100644 --- a/src/md/compiler/CMakeLists.txt +++ b/src/md/compiler/CMakeLists.txt @@ -31,6 +31,4 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(wks) add_subdirectory(dbi) -if(WIN32) - add_subdirectory(crossgen) -endif(WIN32) +add_subdirectory(crossgen) diff --git a/src/md/enc/CMakeLists.txt b/src/md/enc/CMakeLists.txt index 8ba256ba30..a7a2c91aba 100644 --- a/src/md/enc/CMakeLists.txt +++ b/src/md/enc/CMakeLists.txt @@ -21,6 +21,4 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(wks) add_subdirectory(dbi) -if(WIN32) - add_subdirectory(crossgen) -endif(WIN32) +add_subdirectory(crossgen) diff --git a/src/md/hotdata/CMakeLists.txt b/src/md/hotdata/CMakeLists.txt index 246dc63985..199edaa40e 100644 --- a/src/md/hotdata/CMakeLists.txt +++ b/src/md/hotdata/CMakeLists.txt @@ -15,7 +15,7 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(full) +add_subdirectory(crossgen) if(WIN32) add_subdirectory(full-staticcrt) - add_subdirectory(crossgen) endif(WIN32) diff --git a/src/md/runtime/CMakeLists.txt b/src/md/runtime/CMakeLists.txt index eb25640f36..96c9b5114a 100644 --- a/src/md/runtime/CMakeLists.txt +++ b/src/md/runtime/CMakeLists.txt @@ -20,6 +20,4 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(wks) add_subdirectory(dbi) -if(WIN32) - add_subdirectory(crossgen) -endif(WIN32) +add_subdirectory(crossgen) diff --git a/src/mscorlib/Tools/BclRewriter/BclRewriter.targets b/src/mscorlib/Tools/BclRewriter/BclRewriter.targets index a0f67a6528..d64414fa13 100644 --- a/src/mscorlib/Tools/BclRewriter/BclRewriter.targets +++ b/src/mscorlib/Tools/BclRewriter/BclRewriter.targets @@ -18,8 +18,13 @@ + + + win + unix + - + diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index d43e7d0d1e..7c9936f36d 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -702,8 +702,19 @@ MessageBoxW( IN LPCWSTR lpCaption, IN UINT uType); +PALIMPORT +int +PALAPI +MessageBoxA( + IN LPVOID hWnd, // NOTE: diff from winuser.h + IN LPCSTR lpText, + IN LPCSTR lpCaption, + IN UINT uType); + #ifdef UNICODE #define MessageBox MessageBoxW +#else +#define MessageBox MessageBoxA #endif /***************** wincon.h Entrypoints **********************************/ @@ -786,6 +797,7 @@ typedef struct _SECURITY_ATTRIBUTES { #define FILE_ATTRIBUTE_SYSTEM 0x00000004 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_DEVICE 0x00000040 #define FILE_ATTRIBUTE_NORMAL 0x00000080 #define FILE_FLAG_WRITE_THROUGH 0x80000000 diff --git a/src/pal/inc/rt/ntimage.h b/src/pal/inc/rt/ntimage.h index 8d3a0c84eb..66201f0c92 100644 --- a/src/pal/inc/rt/ntimage.h +++ b/src/pal/inc/rt/ntimage.h @@ -428,8 +428,10 @@ typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; // IMAGE_LIBRARY_PROCESS_TERM 0x0002 // Reserved. // IMAGE_LIBRARY_THREAD_INIT 0x0004 // Reserved. // IMAGE_LIBRARY_THREAD_TERM 0x0008 // Reserved. +#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040 // DLL can move +#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100 // Image ix NX compatible #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 // Do not bind this image. -// 0x1000 // Reserved. +#define IMAGE_DLLCHARACTERISTICS_APPCONTAINER 0x1000 // Image should execute in an AppContainer #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 // Driver uses WDM model // 0x4000 // Reserved. #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index 1d6344d969..8369cae7cb 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -1144,7 +1144,7 @@ errno_t __cdecl getenv_s(size_t *_ReturnValue, char *_Dst, size_t _SizeInWords, STDAPI_(BOOL) PathAppendW(LPWSTR pszPath, LPCWSTR pszMore); STDAPI_(int) PathCommonPrefixW(LPCWSTR pszFile1, LPCWSTR pszFile2, LPWSTR pszPath); -STDAPI_(LPWSTR) PathFindFileNameW(LPCWSTR pPath); +PALIMPORT LPWSTR PALAPI PathFindFileNameW(LPCWSTR pPath); STDAPI_(LPWSTR) PathFindExtensionW(LPCWSTR pszPath); STDAPI_(int) PathGetDriveNumberW(LPCWSTR lpsz); STDAPI_(BOOL) PathIsRelativeW(LPCWSTR lpszPath); @@ -1333,9 +1333,11 @@ typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOLEAN); #ifdef PLATFORM_UNIX #define DIRECTORY_SEPARATOR_CHAR_W W('/') +#define DIRECTORY_SEPARATOR_STR_W W("/") #define PATH_SEPARATOR_CHAR_W W(':') #else // PLATFORM_UNIX #define DIRECTORY_SEPARATOR_CHAR_W W('\\') +#define DIRECTORY_SEPARATOR_STR_W W("\\") #define PATH_SEPARATOR_CHAR_W W(';') #endif // PLATFORM_UNIX diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index e2d57cba83..3dff2dbe84 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -102,6 +102,7 @@ set(SOURCES misc/fmtmessage.cpp misc/interlock.cpp misc/miscpalapi.cpp + misc/msgbox.cpp misc/dactableaddress.cpp misc/strutil.cpp misc/sysinfo.cpp diff --git a/src/pal/src/file/path.cpp b/src/pal/src/file/path.cpp index e91975bd69..f9e2234124 100644 --- a/src/pal/src/file/path.cpp +++ b/src/pal/src/file/path.cpp @@ -1485,3 +1485,42 @@ done: return nRet; } +/*++ +Function: + PathFindFileNameW + +See MSDN doc. +--*/ +LPWSTR +PALAPI +PathFindFileNameW( + IN LPCWSTR pPath + ) +{ + PERF_ENTRY(PathFindFileNameW); + ENTRY("PathFindFileNameW(pPath=%p (%S))\n", + pPath?pPath:W16_NULLSTRING, + pPath?pPath:W16_NULLSTRING); + + LPWSTR ret = (LPWSTR)pPath; + if (ret != NULL && *ret != W('\0')) + { + ret = PAL_wcschr(ret, W('\0')) - 1; + if (ret > pPath && *ret == W('/')) + { + ret--; + } + while (ret > pPath && *ret != W('/')) + { + ret--; + } + if (*ret == W('/') && *(ret + 1) != W('\0')) + { + ret++; + } + } +done: + LOGEXIT("PathFindFileNameW returns %S\n", ret); + PERF_EXIT(PathFindFileNameW); + return ret; +} diff --git a/src/pal/src/misc/msgbox.cpp b/src/pal/src/misc/msgbox.cpp index 37b9422991..a06d53bc40 100644 --- a/src/pal/src/misc/msgbox.cpp +++ b/src/pal/src/misc/msgbox.cpp @@ -187,6 +187,68 @@ MessageBoxW( goto error; } } + + rc = MessageBoxA(hWnd, text, caption, uType); + +error: + PAL_free(caption); + PAL_free(text); + + + LOGEXIT("MessageBoxW returns %d\n", rc); + PERF_EXIT(MessageBoxW); + return rc; +} + + +/*++ +Function: + MessageBoxA + +This is a small subset of MessageBox that simply logs a message to the +system logging facility and returns. A typical log entry will look +like: + +May 23 15:48:10 rice example1: MessageBox: Caption: Error Text + +Note: + hWnd should always be NULL. + +See MSDN doc. +--*/ +int +PALAPI +MessageBoxA( + IN LPVOID hWnd, + IN LPCSTR lpText, + IN LPCSTR lpCaption, + IN UINT uType) +{ + INT len = 0; + INT rc = 0; + + PERF_ENTRY(MessageBoxA); + ENTRY( "MessageBoxA (hWnd=%p, lpText=%p (%s), lpCaption=%p (%s), uType=%#x)\n", + hWnd, lpText?lpText:"NULL", lpText?lpText:"NULL", + lpCaption?lpCaption:"NULL", + lpCaption?lpCaption:"NULL", uType ); + + if (hWnd != NULL) + { + ASSERT("hWnd != NULL"); + } + + if (lpText == NULL) + { + WARN("No message text\n"); + + lpText = "(no message text)"; + } + + if (lpCaption == NULL) + { + lpCaption = "Error"; + } if (uType & MB_DEFMASK) { @@ -233,8 +295,8 @@ MessageBoxW( osstatus = SessionGetInfo(callerSecuritySession, &secSession, &secSessionInfo); if (noErr == osstatus && (secSessionInfo & sessionHasGraphicAccess) != 0) { - CFStringRef cfsTitle = CFStringCreateWithCString(kCFAllocatorDefault, caption, kCFStringEncodingUTF8); - CFStringRef cfsText = CFStringCreateWithCString(kCFAllocatorDefault, text, kCFStringEncodingUTF8); + CFStringRef cfsTitle = CFStringCreateWithCString(kCFAllocatorDefault, lpCaption, kCFStringEncodingUTF8); + CFStringRef cfsText = CFStringCreateWithCString(kCFAllocatorDefault, lpText, kCFStringEncodingUTF8); CFStringRef cfsButton1 = NULL; CFStringRef cfsButton2 = NULL; CFStringRef cfsButton3 = NULL; @@ -336,25 +398,21 @@ MessageBoxW( { // We're not in a login session, e.g., running via ssh, and so bringing // up a message box would be bad form. - fprintf ( stderr, "MessageBox: %s: %s", caption, text ); - syslog(LOG_USER|LOG_ERR, "MessageBox: %s: %s", caption, text); + fprintf ( stderr, "MessageBox: %s: %s", lpCaption, lpText ); + syslog(LOG_USER|LOG_ERR, "MessageBox: %s: %s", lpCaption, lpText); } #else // __APPLE__ - fprintf ( stderr, "MessageBox: %s: %s", caption, text ); - syslog(LOG_USER|LOG_ERR, "MessageBox: %s: %s", caption, text); + fprintf ( stderr, "MessageBox: %s: %s", lpCaption, lpText ); + syslog(LOG_USER|LOG_ERR, "MessageBox: %s: %s", lpCaption, lpText); // Some systems support displaying a GUI dialog. (This will suspend the current thread until they hit the // 'OK' button and allow a debugger to be attached). - PAL_DisplayDialog(caption, text); + PAL_DisplayDialog(lpCaption, lpText); #endif // __APPLE__ else PALCLeaveCriticalSection( &msgbox_critsec); error: - PAL_free(caption); - PAL_free(text); - - - LOGEXIT("MessageBoxW returns %d\n", rc); - PERF_EXIT(MessageBoxW); + LOGEXIT("MessageBoxA returns %d\n", rc); + PERF_EXIT(MessageBoxA); return rc; } diff --git a/src/strongname/api/CMakeLists.txt b/src/strongname/api/CMakeLists.txt index 9b1a49025e..079d9a5559 100644 --- a/src/strongname/api/CMakeLists.txt +++ b/src/strongname/api/CMakeLists.txt @@ -24,6 +24,4 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(wks) -if(WIN32) - add_subdirectory(crossgen) -endif(WIN32) +add_subdirectory(crossgen) diff --git a/src/strongname/api/strongname.cpp b/src/strongname/api/strongname.cpp index ec91fe8788..44ca1735cf 100644 --- a/src/strongname/api/strongname.cpp +++ b/src/strongname/api/strongname.cpp @@ -114,9 +114,9 @@ enum StrongNameCachedCsp { // allocated lazily as needed. struct SN_THREAD_CTX { DWORD m_dwLastError; -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) HCRYPTPROV m_hProv[CachedCspCount]; -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) }; #endif // !DACCESS_COMPILE @@ -200,7 +200,7 @@ struct SN_THREAD_CTX { #endif // FEATURE_WINDOWSPHONE #endif // FEATURE_CORECLR -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) #ifdef FEATURE_STRONGNAME_MIGRATION #include "caparser.h" @@ -4668,11 +4668,11 @@ ErrExit: #endif // #ifndef DACCESS_COMPILE -#else // !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#else // !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) #define InitStrongName() S_OK -#endif // !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#endif // !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) // Free buffer allocated by routines below. @@ -4698,12 +4698,12 @@ SN_THREAD_CTX *GetThreadContext() if (pThreadCtx == NULL) return NULL; pThreadCtx->m_dwLastError = S_OK; -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) for (ULONG i = 0; i < CachedCspCount; i++) { pThreadCtx->m_hProv[i] = NULL; } -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) EX_TRY { ClrFlsSetValue(TlsIdx_StrongName, pThreadCtx); diff --git a/src/strongname/api/strongnameinternal.cpp b/src/strongname/api/strongnameinternal.cpp index 10a08fa18d..5eda45f682 100644 --- a/src/strongname/api/strongnameinternal.cpp +++ b/src/strongname/api/strongnameinternal.cpp @@ -300,7 +300,7 @@ bool StrongNameIsValidPublicKey(const PublicKeyBlob &keyPublicKey, bool fImportK return false; } -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) // Make sure the public key blob imports properly if (fImportKeys) { @@ -316,9 +316,9 @@ bool StrongNameIsValidPublicKey(const PublicKeyBlob &keyPublicKey, bool fImportK return false; } } -#else // !FEATURE_CORECLR || CROSSGEN_COMPILE +#else // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) _ASSERTE(!fImportKeys); -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) return true; } @@ -345,7 +345,7 @@ DWORD StrongNameSizeOfPublicKey(const PublicKeyBlob &keyPublicKey) GET_UNALIGNED_VAL32(&keyPublicKey.cbPublicKey); // the number of bytes in the key } -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) //--------------------------------------------------------------------------------------- // @@ -444,5 +444,5 @@ bool StrongNameCryptAcquireContext(HCRYPTPROV *phProv, LPCWSTR pwszContainer, LP return !!WszCryptAcquireContext(phProv, pwszContainer, pwszProvider, dwProvType, dwFlags); } -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) diff --git a/src/strongname/inc/strongnameholders.h b/src/strongname/inc/strongnameholders.h index 663fd5eaa6..36597ea97d 100644 --- a/src/strongname/inc/strongnameholders.h +++ b/src/strongname/inc/strongnameholders.h @@ -22,7 +22,7 @@ void VoidStrongNameFreeBuffer(__in T *pBuffer) } NEW_WRAPPER_TEMPLATE1(StrongNameBufferHolder, VoidStrongNameFreeBuffer<_TYPE>); -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) // Holder for HCRYPTPROV handles directly allocated from CAPI inline void ReleaseCapiProvider(HCRYPTPROV hProv) { diff --git a/src/strongname/inc/strongnameinternal.h b/src/strongname/inc/strongnameinternal.h index ec5fb5da90..6666bb261f 100644 --- a/src/strongname/inc/strongnameinternal.h +++ b/src/strongname/inc/strongnameinternal.h @@ -41,7 +41,7 @@ bool StrongNameIsEcmaKey(const PublicKeyBlob &keyPublicKey); bool StrongNameIsTheKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey); -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) // Verify the format of a public key blob bool StrongNameIsValidKeyPair(__in_ecount(cbKeyPair) const BYTE *pbKeyPair, DWORD cbKeyPair); @@ -49,7 +49,7 @@ bool StrongNameIsValidKeyPair(__in_ecount(cbKeyPair) const BYTE *pbKeyPair, DWOR bool GetBytesFromHex(LPCUTF8 szHexString, ULONG cchHexString, BYTE** buffer, ULONG *cbBufferSize); bool StrongNameCryptAcquireContext(HCRYPTPROV *phProv, LPCWSTR pwszContainer, LPCWSTR pwszProvider, DWORD dwProvType, DWORD dwFlags); -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) #ifdef FEATURE_CORECLR bool StrongNameIsSilverlightPlatformKey(__in_ecount(cbKey) const BYTE *pbKey, DWORD cbKey); diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index d23b7e0b82..87c3eae90f 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -1,3 +1,6 @@ add_subdirectory(crossgen) -add_subdirectory(GenClrDebugResource) -add_subdirectory(InjectResource) \ No newline at end of file + +if(WIN32) + add_subdirectory(GenClrDebugResource) + add_subdirectory(InjectResource) +endif(WIN32) diff --git a/src/tools/crossgen/CMakeLists.txt b/src/tools/crossgen/CMakeLists.txt index e7e2b65086..e35db0f4a7 100644 --- a/src/tools/crossgen/CMakeLists.txt +++ b/src/tools/crossgen/CMakeLists.txt @@ -7,26 +7,40 @@ include_directories(../util) include_directories(../../pal/prebuilt/corerror) set(crossgen_SOURCES crossgen.cpp ../util/consoleargs.cpp) -set(crossgen_RESOURCES Native.rc) +if(WIN32) + set(crossgen_RESOURCES Native.rc) +endif() add_definitions(-DFX_VER_INTERNALNAME_STR=crossgen.exe) add_definitions(-DNO_NGENPDB) -if(CLR_CMAKE_PLATFORM_UNIX) - # This does not compile on Linux yet - if(CAN_BE_COMPILED_ON_LINUX) - add_executable(crossgen - ${crossgen_SOURCES} - ${crossgen_RESOURCES} - ) - endif(CAN_BE_COMPILED_ON_LINUX) +add_executable(crossgen + ${crossgen_SOURCES} + ${crossgen_RESOURCES} +) -else() - add_executable(crossgen - ${crossgen_SOURCES} - ${crossgen_RESOURCES} - ) +target_link_libraries(crossgen + cee_crossgen + mdcompiler_crossgen + mdruntime_crossgen + mdruntimerw_crossgen + mdhotdata_crossgen + corguids + jit_crossgen + gcinfo_crossgen + corzap_crossgen + mscorlib_crossgen + strongname_crossgen + utilcode_crossgen + v3binder_crossgen +) +if(CLR_CMAKE_PLATFORM_UNIX) + target_link_libraries(crossgen + coreclrpal + palrt + ) +else() target_link_libraries(crossgen advapi32 ole32 @@ -36,32 +50,17 @@ else() version shlwapi bcrypt - corguids - utilcode_crossgen - corzap_crossgen - jit_crossgen - gcinfo_crossgen - strongname_crossgen - mdcompiler_crossgen mdwinmd_crossgen - mdruntimerw_crossgen - mdhotdata_crossgen - mdruntime_crossgen - cee_crossgen - mscorlib_crossgen - v3binder_crossgen ${STATIC_MT_CRT_LIB} ) - # Can't compile on linux yet so only add for windows - # add the install targets - install (TARGETS crossgen DESTINATION .) - # We will generate PDB only for the debug configuration install (FILES ${CMAKE_CURRENT_BINARY_DIR}/$/crossgen.pdb DESTINATION PDB) endif(CLR_CMAKE_PLATFORM_UNIX) +install (TARGETS crossgen DESTINATION .) + add_subdirectory(../../zap/crossgen ../../zap/crossgen) add_subdirectory(../../vm/crossgen ../../vm/crossgen) add_subdirectory(../../vm/crossgen_mscorlib ../../vm/crossgen_mscorlib) diff --git a/src/tools/crossgen/crossgen.cpp b/src/tools/crossgen/crossgen.cpp index db663f0c81..5005ea4cab 100644 --- a/src/tools/crossgen/crossgen.cpp +++ b/src/tools/crossgen/crossgen.cpp @@ -23,9 +23,6 @@ #include "coregen.h" #include "consoleargs.h" -#define SEPARATOR_CHAR_W W('\\') -#define SEPARATOR_STRING_W W("\\") - // Return values from wmain() in case of error enum ReturnValues { @@ -41,7 +38,7 @@ STDAPI CreatePDBWorker(LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPat STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL, LPCWSTR pwzPlatformWinmdPaths=NULL, ICorSvcLogger *pLogger = NULL); void SetSvcLogger(ICorSvcLogger *pCorSvcLogger); #ifdef FEATURE_CORECLR -void SetMscorlibPath(LPCWCHAR wzSystemDirectory); +void SetMscorlibPath(LPCWSTR wzSystemDirectory); #endif /* --------------------------------------------------------------------------- * @@ -57,7 +54,7 @@ void Outputf(LPCWSTR szFormat, ...) { va_list args; va_start(args, szFormat); - vwprintf(szFormat, args); + vfwprintf(stdout, szFormat, args); va_end(args); } @@ -259,7 +256,7 @@ bool MatchParameter(LPCWSTR szArg, LPCWSTR szTestParamName) // Returns true if pwzString ends with the string in pwzCandidate // Ignores case // -bool StringEndsWith(LPWSTR pwzString, LPWSTR pwzCandidate) +bool StringEndsWith(LPCWSTR pwzString, LPCWSTR pwzCandidate) { size_t stringLength = wcslen(pwzString); size_t candidateLength = wcslen(pwzCandidate); @@ -269,7 +266,7 @@ bool StringEndsWith(LPWSTR pwzString, LPWSTR pwzCandidate) return false; } - LPWSTR pwzStringEnd = pwzString + stringLength - candidateLength; + LPCWSTR pwzStringEnd = pwzString + stringLength - candidateLength; return !_wcsicmp(pwzStringEnd, pwzCandidate); } @@ -322,7 +319,7 @@ bool ComputeMscorlibPathFromTrustedPlatformAssemblies(LPWSTR pwzMscorlibPath, DW // Given a path terminated with "\\" and a search mask, this function will add // the enumerated files, corresponding to the search mask, from the path into // the refTPAList. -void PopulateTPAList(SString path, LPWSTR pwszMask, SString &refTPAList, bool fCompilingMscorlib, bool fCreatePDB) +void PopulateTPAList(SString path, LPCWSTR pwszMask, SString &refTPAList, bool fCompilingMscorlib, bool fCreatePDB) { _ASSERTE(path.GetCount() > 0); ClrDirectoryEnumerator folderEnumerator(path.GetUnicode(), pwszMask); @@ -444,7 +441,9 @@ extern HMODULE g_hThisInst; int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) { +#ifndef FEATURE_PAL g_hThisInst = WszGetModuleHandle(NULL); +#endif ///////////////////////////////////////////////////////////////////////// // @@ -468,8 +467,10 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) HRESULT hr; +#ifndef PLATFORM_UNIX // This is required to properly display Unicode characters _setmode(_fileno(stdout), _O_U8TEXT); +#endif // Skip this executable path argv++; @@ -690,7 +691,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) argc--; // Ensure output dir ends in a backslash, or else diasymreader has issues - if (wzDirectoryToStorePDB[wcslen(wzDirectoryToStorePDB)-1] != SEPARATOR_CHAR_W) + if (wzDirectoryToStorePDB[wcslen(wzDirectoryToStorePDB)-1] != DIRECTORY_SEPARATOR_CHAR_W) { if (wcscat_s( wzDirectoryToStorePDB, @@ -811,7 +812,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) Output(W("You must specify an output filename (/out )\n")); exit(INVALID_ARGUMENTS); } - if (CopyFileExW(pwzFilename, pwzOutputFilename, NULL, NULL, NULL, 0) == 0) + if (CopyFileW(pwzFilename, pwzOutputFilename, FALSE) == 0) { DWORD dwLastError = GetLastError(); OutputErrf(W("Error: x86 copy failed for \"%s\" (0x%08x)\n"), pwzFilename, HRESULT_FROM_WIN32(dwLastError)); @@ -928,7 +929,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) exit(CLR_INIT_ERROR); } - wchar_t* pszSep = wcsrchr(wzTrustedPathRoot, SEPARATOR_CHAR_W); + wchar_t* pszSep = wcsrchr(wzTrustedPathRoot, DIRECTORY_SEPARATOR_CHAR_W); if (pszSep == NULL) { ERROR_HR(W("Error: wcsrchr returned NULL; GetModuleFileName must have given us something bad\n"), E_UNEXPECTED); @@ -988,3 +989,31 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv) return 0; } + +#ifdef PLATFORM_UNIX +int main(int argc, char *argv[]) +{ + if (0 != PAL_Initialize(argc, argv)) + { + return FAILURE_RESULT; + } + + wchar_t **wargv = new wchar_t*[argc]; + for (int i = 0; i < argc; i++) + { + size_t len = strlen(argv[i]) + 1; + wargv[i] = new wchar_t[len]; + WszMultiByteToWideChar(CP_ACP, 0, argv[i], -1, wargv[i], len); + } + + int ret = wmain(argc, wargv); + + for (int i = 0; i < argc; i++) + { + delete[] wargv[i]; + } + delete[] wargv; + + return ret; +} +#endif // PLATFORM_UNIX diff --git a/src/tools/util/consoleargs.cpp b/src/tools/util/consoleargs.cpp index ad316e7a55..5bf88a5a59 100644 --- a/src/tools/util/consoleargs.cpp +++ b/src/tools/util/consoleargs.cpp @@ -3,6 +3,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // +#include #include "consoleargs.h" #include @@ -45,6 +46,7 @@ inline int HexValue (WCHAR c) return (c >= '0' && c <= '9') ? c - '0' : (c & 0xdf) - 'A' + 10; } +#ifndef PLATFORM_UNIX // Get canonical file path from a user specified path. wszSrcfileName can include relative paths, etc. // Much of this function was taken from csc.exe. DWORD GetCanonFilePath(_In_z_ LPCWSTR wszSrcFileName, _Out_z_cap_(cchDestFileName) LPWSTR wszDestFileName, _In_ DWORD cchDestFileName, _In_ bool fPreserveSrcCasing) @@ -103,12 +105,12 @@ DWORD GetCanonFilePath(_In_z_ LPCWSTR wszSrcFileName, _Out_z_cap_(cchDestFileNam // devices beginning with "\\.\" // or wildcards // or characters 0-31 - if (wcschr( full_path + (hasDrive ? 2 : 0), L':') != NULL || - wcsncmp( full_path, L"\\\\?\\", 4) == 0 || - wcsncmp( full_path, L"\\\\.\\", 4) == 0 || - wcspbrk(full_path, L"?*\x1\x2\x3\x4\x5\x6\x7\x8\x9" - L"\xA\xB\xC\xD\xE\xF\x10\x11\x12\x13\x14\x15" - L"\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\0") != NULL) { + if (wcschr( full_path + (hasDrive ? 2 : 0), W(':')) != NULL || + wcsncmp( full_path, W("\\\\?\\"), 4) == 0 || + wcsncmp( full_path, W("\\\\.\\"), 4) == 0 || + wcspbrk(full_path, W("?*\x1\x2\x3\x4\x5\x6\x7\x8\x9") + W("\xA\xB\xC\xD\xE\xF\x10\x11\x12\x13\x14\x15") + W("\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\0")) != NULL) { SetLastError(ERROR_INVALID_NAME); goto FAIL; } @@ -299,6 +301,7 @@ FAIL: } return 0; } +#endif // !PLATFORM_UNIX bool FreeString(LPCWSTR szText) { @@ -334,19 +337,26 @@ void ConsoleArgs::CleanUpArgs() } } -bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __deref_out_ecount(cbFilenameBuffer) LPWSTR filenameBuffer, DWORD cbFilenameBuffer, bool fOutputFilename) +bool ConsoleArgs::GetFullFileName(LPCWSTR szSource, __deref_out_ecount(cchFilenameBuffer) LPWSTR filenameBuffer, DWORD cchFilenameBuffer, bool fOutputFilename) { - if (0 == GetCanonFilePath( szSource, filenameBuffer, cbFilenameBuffer, fOutputFilename)) +#ifdef PLATFORM_UNIX + WCHAR tempBuffer[MAX_PATH]; + memset(filenameBuffer, 0, cchFilenameBuffer * sizeof(WCHAR)); + if (!PathCanonicalizeW(tempBuffer, szSource) || + StringCchCopyW(filenameBuffer, cchFilenameBuffer, tempBuffer) != S_OK) +#else + if (0 == GetCanonFilePath( szSource, filenameBuffer, cchFilenameBuffer, fOutputFilename)) +#endif { if (filenameBuffer[0] == L'\0') { // This could easily fail because of an overflow, but that's OK // we only want what will fit in the output buffer so we can print // a good error message - StringCchCopyW(filenameBuffer, cbFilenameBuffer - 4, szSource); + StringCchCopyW(filenameBuffer, cchFilenameBuffer - 4, szSource); // Don't cat on the ..., only stick it in the last 4 characters // to indicate truncation (if the string is short than this it just won't print) - StringCchCopyW(filenameBuffer + cbFilenameBuffer - 4, 4, L"..."); + StringCchCopyW(filenameBuffer + cchFilenameBuffer - 4, 4, W("...")); } return false; } @@ -374,7 +384,7 @@ void ConsoleArgs::SetErrorMessage(__deref_in LPCWSTR pwzMessage) return; } - wcscpy_s(m_lastErrorMessage, wcslen(pwzMessage) + 1, pwzMessage); + wcscpy_s((LPWSTR)m_lastErrorMessage, wcslen(pwzMessage) + 1, pwzMessage); } // @@ -633,7 +643,7 @@ LEADINGWHITE: if (chIllegal != 0) { - SetErrorMessage(L"Illegal option character."); + SetErrorMessage(W("Illegal option character.")); break; } @@ -641,13 +651,13 @@ LEADINGWHITE: WCHAR * szArgCopy = new WCHAR[cchLen]; if (!szArgCopy || FAILED(StringCchCopyW(szArgCopy, cchLen, pFirst))) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); break; } WStrList * listArgNew = new WStrList( szArgCopy, (*argLast)); if (!listArgNew) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); break; } @@ -678,7 +688,7 @@ bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) con LPWSTR copyArg = new WCHAR[wcslen(argv[0]) + 1]; if (!copyArg) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); return false; } wcscpy_s(copyArg, wcslen(argv[0]) + 1, argv[0]); @@ -686,7 +696,7 @@ bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) con WStrList * listArgNew = new WStrList(copyArg, (*argLast)); if (!listArgNew) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); return false; } @@ -713,7 +723,7 @@ bool ConsoleArgs::ExpandResponseFiles(__in int argc, __deref_in_ecount(argc) con m_rgArgs = new LPWSTR[newArgc]; if (!m_rgArgs) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); return false; } int i = 0; @@ -745,21 +755,23 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText HANDLE hFile = CreateFile(pwzFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile == INVALID_HANDLE_VALUE) { - SetErrorMessage(L"Cannot open response file."); + SetErrorMessage(W("Cannot open response file.")); goto ErrExit; } + + { DWORD size = GetFileSize(hFile, NULL); bufA = new char[size]; if (!bufA) { - SetErrorMessage(L"Out of memory"); + SetErrorMessage(W("Out of memory")); goto ErrExit; } DWORD numRead = 0; if (!ReadFile(hFile, bufA, size, &numRead, NULL) || numRead != size) { - SetErrorMessage(L"Failure reading response file."); + SetErrorMessage(W("Failure reading response file.")); goto ErrExit; } @@ -790,13 +802,13 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText } else if (byte0 == 0xFE && byte1 == 0xFF) { - SetErrorMessage(L"Invalid response file format. Use little endian encoding with Unicode"); + SetErrorMessage(W("Invalid response file format. Use little endian encoding with Unicode")); goto ErrExit; } - else if (byte0 == 0xFF && byte1 == 0xFE && byte2 == 0x00 && byte3 == 0x00 || - byte0 == 0x00 && byte1 == 0x00 && byte2 == 0xFE && byte3 == 0xFF) + else if ((byte0 == 0xFF && byte1 == 0xFE && byte2 == 0x00 && byte3 == 0x00) || + (byte0 == 0x00 && byte1 == 0x00 && byte2 == 0xFE && byte3 == 0xFF)) { - SetErrorMessage(L"Invalid response file format. Use ANSI, UTF-8, or UTF-16"); + SetErrorMessage(W("Invalid response file format. Use ANSI, UTF-8, or UTF-16")); goto ErrExit; } @@ -810,7 +822,7 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText // Sanity check - requiredSize better be an even number since we're dealing with UTF-16 if (requiredSize % 2 != 0) { - SetErrorMessage(L"Response file corrupt. Expected UTF-16 encoding but we had an odd number of bytes"); + SetErrorMessage(W("Response file corrupt. Expected UTF-16 encoding but we had an odd number of bytes")); goto ErrExit; } @@ -819,7 +831,7 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText bufW = new WCHAR[requiredSize]; if (!bufW) { - SetErrorMessage(L"Out of memory"); + SetErrorMessage(W("Out of memory")); goto ErrExit; } @@ -835,13 +847,13 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText bufW = new WCHAR[requiredSize + 1]; if (!bufW) { - SetErrorMessage(L"Out of memory"); + SetErrorMessage(W("Out of memory")); goto ErrExit; } if (!MultiByteToWideChar(CP_UTF8, 0, postByteOrderMarks, size, bufW, requiredSize)) { - SetErrorMessage(L"Failure reading response file."); + SetErrorMessage(W("Failure reading response file.")); goto ErrExit; } @@ -851,6 +863,7 @@ bool ConsoleArgs::ReadTextFile(LPCWSTR pwzFilename, __deref_out LPWSTR *ppwzText *ppwzTextBuffer = bufW; success = true; + } ErrExit: if (bufA) @@ -883,7 +896,7 @@ void ConsoleArgs::ProcessResponseArgs() if (wcslen(szArg) == 1) { - SetErrorMessage(L"No response file specified"); + SetErrorMessage(W("No response file specified")); goto CONTINUE; } @@ -895,22 +908,27 @@ void ConsoleArgs::ProcessResponseArgs() hr = TreeAdd(&response_files, szFilename); if (hr == E_OUTOFMEMORY) { - SetErrorMessage(L"Out of memory."); + SetErrorMessage(W("Out of memory.")); goto CONTINUE; } else if (hr == S_FALSE) { - SetErrorMessage(L"Duplicate response file."); + SetErrorMessage(W("Duplicate response file.")); goto CONTINUE; } - LPWSTR pwzFileBuffer = nullptr; + { + LPWSTR pwzFileBuffer; + pwzFileBuffer = nullptr; if (!ReadTextFile(szFilename, &pwzFileBuffer)) { goto CONTINUE; } LPWSTR szActualText = nullptr; +#ifdef PLATFORM_UNIX + szActualText = pwzFileBuffer; +#else DWORD dwNumChars = ExpandEnvironmentStrings(pwzFileBuffer, NULL, 0); LPWSTR szExpandedBuffer = new WCHAR[dwNumChars]; if (szExpandedBuffer != nullptr) @@ -927,8 +945,10 @@ void ConsoleArgs::ProcessResponseArgs() } } +#endif TextToArgs(szActualText, &listCurArg->next); + } CONTINUE: // remove the response file argument, and continue to the next. listCurArg->arg = NULL; diff --git a/src/tools/util/consoleargs.h b/src/tools/util/consoleargs.h index 869cee3629..e9bc93bcdc 100644 --- a/src/tools/util/consoleargs.h +++ b/src/tools/util/consoleargs.h @@ -10,10 +10,12 @@ #include "tree.h" #include +#include "palclr.h" + typedef tree b_tree; typedef list WStrList; -const LPWSTR kOutOfMemory = L"Out of memory"; +const LPCWSTR kOutOfMemory = W("Out of memory"); class ConsoleArgs { @@ -40,7 +42,7 @@ public: // Frees all memory used by the arg list and the argv/argc array void CleanUpArgs(); - LPWSTR ErrorMessage() + LPCWSTR ErrorMessage() { if (m_errorOccured) { @@ -65,7 +67,7 @@ private: WStrList * m_listArgs; bool m_errorOccured; - LPWSTR m_lastErrorMessage; + LPCWSTR m_lastErrorMessage; }; #endif // __CONSOLEARGS_H__ diff --git a/src/utilcode/CMakeLists.txt b/src/utilcode/CMakeLists.txt index d8ea9f10cd..0db79c18ca 100644 --- a/src/utilcode/CMakeLists.txt +++ b/src/utilcode/CMakeLists.txt @@ -95,7 +95,5 @@ endif(CLR_CMAKE_PLATFORM_UNIX) add_subdirectory(dac) add_subdirectory(dyncrt) add_subdirectory(staticnohost) -if(WIN32) - add_subdirectory(crossgen) -endif(WIN32) +add_subdirectory(crossgen) diff --git a/src/vm/ceeload.cpp b/src/vm/ceeload.cpp index 4b8cc4276f..f5bf61c270 100644 --- a/src/vm/ceeload.cpp +++ b/src/vm/ceeload.cpp @@ -11023,7 +11023,7 @@ void Module::Fixup(DataImage *image) STANDARD_VM_CONTRACT; // Propagate all changes to the image copy - memcpy(image->GetImagePointer(this), this, sizeof(Module)); + memcpy(image->GetImagePointer(this), (void*)this, sizeof(Module)); // // Zero out VTable @@ -11072,7 +11072,7 @@ void Module::Fixup(DataImage *image) // Clear active dependencies - they will be refilled at load time image->ZeroField(this, offsetof(Module, m_activeDependencies), sizeof(m_activeDependencies)); new (image->GetImagePointer(this, offsetof(Module, m_unconditionalDependencies))) SynchronizedBitMask(); - image->ZeroField(this, offsetof(Module, m_unconditionalDependencies) + offsetof(SynchronizedBitMask, SynchronizedBitMask::m_bitMaskLock) + offsetof(SimpleRWLock,SimpleRWLock::m_spinCount), sizeof(m_unconditionalDependencies.m_bitMaskLock.m_spinCount)); + image->ZeroField(this, offsetof(Module, m_unconditionalDependencies) + offsetof(SynchronizedBitMask, m_bitMaskLock) + offsetof(SimpleRWLock,m_spinCount), sizeof(m_unconditionalDependencies.m_bitMaskLock.m_spinCount)); image->ZeroField(this, offsetof(Module, m_dwNumberOfActivations), sizeof(m_dwNumberOfActivations)); image->ZeroField(this, offsetof(Module, m_LookupTableCrst), sizeof(m_LookupTableCrst)); diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp index 833d5ec06b..ecac60aa0e 100644 --- a/src/vm/ceemain.cpp +++ b/src/vm/ceemain.cpp @@ -1417,7 +1417,7 @@ HRESULT EEStartup(COINITIEE fFlags) _ASSERTE(!g_fEEStarted && !g_fEEInit && SUCCEEDED (g_EEStartupStatus)); -#ifdef FEATURE_PAL +#if defined(FEATURE_PAL) && !defined(CROSSGEN_COMPILE) DacGlobals::Initialize(); #endif diff --git a/src/vm/coreclr/corebindresult.inl b/src/vm/coreclr/corebindresult.inl index 9b6cc469de..fdfdf770e0 100644 --- a/src/vm/coreclr/corebindresult.inl +++ b/src/vm/coreclr/corebindresult.inl @@ -48,7 +48,7 @@ inline BOOL CoreBindResult::IsMscorlib() #ifndef CROSSGEN_COMPILE return pAssembly->GetAssemblyName()->IsMscorlib(); #else - return (pAssembly->GetPath()).EndsWithCaseInsensitive(SString(L"mscorlib.dll"), PEImage::GetFileSystemLocale()); + return (pAssembly->GetPath()).EndsWithCaseInsensitive(SString(W("mscorlib.dll")), PEImage::GetFileSystemLocale()); #endif } diff --git a/src/vm/crossgen/CMakeLists.txt b/src/vm/crossgen/CMakeLists.txt index 2bf63c424a..5f0b230f65 100644 --- a/src/vm/crossgen/CMakeLists.txt +++ b/src/vm/crossgen/CMakeLists.txt @@ -2,89 +2,87 @@ include(${CLR_DIR}/crossgen.cmake) set(VM_CROSSGEN_SOURCES ../class.cpp - ../AppDomain.cpp + ../appdomain.cpp ../array.cpp - ../Assembly.cpp - ../AssemblySpec.cpp + ../assembly.cpp + ../assemblyspec.cpp ../binder.cpp ../ceeload.cpp ../ceemain.cpp ../classhash.cpp ../clrex.cpp - ../CLRPrivBinderUtil.cpp - ../CLRPrivBinderWinRT.cpp - ../CLRPrivTypeCacheWinRT.cpp + ../clrprivbinderutil.cpp ../clsload.cpp ../comdelegate.cpp ../codeman.cpp ../compile.cpp - ../ConstrainedExecutionRegion.cpp - ../CustomMarshalerInfo.cpp - ../Domainfile.cpp - ../BaseAssemblySpec.cpp + ../constrainedexecutionregion.cpp + ../custommarshalerinfo.cpp + ../domainfile.cpp + ../baseassemblyspec.cpp ../corebindresult.cpp ../coreassemblyspec.cpp ../crossdomaincalls.cpp ../dataimage.cpp - ../decodeMD.cpp - ../DebugInfoStore.cpp + ../decodemd.cpp + ../debuginfostore.cpp ../ecall.cpp ../eeconfig.cpp ../eehash.cpp ../eetwain.cpp ../excep.cpp - ../Field.cpp - ../Fieldmarshaler.cpp + ../field.cpp + ../fieldmarshaler.cpp ../formattype.cpp - ../TypeEquivalenceHash.cpp - ../GCDecode.cpp + ../typeequivalencehash.cpp + ../gcdecode.cpp ../genericdict.cpp ../generics.cpp ../genmeth.cpp ../hash.cpp - ../ILMarshalers.cpp - ../ILStubCache.cpp - ../ILStubResolver.cpp + ../ilmarshalers.cpp + ../ilstubcache.cpp + ../ilstubresolver.cpp ../instmethhash.cpp ../interoputil.cpp ../invokeutil.cpp ../inlinetracking.cpp - ../contractImpl.cpp - ../JITInterface.cpp - ../LoaderAllocator.cpp - ../ListLock.cpp + ../contractimpl.cpp + ../jitinterface.cpp + ../loaderallocator.cpp + ../listlock.cpp ../memberload.cpp - ../Method.cpp - ../MethodImpl.cpp - ../MethodTable.cpp + ../method.cpp + ../methodimpl.cpp + ../methodtable.cpp ../methodtablebuilder.cpp ../mscorlib.cpp ../stubcache.cpp ../mlinfo.cpp - ../DllImport.cpp - ../DllImportCallback.cpp - ../PEFile.cpp - ../PEFingerprint.cpp - ../PEImage.cpp - ../PEImageLayout.cpp + ../dllimport.cpp + ../dllimportcallback.cpp + ../pefile.cpp + ../pefingerprint.cpp + ../peimage.cpp + ../peimagelayout.cpp ../pendingload.cpp - ../Precode.cpp + ../precode.cpp ../olevariant.cpp ../security.cpp ../securitypolicy.cpp - ../securityAttributes.cpp - ../SecurityDeclarative.cpp - ../SecurityDeclarativeCache.cpp - ../SecurityDescriptor.cpp - ../SecurityDescriptorAppdomain.cpp - ../SecurityDescriptorAssembly.cpp + ../securityattributes.cpp + ../securitydeclarative.cpp + ../securitydeclarativecache.cpp + ../securitydescriptor.cpp + ../securitydescriptorappdomain.cpp + ../securitydescriptorassembly.cpp ../securitymeta.cpp - ../SecurityTransparentAssembly.cpp + ../securitytransparentassembly.cpp ../siginfo.cpp - ../SigFormat.cpp - ../SimpleRWLock.cpp + ../sigformat.cpp + ../simplerwlock.cpp ../spinlock.cpp - ../StackingAllocator.cpp + ../stackingallocator.cpp ../stubgen.cpp ../stublink.cpp ../typectxt.cpp @@ -96,19 +94,11 @@ set(VM_CROSSGEN_SOURCES ../util.cpp ../vars.cpp ../zapsig.cpp - ../classcompat.cpp - ../COMtoCLRCall.cpp - ../CLRtoCOMCall.cpp - ../RuntimeCallableWrapper.cpp - ../WinRTHelpers.cpp - ../WinRTTypeNameConverter.cpp - ../DbgGcInfoDecoder.cpp - ../GcInfoDecoder.cpp - ../SHA1.cpp - ../amd64/StubLinkerAMD64.cpp + ../dbggcinfodecoder.cpp + ../gcinfodecoder.cpp + ../sha1.cpp + ../amd64/stublinkeramd64.cpp ../crossgencompile.cpp - ../CrossgenRoParseTypeName.cpp - ../CrossgenRoResolveNamespace.cpp ) include_directories(BEFORE ..) @@ -116,6 +106,19 @@ include_directories(${CLR_DIR}/src/gc) include_directories(../amd64) if (WIN32) + list(APPEND VM_CROSSGEN_SOURCES + ../classcompat.cpp + ../clrprivbinderwinrt.cpp + ../clrprivtypecachewinrt.cpp + ../comtoclrcall.cpp + ../clrtocomcall.cpp + ../crossgenroparsetypename.cpp + ../crossgenroresolvenamespace.cpp + ../runtimecallablewrapper.cpp + ../winrthelpers.cpp + ../winrttypenameconverter.cpp + ) + add_precompiled_header(common.h ../common.cpp VM_CROSSGEN_SOURCES) # mscorlib.cpp does not compile with precompiled header file set_source_files_properties(../mscorlib.cpp PROPERTIES COMPILE_FLAGS "/Y-") diff --git a/src/vm/crossgencompile.cpp b/src/vm/crossgencompile.cpp index 99a43f197d..a14c166bf8 100644 --- a/src/vm/crossgencompile.cpp +++ b/src/vm/crossgencompile.cpp @@ -30,7 +30,7 @@ // Pull in some implementation files from other places in the tree // -#include "..\..\dlls\mscoree\mscoree.cpp" +#include "../../dlls/mscoree/mscoree.cpp" //--------------------------------------------------------------------------------------- // @@ -39,7 +39,7 @@ #undef ExitProcess -void CrossGenNotSupported(char * message) +void CrossGenNotSupported(const char * message) { _ASSERTE(!"CrossGenNotSupported"); fprintf(stderr, "Fatal error: %s\n", message); diff --git a/src/vm/frames.h b/src/vm/frames.h index 770d83fdb0..58702aa480 100644 --- a/src/vm/frames.h +++ b/src/vm/frames.h @@ -418,9 +418,9 @@ class Frame : public FrameBase public: -#if defined(FEATURE_PAL) && !defined(DACCESS_COMPILE) +#if defined(FEATURE_PAL) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) virtual ~Frame(); -#endif // FEATURE_PAL && !DACCESS_COMPILE +#endif // FEATURE_PAL && !DACCESS_COMPILE && !CROSSGEN_COMPILE //------------------------------------------------------------------------ // Special characteristics of a frame diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 8af3fd9057..335a9db056 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -93,7 +93,7 @@ #if defined(CROSSGEN_COMPILE) -static const PCHAR hlpNameTable[CORINFO_HELP_COUNT] = { +static const char *const hlpNameTable[CORINFO_HELP_COUNT] = { #define JITHELPER(code, pfnHelper, sig) #code, #include "jithelpers.h" }; diff --git a/src/vm/loaderallocator.cpp b/src/vm/loaderallocator.cpp index fad814292f..545d94fa51 100644 --- a/src/vm/loaderallocator.cpp +++ b/src/vm/loaderallocator.cpp @@ -1444,14 +1444,12 @@ BOOL AppDomainLoaderAllocator::CanUnload() return m_Id.GetAppDomain()->CanUnload(); } -#ifndef CROSSGEN_COMPILE BOOL AssemblyLoaderAllocator::CanUnload() { LIMITED_METHOD_CONTRACT; return TRUE; } -#endif // CROSSGEN_COMPILE BOOL LoaderAllocator::IsDomainNeutral() { diff --git a/src/vm/loaderallocator.hpp b/src/vm/loaderallocator.hpp index 046ea9fb32..a9166ea9f2 100644 --- a/src/vm/loaderallocator.hpp +++ b/src/vm/loaderallocator.hpp @@ -491,10 +491,10 @@ public: virtual BOOL CanUnload(); void SetDomainAssembly(DomainAssembly *pDomainAssembly) { WRAPPER_NO_CONTRACT; m_Id.SetDomainAssembly(pDomainAssembly); } -#ifndef DACCESS_COMPILE +#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) virtual void RegisterHandleForCleanup(OBJECTHANDLE objHandle); virtual void CleanupHandles(); -#endif // !defined(DACCESS_COMPILE) +#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) private: struct HandleCleanupListItem diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp index 4b20970bb3..815071c486 100644 --- a/src/vm/pefile.cpp +++ b/src/vm/pefile.cpp @@ -4314,7 +4314,7 @@ void PEAssembly::VerifyStrongName() #endif // !defined(FEATURE_CORECLR) else { -#if defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE) +#if defined(FEATURE_CORECLR) && (!defined(CROSSGEN_COMPILE) || defined(PLATFORM_UNIX)) // Runtime policy on CoreCLR is to skip verification of ALL assemblies m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS; m_fStrongNameVerified = TRUE; @@ -4367,7 +4367,7 @@ void PEAssembly::VerifyStrongName() #endif } -#endif // FEATURE_CORECLR && !CROSSGEN_COMPILE +#endif // FEATURE_CORECLR && (!CROSSGEN_COMPILE || PLATFORM_UNIX) } m_fStrongNameVerified = TRUE; diff --git a/src/vm/peimage.inl b/src/vm/peimage.inl index 3014c96a1c..ed9750d13d 100644 --- a/src/vm/peimage.inl +++ b/src/vm/peimage.inl @@ -406,7 +406,7 @@ inline const BOOL PEImage::HasStrongNameSignature() #ifndef DACCESS_COMPILE -#if !defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE) +#if !defined(FEATURE_CORECLR) || (defined(CROSSGEN_COMPILE) && !defined(PLATFORM_UNIX)) inline const HRESULT PEImage::VerifyStrongName(DWORD* verifyOutputFlags) { WRAPPER_NO_CONTRACT; @@ -446,7 +446,7 @@ inline const HRESULT PEImage::VerifyStrongName(DWORD* verifyOutputFlags) } return hr; } -#endif // !FEATURE_CORECLR || CROSSGEN_COMPILE +#endif // !FEATURE_CORECLR || (CROSSGEN_COMPILE && !PLATFORM_UNIX) #endif // !DACCESS_COMPILE diff --git a/src/vm/threads.h b/src/vm/threads.h index 7864ad98e5..b77c33bdda 100644 --- a/src/vm/threads.h +++ b/src/vm/threads.h @@ -236,6 +236,7 @@ public: } PTR_Frame GetFrame() { return NULL; } + void SetFrame(Frame *pFrame) { } DWORD CatchAtSafePoint() { return 0; } DWORD CatchAtSafePointOpportunistic() { return 0; } diff --git a/src/zap/nativeformatwriter.cpp b/src/zap/nativeformatwriter.cpp index 1a5cf869f3..5462659eae 100644 --- a/src/zap/nativeformatwriter.cpp +++ b/src/zap/nativeformatwriter.cpp @@ -11,7 +11,7 @@ #include "common.h" -#include "NativeFormatWriter.h" +#include "nativeformatwriter.h" namespace NativeFormat { diff --git a/src/zap/zapheaders.cpp b/src/zap/zapheaders.cpp index 1d201184a2..7df102abf4 100644 --- a/src/zap/zapheaders.cpp +++ b/src/zap/zapheaders.cpp @@ -222,6 +222,7 @@ void ZapVersionResource::Save(ZapWriter * pZapWriter) void ZapImage::CopyWin32VersionResource() { +#ifndef FEATURE_PAL // Copy the version resource over so it is easy to see in the dumps where the ngened module came from COUNT_T cbResourceData; PVOID pResourceData = m_ModuleDecoder.GetWin32Resource(MAKEINTRESOURCE(1), RT_VERSION, &cbResourceData); @@ -237,6 +238,7 @@ void ZapImage::CopyWin32VersionResource() m_pWin32ResourceSection->Place(pVersionData); SetDirectoryEntry(IMAGE_DIRECTORY_ENTRY_RESOURCE, m_pWin32ResourceSection); +#endif } #undef MAKEINTRESOURCE diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp index 67bad6d1ee..3d673bf2bc 100644 --- a/src/zap/zapimage.cpp +++ b/src/zap/zapimage.cpp @@ -1863,6 +1863,9 @@ void ZapImage::OutputTables() // 512 byte alignment, since there is no plan to compress data partitions. SetFileAlignment(0x1000); } +#elif defined(FEATURE_PAL) + // PAL library requires native image sections to align to page bounaries. + SetFileAlignment(0x1000); #endif } @@ -4097,7 +4100,7 @@ HRESULT ZapImage::LocateProfileData() return S_FALSE; } -#if !defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE) +#if !defined(FEATURE_PAL) // // See if there's profile data in the resource section of the PE // diff --git a/src/zap/zapimport.cpp b/src/zap/zapimport.cpp index 4867fc687e..22675d8181 100644 --- a/src/zap/zapimport.cpp +++ b/src/zap/zapimport.cpp @@ -341,7 +341,7 @@ ZapGenericSignature * ZapImportTable::GetGenericSignature(PVOID signature, BOOL void * pMemory = new (m_pImage->GetHeap()) BYTE[cbAllocSize.Value()]; pGenericSignature = new (pMemory) ZapGenericSignature(cbSig); - memcpy(pGenericSignature + 1, pSig, cbSig); + memcpy((void *)(pGenericSignature + 1), pSig, cbSig); m_genericSignatures.Add(pGenericSignature); @@ -421,7 +421,7 @@ void ZapImportSectionsTable::Save(ZapWriter * pZapWriter) ZapImportSectionSignatures::ZapImportSectionSignatures(ZapImage * pImage, ZapVirtualSection * pImportSection, ZapVirtualSection * pGCSection) - : m_pImage(pImage), m_pImportSection(pImportSection) + : m_pImportSection(pImportSection), m_pImage(pImage) { if (pGCSection != NULL) { diff --git a/src/zap/zapinfo.cpp b/src/zap/zapinfo.cpp index 6b030288ed..ca2a67b036 100644 --- a/src/zap/zapinfo.cpp +++ b/src/zap/zapinfo.cpp @@ -29,7 +29,9 @@ class MethodDesc; class MethodTable; #include "CompactLayoutWriter.h" #endif +#ifdef MDIL #include "TritonStress.h" +#endif ZapInfo::ZapInfo(ZapImage * pImage, mdMethodDef md, CORINFO_METHOD_HANDLE handle, CORINFO_MODULE_HANDLE module, unsigned methodProfilingDataFlags) : m_pImage(pImage), diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp index 56835cac94..1985f83062 100644 --- a/src/zap/zapper.cpp +++ b/src/zap/zapper.cpp @@ -24,7 +24,9 @@ #endif #include "clr/fs/dir.h" +#ifdef FEATURE_FUSION #include "ngenparser.inl" +#endif /* --------------------------------------------------------------------------- * * Error Macros @@ -940,8 +942,8 @@ void Zapper::InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument) { // Allow a second jit to be loaded into the system. // - LPWSTR altName; - hr = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AltJitName, &altName); + LPCWSTR altName; + hr = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_AltJitName, (LPWSTR*)&altName); if (FAILED(hr)) { Error(W("Unable to load alternative Jit Compiler\r\n")); @@ -3504,6 +3506,7 @@ void Zapper::DefineOutputAssembly(SString& strAssemblyName, ULONG * pHashAlgId) ThrowHR(HRESULT_FROM_WIN32(ERROR_INVALID_NAME)); } +#ifndef PLATFORM_UNIX // // We always need a hash since our assembly module is separate from the manifest. // Use MD5 by default. @@ -3511,6 +3514,7 @@ void Zapper::DefineOutputAssembly(SString& strAssemblyName, ULONG * pHashAlgId) if (hashAlgId == 0) hashAlgId = CALG_MD5; +#endif mdAssembly tkEmitAssembly; IfFailThrow(m_pAssemblyEmit->DefineAssembly(pbPublicKey, cbPublicKey, hashAlgId, diff --git a/src/zap/zaprelocs.cpp b/src/zap/zaprelocs.cpp index bea40c3864..2d6859ed0c 100644 --- a/src/zap/zaprelocs.cpp +++ b/src/zap/zaprelocs.cpp @@ -352,7 +352,7 @@ ZapBlobWithRelocs * ZapBlobWithRelocs::NewBlob(ZapWriter * pWriter, PVOID pData, ZapBlobWithRelocs * pZapBlobWithRelocs = new (pMemory) ZapBlobWithRelocs(cbSize); if (pData != NULL) - memcpy(pZapBlobWithRelocs + 1, pData, cbSize); + memcpy((void*)(pZapBlobWithRelocs + 1), pData, cbSize); return pZapBlobWithRelocs; } @@ -383,7 +383,7 @@ public: ZapAlignedBlobWithRelocsConst * pZapBlob = new (pMemory) ZapAlignedBlobWithRelocsConst(cbSize); if (pData != NULL) - memcpy(pZapBlob + 1, pData, cbSize); + memcpy((void*)(pZapBlob + 1), pData, cbSize); return pZapBlob; } diff --git a/src/zap/zapwriter.cpp b/src/zap/zapwriter.cpp index 6ad554eb0a..09eb8bbc9c 100644 --- a/src/zap/zapwriter.cpp +++ b/src/zap/zapwriter.cpp @@ -628,7 +628,7 @@ ZapBlob * ZapBlob::NewBlob(ZapWriter * pWriter, PVOID pData, SIZE_T cbSize) ZapBlob * pZapBlob = new (pMemory) ZapBlob(cbSize); if (pData != NULL) - memcpy(pZapBlob + 1, pData, cbSize); + memcpy((void*)(pZapBlob + 1), pData, cbSize); return pZapBlob; } @@ -659,7 +659,7 @@ public: ZapAlignedBlobConst * pZapBlob = new (pMemory) ZapAlignedBlobConst(cbSize); if (pData != NULL) - memcpy(pZapBlob + 1, pData, cbSize); + memcpy((void *)(pZapBlob + 1), pData, cbSize); return pZapBlob; } -- cgit v1.2.3