mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
jit: Link in __morestack and make it resolvable by JIT
This commit is contained in:
parent
7993f48209
commit
795acb7395
@ -23,10 +23,11 @@ RUSTLLVM_OBJS_OBJS_$(1) := $$(RUSTLLVM_OBJS_CS_$(1):rustllvm/%.cpp=rustllvm/$(1)
|
||||
ALL_OBJ_FILES += $$(RUSTLLVM_OBJS_OBJS_$(1))
|
||||
|
||||
rustllvm/$(1)/$(CFG_RUSTLLVM): $$(RUSTLLVM_OBJS_OBJS_$(1)) \
|
||||
rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a \
|
||||
$$(MKFILE_DEPS) $$(RUSTLLVM_DEF_$(1))
|
||||
@$$(call E, link: $$@)
|
||||
$$(Q)$$(call CFG_LINK_C_$(1),$$@,$$(RUSTLLVM_OBJS_OBJS_$(1)) \
|
||||
$$(CFG_GCCISH_PRE_LIB_FLAGS) $$(LLVM_LIBS_$(1)) \
|
||||
$$(CFG_GCCISH_PRE_LIB_FLAGS) $$(LLVM_LIBS_$(1)) rt/$(1)/arch/$$(HOST_$(1))/libmorestack.a \
|
||||
$$(CFG_GCCISH_POST_LIB_FLAGS) \
|
||||
$$(LLVM_LDFLAGS_$(1)),$$(RUSTLLVM_DEF_$(1)),$$(CFG_RUSTLLVM))
|
||||
|
||||
|
@ -49,6 +49,9 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
// Does this need to be done, or can it be made to resolve from the main program?
|
||||
extern "C" void __morestack(void *args, void *fn_ptr, uintptr_t stack_ptr);
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
static const char *LLVMRustError;
|
||||
@ -269,17 +272,12 @@ void *RustMCJITMemoryManager::getPointerToNamedFunction(const std::string &Name,
|
||||
if (Name == "mknod") return (void*)(intptr_t)&mknod;
|
||||
#endif
|
||||
|
||||
if (Name == "__morestack") return (void*)(intptr_t)&__morestack;
|
||||
|
||||
const char *NameStr = Name.c_str();
|
||||
void *Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr);
|
||||
if (Ptr) return Ptr;
|
||||
|
||||
// If it wasn't found and if it starts with an underscore ('_') character,
|
||||
// try again without the underscore.
|
||||
if (NameStr[0] == '_') {
|
||||
Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(NameStr+1);
|
||||
if (Ptr) return Ptr;
|
||||
}
|
||||
|
||||
if (AbortOnFailure)
|
||||
report_fatal_error("Program used external function '" + Name +
|
||||
"' which could not be resolved!");
|
||||
@ -309,8 +307,8 @@ LLVMRustPrepareJIT(LLVMPassManagerRef PMR,
|
||||
std::string Err;
|
||||
TargetOptions Options;
|
||||
Options.JITEmitDebugInfo = true;
|
||||
//Options.NoFramePointerElim = true;
|
||||
//Options.EnableSegmentedStacks = EnableSegmentedStacks;
|
||||
Options.NoFramePointerElim = true;
|
||||
Options.EnableSegmentedStacks = EnableSegmentedStacks;
|
||||
|
||||
unwrap<PassManager>(PMR)->run(*unwrap(M));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user