pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
llvm-netbsd: Fix few more failing tests in JIT.
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Sat Jul 29 02:11:02 2017 +0200
Changeset: e5821f0e87db9c7ae02c88fbe391dd0004a61672
Modified Files:
llvm-netbsd/distinfo
llvm-netbsd/patches/patch-include_llvm_Support_Memory.h
llvm-netbsd/patches/patch-lib_ExecutionEngine_SectionMemoryManager.cpp
llvm-netbsd/patches/patch-lib_Support_Unix_Memory.inc
Added Files:
llvm-netbsd/patches/patch-include_llvm_ExecutionEngine_SectionMemoryManager.h
llvm-netbsd/patches/patch-lib_Support_Unix_Signals.inc
Log Message:
llvm-netbsd: Fix few more failing tests in JIT.
Work in progress.
Sponsored by <The NetBSD Foundation>
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e5821f0e87db9c7ae02c88fbe391dd0004a61672
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
llvm-netbsd/distinfo | 8 ++++--
...ude_llvm_ExecutionEngine_SectionMemoryManager.h | 13 +++++++++
.../patches/patch-include_llvm_Support_Memory.h | 8 ++++--
...ch-lib_ExecutionEngine_SectionMemoryManager.cpp | 32 ++++++++++++++++++++++
.../patches/patch-lib_Support_Unix_Memory.inc | 15 ++++++----
.../patches/patch-lib_Support_Unix_Signals.inc | 15 ++++++++++
6 files changed, 80 insertions(+), 11 deletions(-)
diffs:
diff --git a/llvm-netbsd/distinfo b/llvm-netbsd/distinfo
index 057b574eda..3ea6c02ab9 100644
--- a/llvm-netbsd/distinfo
+++ b/llvm-netbsd/distinfo
@@ -14,9 +14,11 @@ RMD160 (llvm-3.6.2.src.tar.xz) = 521cbc5fe2925ea3c6e90c7a31f752a04045c972
Size (llvm-3.6.2.src.tar.xz) = 12802380 bytes
SHA1 (patch-include_llvm_ExecutionEngine_Orc_IndirectionUtils.h) = f106d7e0b95c498c34dc087d72027e19c7342224
SHA1 (patch-include_llvm_ExecutionEngine_Orc_OrcRemoteTargetServer.h) = 6bec3a8920d3d73363d353c05ce40ff33b0a4193
-SHA1 (patch-include_llvm_Support_Memory.h) = b432032e91f76dc3061d918714d1bc788c872d03
+SHA1 (patch-include_llvm_ExecutionEngine_SectionMemoryManager.h) = b781ebf238540554b4e10d1616d63497c1e3ef24
+SHA1 (patch-include_llvm_Support_Memory.h) = 9d8e48e3f5054dc1a6a2db6e7f99162e058c7c0e
SHA1 (patch-lib_ExecutionEngine_Orc_OrcABISupport.cpp) = 3fc562d8e3c3dd7ca28121bf1bd03d1275d3d1c2
-SHA1 (patch-lib_ExecutionEngine_SectionMemoryManager.cpp) = fe15fc03578dad2af283ba389381ebb5ff793e57
-SHA1 (patch-lib_Support_Unix_Memory.inc) = cf14509c8d562a0101615d7a8c4148aa02b06bc9
+SHA1 (patch-lib_ExecutionEngine_SectionMemoryManager.cpp) = 799faee5f01a87a435da7e745ec552ff6faeacbd
+SHA1 (patch-lib_Support_Unix_Memory.inc) = 2a5f9cc066590e3044d1cf1cfd8f31d144518c0c
+SHA1 (patch-lib_Support_Unix_Signals.inc) = adcc104a0a9917a385a05cb9f19a69d6bbaec31e
SHA1 (patch-tools_llvm-rtdyld_llvm-rtdyld.cpp) = 98c44df7b016f311e2553a75458175a7d5216279
SHA1 (patch-unittests_Support_MemoryTest.cpp) = cd7bfc8053ceca839993e70e147cf803bac7eaae
diff --git a/llvm-netbsd/patches/patch-include_llvm_ExecutionEngine_SectionMemoryManager.h b/llvm-netbsd/patches/patch-include_llvm_ExecutionEngine_SectionMemoryManager.h
new file mode 100644
index 0000000000..28f8be9074
--- /dev/null
+++ b/llvm-netbsd/patches/patch-include_llvm_ExecutionEngine_SectionMemoryManager.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- include/llvm/ExecutionEngine/SectionMemoryManager.h.orig 2017-07-05 18:41:32.000000000 +0000
++++ include/llvm/ExecutionEngine/SectionMemoryManager.h
+@@ -114,7 +114,7 @@ private:
+ unsigned Alignment);
+
+ std::error_code applyMemoryGroupPermissions(MemoryGroup &MemGroup,
+- unsigned Permissions);
++ std::error_code (*fn)(const llvm::sys::MemoryBlock &));
+
+ MemoryGroup CodeMem;
+ MemoryGroup RWDataMem;
diff --git a/llvm-netbsd/patches/patch-include_llvm_Support_Memory.h b/llvm-netbsd/patches/patch-include_llvm_Support_Memory.h
index 108a45ec55..fb08b8d4fb 100644
--- a/llvm-netbsd/patches/patch-include_llvm_Support_Memory.h
+++ b/llvm-netbsd/patches/patch-include_llvm_Support_Memory.h
@@ -53,7 +53,7 @@ $NetBSD$
/// \r error_success if the function was successful, or an error_code
/// describing the failure if an error occurred.
///
-@@ -109,51 +119,38 @@ namespace sys {
+@@ -109,51 +119,42 @@ namespace sys {
static std::error_code protectMappedMemory(const MemoryBlock &Block,
unsigned Flags);
@@ -97,7 +97,11 @@ $NetBSD$
/// platforms.
static void InvalidateInstructionCache(const void *Addr, size_t Len);
-+ /// setExecutable - Before the JIT can write a block of code, it has to be
++ /// setReadable - Before the JIT can write a block of code, it has to be
++ /// given read and write privilege.
++ static std::error_code setReadable(const MemoryBlock &M);
++
++ /// setWritable - Before the JIT can write a block of code, it has to be
+ /// given read and write privilege.
+ static std::error_code setWritable(const MemoryBlock &M);
+
diff --git a/llvm-netbsd/patches/patch-lib_ExecutionEngine_SectionMemoryManager.cpp b/llvm-netbsd/patches/patch-lib_ExecutionEngine_SectionMemoryManager.cpp
index 4d36258f12..8f13254066 100644
--- a/llvm-netbsd/patches/patch-lib_ExecutionEngine_SectionMemoryManager.cpp
+++ b/llvm-netbsd/patches/patch-lib_ExecutionEngine_SectionMemoryManager.cpp
@@ -17,3 +17,35 @@ $NetBSD$
if (ec) {
// FIXME: Add error propagation to the interface.
return nullptr;
+@@ -128,8 +126,7 @@ bool SectionMemoryManager::finalizeMemor
+ std::error_code ec;
+
+ // Make code memory executable.
+- ec = applyMemoryGroupPermissions(CodeMem,
+- sys::Memory::MF_READ | sys::Memory::MF_EXEC);
++ ec = applyMemoryGroupPermissions(CodeMem, sys::Memory::setExecutable);
+ if (ec) {
+ if (ErrMsg) {
+ *ErrMsg = ec.message();
+@@ -138,8 +135,7 @@ bool SectionMemoryManager::finalizeMemor
+ }
+
+ // Make read-only data memory read-only.
+- ec = applyMemoryGroupPermissions(RODataMem,
+- sys::Memory::MF_READ | sys::Memory::MF_EXEC);
++ ec = applyMemoryGroupPermissions(RODataMem, sys::Memory::setReadable);
+ if (ec) {
+ if (ErrMsg) {
+ *ErrMsg = ec.message();
+@@ -179,9 +175,9 @@ static sys::MemoryBlock trimBlockToPageS
+
+ std::error_code
+ SectionMemoryManager::applyMemoryGroupPermissions(MemoryGroup &MemGroup,
+- unsigned Permissions) {
++ std::error_code (*fn)(const llvm::sys::MemoryBlock &)) {
+ for (sys::MemoryBlock &MB : MemGroup.PendingMem)
+- if (std::error_code EC = sys::Memory::protectMappedMemory(MB, Permissions))
++ if (std::error_code EC = fn(MB))
+ return EC;
+
+ MemGroup.PendingMem.clear();
diff --git a/llvm-netbsd/patches/patch-lib_Support_Unix_Memory.inc b/llvm-netbsd/patches/patch-lib_Support_Unix_Memory.inc
index 993a40a7c8..5656e80243 100644
--- a/llvm-netbsd/patches/patch-lib_Support_Unix_Memory.inc
+++ b/llvm-netbsd/patches/patch-lib_Support_Unix_Memory.inc
@@ -66,7 +66,7 @@ $NetBSD$
static const size_t PageSize = Process::getPageSize();
if (M.Address == nullptr || M.Size == 0)
return std::error_code();
-@@ -166,128 +190,24 @@ Memory::protectMappedMemory(const Memory
+@@ -166,128 +190,29 @@ Memory::protectMappedMemory(const Memory
return std::error_code();
}
@@ -145,8 +145,11 @@ $NetBSD$
- if (0 != ::munmap(M.Address, M.Size))
- return MakeErrMsg(ErrMsg, "Can't release RWX Memory");
- return false;
--}
--
++Memory::AllocateJIT(size_t NumBytes, const MemoryBlock* NearBlock,
++ std::error_code &EC) {
++ return allocateMappedMemory(NumBytes, NearBlock, MF_READ | MF_WRITE, EC, MF_EXEC);
+ }
+
-bool Memory::setWritable (MemoryBlock &M, std::string *ErrMsg) {
-#if defined(__APPLE__) && (defined(__arm__) || defined(__arm64__))
- if (M.Address == 0 || M.Size == 0) return false;
@@ -157,9 +160,9 @@ $NetBSD$
-#else
- return true;
-#endif
-+Memory::AllocateJIT(size_t NumBytes, const MemoryBlock* NearBlock,
-+ std::error_code &EC) {
-+ return allocateMappedMemory(NumBytes, NearBlock, MF_READ | MF_WRITE, EC, MF_EXEC);
++std::error_code
++Memory::setReadable (const MemoryBlock &M) {
++ return protectMappedMemory(M, MF_READ);
}
-bool Memory::setExecutable (MemoryBlock &M, std::string *ErrMsg) {
diff --git a/llvm-netbsd/patches/patch-lib_Support_Unix_Signals.inc b/llvm-netbsd/patches/patch-lib_Support_Unix_Signals.inc
new file mode 100644
index 0000000000..f3a51a410f
--- /dev/null
+++ b/llvm-netbsd/patches/patch-lib_Support_Unix_Signals.inc
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- lib/Support/Unix/Signals.inc.orig 2017-07-05 18:38:14.000000000 +0000
++++ lib/Support/Unix/Signals.inc
+@@ -158,8 +158,8 @@ static void RegisterHandlers() {
+ // be able to reliably handle signals due to stack overflow.
+ CreateSigAltStack();
+
+- for (auto S : IntSigs) RegisterHandler(S);
+- for (auto S : KillSigs) RegisterHandler(S);
++// for (auto S : IntSigs) RegisterHandler(S);
++// for (auto S : KillSigs) RegisterHandler(S);
+ }
+
+ static void UnregisterHandlers() {
Home |
Main Index |
Thread Index |
Old Index