@@ -34,7 +34,7 @@ enum ReturnValues
3434#define NumItems (s ) (sizeof (s) / sizeof (s[0 ]))
3535
3636STDAPI CreatePDBWorker (LPCWSTR pwzAssemblyPath, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzAppNiPaths, LPCWSTR pwzPdbPath, BOOL fGeneratePDBLinesInfo , LPCWSTR pwzManagedPdbSearchPath, LPCWSTR pwzPlatformWinmdPaths, LPCWSTR pwzDiasymreaderPath);
37- STDAPI NGenWorker (LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL , LPCWSTR pwzPlatformWinmdPaths=NULL , ICorSvcLogger *pLogger = NULL , LPCWSTR pwszCLRJITPath = nullptr );
37+ STDAPI NGenWorker (LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembliesPaths, LPCWSTR pwzTrustedPlatformAssemblies, LPCWSTR pwzPlatformResourceRoots, LPCWSTR pwzAppPaths, LPCWSTR pwzOutputFilename=NULL , SIZE_T customBaseAddress= 0 , LPCWSTR pwzPlatformWinmdPaths=NULL , ICorSvcLogger *pLogger = NULL , LPCWSTR pwszCLRJITPath = nullptr );
3838void SetSvcLogger (ICorSvcLogger *pCorSvcLogger);
3939void SetMscorlibPath (LPCWSTR wzSystemDirectory);
4040
@@ -155,6 +155,9 @@ void PrintUsageHelper()
155155 W (" input assemblies\n " )
156156
157157#endif
158+ #ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION
159+ W (" /BaseAddress <value> - Specifies base address to use for compilation.\n " )
160+ #endif
158161#ifdef FEATURE_WINMD_RESILIENT
159162 W (" WinMD Parameters\n " )
160163 W (" /WinMDResilient - Generate images resilient to WinMD dependency changes.\n " )
@@ -436,6 +439,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
436439 LPCWSTR pwzOutputFilename = NULL ;
437440 LPCWSTR pwzPublicKeys = nullptr ;
438441 bool fLargeVersionBubbleSwitch = false ;
442+ SIZE_T baseAddress = 0 ;
439443
440444#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
441445 LPCWSTR pwszCLRJITPath = nullptr ;
@@ -543,6 +547,19 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
543547 dwFlags |= NGENWORKER_FLAGS_LARGEVERSIONBUBBLE;
544548 fLargeVersionBubbleSwitch = true ;
545549 }
550+ #endif
551+ #ifdef FEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION
552+ else if (MatchParameter (*argv, W (" BaseAddress" )))
553+ {
554+ if (baseAddress != 0 )
555+ {
556+ OutputErr (W (" Cannot specify multiple base addresses.\n " ));
557+ exit (INVALID_ARGUMENTS);
558+ }
559+ baseAddress = (SIZE_T) _wcstoui64 (argv[1 ], NULL , 0 );
560+ argv++;
561+ argc--;
562+ }
546563#endif
547564 else if (MatchParameter (*argv, W (" NoMetaData" )))
548565 {
@@ -942,6 +959,7 @@ int _cdecl wmain(int argc, __in_ecount(argc) WCHAR **argv)
942959 pwzPlatformResourceRoots,
943960 pwzAppPaths,
944961 pwzOutputFilename,
962+ baseAddress,
945963 pwzPlatformWinmdPaths
946964#if !defined(FEATURE_MERGE_JIT_AND_ENGINE)
947965 ,
0 commit comments