MCPcopy Create free account
hub / github.com/Inori/GPCS4 / resolveSymbol

Method resolveSymbol

GPCS4/Emulator/Linker.cpp:13–113  ·  view source on GitHub ↗

resolveSymbol always returns true

Source from the content-addressed store, hash-verified

11
12// resolveSymbol always returns true
13bool CLinker::resolveSymbol(NativeModule const &mod,
14 std::string const &name,
15 uint64_t *addrOut) const
16{
17 bool retVal = true;
18
19 do
20 {
21 const SymbolInfo *info = nullptr;
22 void *address = nullptr;
23 bool useNative = false;
24
25 if (addrOut == nullptr)
26 {
27 LOG_ERR("null pointer");
28 break;
29 }
30
31 auto ret = mod.getSymbol(name, &info);
32 if (!ret)
33 {
34 LOG_ERR("fail to find symbol: %s", name.c_str());
35 break;
36 }
37
38 if (!info->isEncoded)
39 {
40 address = getSymbolAddress(info->moduleName,
41 info->libraryName,
42 info->symbolName);
43
44 auto policy = m_modSystem.getSymbolPolicy(info->moduleName,
45 info->libraryName,
46 info->symbolName);
47
48 useNative = (policy == Policy::UseNative);
49 }
50 else
51 {
52 address = getSymbolAddress(info->moduleName,
53 info->libraryName,
54 info->nid);
55
56 auto policy = m_modSystem.getSymbolPolicy(info->moduleName,
57 info->libraryName,
58 info->nid);
59
60 useNative = (policy == Policy::UseNative);
61 }
62
63 const char* source = useNative? "NATIVE":"BUILTIN";
64
65 LOG_ERR_IF(address == nullptr, "fail to resolve symbol: %s[%s] from %s for module %s",
66 name.c_str(), source, info->moduleName.c_str(), mod.fileName.c_str());
67
68#ifdef MODSYS_STUB_DISABLE
69
70 if (!address)

Callers

nothing calls this directly

Calls 3

getSymbolMethod · 0.80
c_strMethod · 0.45
getSymbolPolicyMethod · 0.45

Tested by

no test coverage detected