Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lld/wasm/Writer.cpp
Show First 20 Lines • Show All 738 Lines • ▼ Show 20 Lines | static bool shouldImport(Symbol *sym) { | ||||
} | } | ||||
if (config->isPic || config->relocatable || config->importUndefined || | if (config->isPic || config->relocatable || config->importUndefined || | ||||
config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) | config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic) | ||||
return true; | return true; | ||||
if (config->allowUndefinedSymbols.count(sym->getName()) != 0) | if (config->allowUndefinedSymbols.count(sym->getName()) != 0) | ||||
return true; | return true; | ||||
return sym->importName.has_value(); | return sym->isImported(); | ||||
} | } | ||||
void Writer::calculateImports() { | void Writer::calculateImports() { | ||||
// Some inputs require that the indirect function table be assigned to table | // Some inputs require that the indirect function table be assigned to table | ||||
// number 0, so if it is present and is an import, allocate it before any | // number 0, so if it is present and is an import, allocate it before any | ||||
// other tables. | // other tables. | ||||
if (WasmSym::indirectFunctionTable && | if (WasmSym::indirectFunctionTable && | ||||
shouldImport(WasmSym::indirectFunctionTable)) | shouldImport(WasmSym::indirectFunctionTable)) | ||||
▲ Show 20 Lines • Show All 948 Lines • ▼ Show 20 Lines | void Writer::run() { | ||||
} | } | ||||
for (auto &pair : config->exportedSymbols) { | for (auto &pair : config->exportedSymbols) { | ||||
Symbol *sym = symtab->find(pair.first()); | Symbol *sym = symtab->find(pair.first()); | ||||
if (sym && sym->isDefined()) | if (sym && sym->isDefined()) | ||||
sym->forceExport = true; | sym->forceExport = true; | ||||
} | } | ||||
// Delay reporting error about explicit exports until after | // Delay reporting errors about explicit exports until after | ||||
// addStartStopSymbols which can create optional symbols. | // addStartStopSymbols which can create optional symbols. | ||||
for (auto &name : config->requiredExports) { | for (auto &name : config->requiredExports) { | ||||
Symbol *sym = symtab->find(name); | Symbol *sym = symtab->find(name); | ||||
if (!sym || !sym->isDefined()) { | if (!sym || !sym->isDefined()) { | ||||
if (config->unresolvedSymbols == UnresolvedPolicy::ReportError) | if (config->unresolvedSymbols == UnresolvedPolicy::ReportError) | ||||
error(Twine("symbol exported via --export not found: ") + name); | error(Twine("symbol exported via --export not found: ") + name); | ||||
if (config->unresolvedSymbols == UnresolvedPolicy::Warn) | if (config->unresolvedSymbols == UnresolvedPolicy::Warn) | ||||
warn(Twine("symbol exported via --export not found: ") + name); | warn(Twine("symbol exported via --export not found: ") + name); | ||||
▲ Show 20 Lines • Show All 147 Lines • Show Last 20 Lines |