Skip to content

Commit

Permalink
use libatomic on mingw
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Jun 3, 2017
1 parent 9b81432 commit cff7490
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/jitlayers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,12 +341,17 @@ void NotifyDebugger(jit_code_entry *JITCodeEntry)
}
// ------------------------ END OF TEMPORARY COPY FROM LLVM -----------------

#if defined(_OS_LINUX_)
#if defined(_OS_LINUX_) || defined(_OS_WINDOWS_)
// Resolve non-lock free atomic functions in the libatomic library.
// This is the library that provides support for c11/c++11 atomic operations.
static uint64_t resolve_atomic(const char *name)
{
static void *atomic_hdl = jl_load_dynamic_library_e("libatomic",
#if defined(_OS_LINUX_)
static const char *const libatomic = "libatomic";
#elif defined(_OS_WINDOWS_)
static const char *const libatomic = "libatomic-1";
#endif
static void *atomic_hdl = jl_load_dynamic_library_e(libatomic,
JL_RTLD_LOCAL);
static const char *const atomic_prefix = "__atomic_";
if (!atomic_hdl)
Expand Down Expand Up @@ -578,7 +583,7 @@ void JuliaOJIT::addModule(std::unique_ptr<Module> M)
// Step 2: Search the program symbols
if (uint64_t addr = SectionMemoryManager::getSymbolAddressInProcess(Name))
return JL_SymbolInfo(addr, JITSymbolFlags::Exported);
#if defined(_OS_LINUX_)
#if defined(_OS_LINUX_) || defined(_OS_WINDOWS_)
if (uint64_t addr = resolve_atomic(Name.c_str()))
return JL_SymbolInfo(addr, JITSymbolFlags::Exported);
#endif
Expand Down

0 comments on commit cff7490

Please sign in to comment.