summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchunseok lee <chunseok.lee@samsung.com>2017-12-20 08:09:58 +0900
committerChunseok Lee <chunseok.lee@samsung.com>2017-12-29 07:35:14 +0000
commit7d3279000d351f58332a341510107a2f4e09cc2b (patch)
treee8845aa23082c1cbc41bb6471343c0b6200d9cf8
parent9b4ef4ad4bbbce70017e1bc10b333b3f7a44807c (diff)
downloadcoreclr-7d3279000d351f58332a341510107a2f4e09cc2b.tar.gz
coreclr-7d3279000d351f58332a341510107a2f4e09cc2b.tar.bz2
coreclr-7d3279000d351f58332a341510107a2f4e09cc2b.zip
Fix crossgen debug directory generation problems
cherrypick from 2ae797a1e975e42dd448e Change-Id: Ifb9ba07f27cdc3caa5dfbf633e68dffc596f57eb Signed-off-by: chunseok lee <chunseok.lee@samsung.com>
-rw-r--r--packaging/0001-Fix-crossgen-debug-directory-generation-problems.-12.patch75
-rw-r--r--packaging/coreclr.spec4
2 files changed, 78 insertions, 1 deletions
diff --git a/packaging/0001-Fix-crossgen-debug-directory-generation-problems.-12.patch b/packaging/0001-Fix-crossgen-debug-directory-generation-problems.-12.patch
new file mode 100644
index 0000000000..292a01a424
--- /dev/null
+++ b/packaging/0001-Fix-crossgen-debug-directory-generation-problems.-12.patch
@@ -0,0 +1,75 @@
+From 2ae797a1e975e42dd448e7a345c698c98cd18ca6 Mon Sep 17 00:00:00 2001
+From: Mike McLaughlin <mikem@microsoft.com>
+Date: Tue, 11 Jul 2017 09:58:49 -0700
+Subject: [PATCH] Fix crossgen debug directory generation problems. (#12715)
+
+* Fix crossgen debug directory generation problems.
+
+The first problem was that when the existing/incoming PDB debug
+directory entry was a portable PDB (MinorVersion == 0x504d), the
+ngen/native PDB added had the same MinorVersion indicating that
+it was a portable PDB (but it never can be).
+
+This was fixed by setting MinorVersion to 0 when creating the
+ngen PDB debug directory entry.
+
+The second problem was that the ngen PDB entry was being created
+even when crossgen was run on linux/mac, etc.
+
+The fix was to ifdef NO_NGENPDB the save ngen PDB entry code.
+---
+ src/zap/zapheaders.cpp | 6 ++++++
+ src/zap/zapheaders.h | 5 +++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/src/zap/zapheaders.cpp b/src/zap/zapheaders.cpp
+index 8960798..f3dab63 100644
+--- a/src/zap/zapheaders.cpp
++++ b/src/zap/zapheaders.cpp
+@@ -282,6 +282,7 @@ void ZapDebugDirectory::SaveOriginalDebugDirectoryEntry(ZapWriter *pZapWriter)
+
+ void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter)
+ {
++#if !defined(NO_NGENPDB)
+ _ASSERTE(pZapWriter);
+
+ IMAGE_DEBUG_DIRECTORY debugDirectory = {0};
+@@ -292,6 +293,10 @@ void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter)
+ debugDirectory.Type = IMAGE_DEBUG_TYPE_CODEVIEW;
+ debugDirectory.SizeOfData = m_pNGenPdbDebugData->GetSize();
+ debugDirectory.AddressOfRawData = m_pNGenPdbDebugData->GetRVA();
++ // Make sure the "is portable pdb" indicator (MinorVersion == 0x504d) is clear
++ // for the NGen debug directory entry since this debug directory is copied
++ // from an existing entry which could be a portable pdb.
++ debugDirectory.MinorVersion = 0;
+ {
+ ZapPhysicalSection *pPhysicalSection = ZapImage::GetImage(pZapWriter)->m_pTextSection;
+ DWORD dwOffset = m_pNGenPdbDebugData->GetRVA() - pPhysicalSection->GetRVA();
+@@ -299,6 +304,7 @@ void ZapDebugDirectory::SaveNGenDebugDirectoryEntry(ZapWriter *pZapWriter)
+ debugDirectory.PointerToRawData = pPhysicalSection->GetFilePos() + dwOffset;
+ }
+ pZapWriter->Write(&debugDirectory, sizeof(debugDirectory));
++#endif // NO_NGENPDB
+ }
+
+ void ZapDebugDirectory::Save(ZapWriter * pZapWriter)
+diff --git a/src/zap/zapheaders.h b/src/zap/zapheaders.h
+index 0755c0e..f966ced 100644
+--- a/src/zap/zapheaders.h
++++ b/src/zap/zapheaders.h
+@@ -249,7 +249,12 @@ public:
+
+ virtual DWORD GetSize()
+ {
++#if defined(NO_NGENPDB)
++ return sizeof(IMAGE_DEBUG_DIRECTORY) * m_nDebugDirectory;
++#else
++ // Add one for NGen PDB debug directory entry
+ return sizeof(IMAGE_DEBUG_DIRECTORY) * (m_nDebugDirectory + 1);
++#endif // NO_NGENPDB
+ }
+
+ virtual UINT GetAlignment()
+--
+2.7.4
+
diff --git a/packaging/coreclr.spec b/packaging/coreclr.spec
index 5ae7c2bfa2..6acedf5779 100644
--- a/packaging/coreclr.spec
+++ b/packaging/coreclr.spec
@@ -23,7 +23,7 @@ Source1000: downloaded_files.tar.gz
Source1001: %{name}.manifest
Source1002: libicu.tar.gz
Source1003: dep_libs.tar.gz
-# Gbp-Ignore-Patches: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
+# Gbp-Ignore-Patches: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Patch0: 0001-Add-project.assets.json-files.patch
Patch1: 0001-ARM-Linux-Support-unaligned-struct-read-write-11290.patch
Patch2: 0002-x86-Linux-Thread-safe-UMThunkMarshInfo-RunTimeInit-1.patch
@@ -64,6 +64,7 @@ Patch36: 0001-Fix-typo-in-SetDebuggerREGDISPLAYFromREGDISPLAY-1422.patch
Patch37: 0001-Use-addresses-without-sign-extension-in-lldb-plugin-.patch
Patch38: 0001-Fix-uaf-in-DestroyThread-function.patch
Patch39: 0001-Enable-gdbjit-while-NI-file-exist.patch
+Patch40: 0001-Fix-crossgen-debug-directory-generation-problems.-12.patch
ExcludeArch: aarch64
@@ -202,6 +203,7 @@ cp %{SOURCE1001} .
%patch37 -p1
%patch38 -p1
%patch39 -p1
+%patch40 -p1
%if 0%{skipmscorlib}
%else