summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-05-10 13:56:02 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-11 20:06:51 -0400
commitdea9a3d90d657705be073fd4e0db64e76d717a0f (patch)
tree006ae2d973161752ececd14a624efefb7446a6d2
parent3c998f0d5f91742f0474e0eb76082e069ecb0cf4 (diff)
downloadhaskell-dea9a3d90d657705be073fd4e0db64e76d717a0f.tar.gz
rts: Drop setExecutable
Since f6e366c058b136f0789a42222b8189510a3693d1 setExecutable has been dead code. Drop it.
-rw-r--r--rts/posix/OSMem.c15
-rw-r--r--rts/sm/OSMem.h1
-rw-r--r--rts/win32/OSMem.c13
3 files changed, 0 insertions, 29 deletions
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index 822546d5d1..e08dfca8b6 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -455,21 +455,6 @@ StgWord64 getPhysicalMemorySize (void)
return physMemSize;
}
-void setExecutable (void *p, W_ len, bool exec)
-{
- StgWord pageSize = getPageSize();
-
- /* malloced memory isn't executable by default on OpenBSD */
- StgWord mask = ~(pageSize - 1);
- StgWord startOfFirstPage = ((StgWord)p ) & mask;
- StgWord startOfLastPage = ((StgWord)p + len - 1) & mask;
- StgWord size = startOfLastPage - startOfFirstPage + pageSize;
- if (mprotect((void*)startOfFirstPage, (size_t)size,
- (exec ? PROT_EXEC : 0) | PROT_READ | PROT_WRITE) != 0) {
- barf("setExecutable: failed to protect 0x%p\n", p);
- }
-}
-
#if defined(USE_LARGE_ADDRESS_SPACE)
static void *
diff --git a/rts/sm/OSMem.h b/rts/sm/OSMem.h
index ea123e80c6..6ccbc6d98a 100644
--- a/rts/sm/OSMem.h
+++ b/rts/sm/OSMem.h
@@ -17,7 +17,6 @@ void osReleaseFreeMemory(void);
void osFreeAllMBlocks(void);
size_t getPageSize (void);
StgWord64 getPhysicalMemorySize (void);
-void setExecutable (void *p, W_ len, bool exec);
bool osBuiltWithNumaSupport(void); // See #14956
bool osNumaAvailable(void);
uint32_t osNumaNodes(void);
diff --git a/rts/win32/OSMem.c b/rts/win32/OSMem.c
index c192fb5923..4c643a97c2 100644
--- a/rts/win32/OSMem.c
+++ b/rts/win32/OSMem.c
@@ -423,19 +423,6 @@ StgWord64 getPhysicalMemorySize (void)
return physMemSize;
}
-void setExecutable (void *p, W_ len, bool exec)
-{
- DWORD dwOldProtect = 0;
- if (VirtualProtect (p, len,
- exec ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE,
- &dwOldProtect) == 0)
- {
- sysErrorBelch("setExecutable: failed to protect 0x%p; old protection: "
- "%lu\n", p, (unsigned long)dwOldProtect);
- stg_exit(EXIT_FAILURE);
- }
-}
-
#if defined(USE_LARGE_ADDRESS_SPACE)
static void* heap_base = NULL;