Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/AugmentManifest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function(augment_manifest)
OUTPUT "${_agmf_out}" "${_json_out}"
COMMAND dsymutil "${_target_bin}" -o "${_dbg}"
COMMAND ${_phase2_cmd} "--binary" "${_dbg}"
DEPENDS "${_target_bin}"
DEPENDS "${_target_bin}" "${_ast_manifest}"
COMMENT "augment: phase2 RVA extraction + pack for ${AM_TARGET}"
USES_TERMINAL
VERBATIM
Expand All @@ -188,7 +188,7 @@ function(augment_manifest)
OUTPUT "${_agmf_out}" "${_json_out}"
COMMAND ${_phase2_cmd}
${_strip_cmd}
DEPENDS "${_target_bin}"
DEPENDS "${_target_bin}" "${_ast_manifest}"
COMMENT "augment: phase2 RVA extraction + pack for ${AM_TARGET}"
USES_TERMINAL
VERBATIM
Expand Down
19 changes: 13 additions & 6 deletions src/runtime/closure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,19 @@ extern "C" AUGMENT_API void* augment_make_closure(const char* symbol) {
}

static void* resolve_call_target(const char* symbol) {
if (void* fn = augment::plat::sym_resolve(symbol))
return fn;
uint64_t rva = augment::manifest::global_reader().rva_of(symbol);
if (!rva)
return nullptr;
return reinterpret_cast<void*>((uintptr_t)((intptr_t)rva + augment::plat::image_slide()));
static std::unordered_map<std::string, void*> s_cache;
auto it = s_cache.find(symbol);
if (it != s_cache.end())
return it->second;

void* fn = nullptr;
if (uint64_t rva = augment::manifest::global_reader().rva_of(symbol)) {
fn = reinterpret_cast<void*>((uintptr_t)((intptr_t)rva + augment::plat::image_slide()));
} else if (void* p = augment::plat::sym_resolve(symbol)) {
fn = p;
}
s_cache.emplace(symbol, fn);
return fn;
}

extern "C" AUGMENT_API int augment_call(const char* symbol, void** args, unsigned nargs,
Expand Down