Skip to content

Commit

Permalink
__chkstk workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekotekina committed Mar 11, 2017
1 parent 4739eb3 commit 1f17109
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Utilities/JIT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,22 @@ struct MemoryManager final : llvm::RTDyldMemoryManager

virtual u64 getSymbolAddress(const std::string& name) override
{
if (u64 addr = RTDyldMemoryManager::getSymbolAddress(name))
{
// This may be bad if LLVM requests some built-in functions like fma.
LOG_ERROR(GENERAL, "LLVM: Symbol requested %s -> 0x%016llx", name, addr);
return addr;
}

const auto found = m_link.find(name);

if (found != m_link.end())
{
return found->second;
}

if (u64 addr = RTDyldMemoryManager::getSymbolAddress(name))
{
// This may be bad if LLVM requests some built-in functions like fma.
LOG_ERROR(GENERAL, "LLVM: Symbol requested: %s -> 0x%016llx", name, addr);
return addr;
}

// It's fine if some function is never called, for example.
LOG_ERROR(GENERAL, "LLVM: Linkage failed for %s", name);
LOG_ERROR(GENERAL, "LLVM: Symbol not found: %s", name);
return (u64)null;
}

Expand Down Expand Up @@ -242,9 +242,17 @@ struct EventListener final : llvm::JITEventListener

static EventListener s_listener;

static void dummy()
{
}

jit_compiler::jit_compiler(std::unordered_map<std::string, std::uintptr_t> init_linkage_info)
: m_link(std::move(init_linkage_info))
{
#ifdef _MSC_VER
m_link.emplace("__chkstk", (u64)&dummy);

This comment has been minimized.

Copy link
@danilaml

danilaml Mar 12, 2017

Contributor

can't you use _chkstk (single underscore), or it's a different thing?
Nvm, looks like it double underscore on x64. Though maybe discussion in JuliaLang/julia#9339 would help.

#endif

verify(HERE), s_memory;

// Initialization
Expand Down

0 comments on commit 1f17109

Please sign in to comment.