about summary refs log tree commit diff
path: root/src/rustllvm/ExecutionEngineWrapper.cpp
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-07-27 13:41:35 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-08-10 16:35:44 -0700
commit7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c (patch)
tree5553605e8d9ac7fc23cfec8f689f6c923e78abdd /src/rustllvm/ExecutionEngineWrapper.cpp
parentd03456183e85fe7bd465bbe7c8f67885a2528444 (diff)
downloadrust-7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c.tar.gz
rust-7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c.zip
Remove morestack support
This commit removes all morestack support from the compiler which entails:

* Segmented stacks are no longer emitted in codegen.
* We no longer build or distribute libmorestack.a
* The `stack_exhausted` lang item is no longer required

The only current use of the segmented stack support in LLVM is to detect stack
overflow. This is no longer really required, however, because we already have
guard pages for all threads and registered signal handlers watching for a
segfault on those pages (to print out a stack overflow message). Additionally,
major platforms (aka Windows) already don't use morestack.

This means that Rust is by default less likely to catch stack overflows because
if a function takes up more than one page of stack space it won't hit the guard
page. This is what the purpose of morestack was (to catch this case), but it's
better served with stack probes which have more cross platform support and no
runtime support necessary. Until LLVM supports this for all platform it looks
like morestack isn't really buying us much.

cc #16012 (still need stack probes)
Closes #26458 (a drive-by fix to help diagnostics on stack overflow)
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
-rw-r--r--src/rustllvm/ExecutionEngineWrapper.cpp16
1 files changed, 0 insertions, 16 deletions
diff --git a/src/rustllvm/ExecutionEngineWrapper.cpp b/src/rustllvm/ExecutionEngineWrapper.cpp
index df83f32670c..8b01cac820e 100644
--- a/src/rustllvm/ExecutionEngineWrapper.cpp
+++ b/src/rustllvm/ExecutionEngineWrapper.cpp
@@ -16,15 +16,6 @@ using namespace llvm;
 using namespace llvm::sys;
 using namespace llvm::object;
 
-// libmorestack is not used on other platforms
-#if defined(__linux__) || defined(__APPLE__)
-extern "C" void __morestack(void);
-
-static void* morestack_addr() {
-    return reinterpret_cast<void*>(__morestack);
-}
-#endif
-
 class RustJITMemoryManager : public SectionMemoryManager
 {
     typedef SectionMemoryManager Base;
@@ -35,13 +26,6 @@ class RustJITMemoryManager : public SectionMemoryManager
 
     uint64_t getSymbolAddress(const std::string &Name) override
     {
-#if defined(__linux__) || defined(__APPLE__)
-        if (Name == "__morestack" || Name == "___morestack")
-            return reinterpret_cast<uint64_t>(__morestack);
-        if (Name == "__morestack_addr" || Name == "___morestack_addr")
-            return reinterpret_cast<uint64_t>(morestack_addr);
-#endif
-
         return Base::getSymbolAddress(Name);
     }
 };