summaryrefslogtreecommitdiff
path: root/src/zap
diff options
context:
space:
mode:
authorGleb Balykov <g.balykov@samsung.com>2019-06-21 03:55:10 +0300
committerJan Kotas <jkotas@microsoft.com>2019-06-20 17:55:09 -0700
commit86e600cef40a650a8ffb294dd195186b1679609b (patch)
tree307be15524980c95e50958f31b7080b6c28b0cd6 /src/zap
parent9bd2787a9dd2aa4d2b7d4f72afebc3dbe896e896 (diff)
downloadcoreclr-86e600cef40a650a8ffb294dd195186b1679609b.tar.gz
coreclr-86e600cef40a650a8ffb294dd195186b1679609b.tar.bz2
coreclr-86e600cef40a650a8ffb294dd195186b1679609b.zip
Add custom default base address option to crossgen (#25227)
* Add crossgen option to setup default base address for native image This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION. * Mmap native images at default base address if env variable COMPlus_UseDefaultBaseAddr=0x1 is setup. This is enabled only with -DFEATURE_ENABLE_NO_ADDRESS_SPACE_RANDOMIZATION.
Diffstat (limited to 'src/zap')
-rw-r--r--src/zap/zapimage.cpp6
-rw-r--r--src/zap/zapper.cpp17
2 files changed, 22 insertions, 1 deletions
diff --git a/src/zap/zapimage.cpp b/src/zap/zapimage.cpp
index c498719bf7..4a11405a73 100644
--- a/src/zap/zapimage.cpp
+++ b/src/zap/zapimage.cpp
@@ -1282,6 +1282,12 @@ void ZapImage::CalculateZapBaseAddress()
}
}
+ if (m_zapper->GetCustomBaseAddress() != 0)
+ {
+ //set baseAddress here from crossgen options
+ baseAddress = m_zapper->GetCustomBaseAddress();
+ }
+
// Round to a multiple of 64K
// 64K is the allocation granularity of VirtualAlloc. (Officially this number is not a constant -
// we should be querying the system for its allocation granularity, but we do this all over the place
diff --git a/src/zap/zapper.cpp b/src/zap/zapper.cpp
index e511b5726c..66346d7d08 100644
--- a/src/zap/zapper.cpp
+++ b/src/zap/zapper.cpp
@@ -33,7 +33,7 @@ static bool s_fNGenNoMetaData;
// Zapper Object instead of creating one on your own.
-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)
+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)
{
HRESULT hr = S_OK;
@@ -83,6 +83,8 @@ STDAPI NGenWorker(LPCWSTR pwzFilename, DWORD dwFlags, LPCWSTR pwzPlatformAssembl
if (pwzOutputFilename)
zap->SetOutputFilename(pwzOutputFilename);
+ zap->SetCustomBaseAddress(customBaseAddress);
+
if (pwzPlatformAssembliesPaths != nullptr)
zap->SetPlatformAssembliesPaths(pwzPlatformAssembliesPaths);
@@ -408,6 +410,8 @@ void Zapper::Init(ZapperOptions *pOptions, bool fFreeZapperOptions)
m_pAssemblyEmit = NULL;
m_fFreeZapperOptions = fFreeZapperOptions;
+ m_customBaseAddress = 0;
+
#ifdef LOGGING
InitializeLogging();
#endif
@@ -1688,3 +1692,14 @@ SString Zapper::GetOutputFileName()
{
return m_outputFilename;
}
+
+
+void Zapper::SetCustomBaseAddress(SIZE_T baseAddress)
+{
+ m_customBaseAddress = baseAddress;
+}
+
+SIZE_T Zapper::GetCustomBaseAddress()
+{
+ return m_customBaseAddress;
+} \ No newline at end of file