using namespace lld;
using namespace lld::wasm;
-static StringRef ReloctTypeToString(uint8_t RelocType) {
+static StringRef reloctTypeToString(uint8_t RelocType) {
switch (RelocType) {
#define WASM_RELOC(NAME, REL) \
case REL: \
warn("expected LEB at relocation site be 5-byte padded");
uint32_t ExpectedValue = File->calcExpectedValue(Rel);
if (ExpectedValue != ExistingValue)
- warn("unexpected existing value for " + ReloctTypeToString(Rel.Type) +
+ warn("unexpected existing value for " + reloctTypeToString(Rel.Type) +
": existing=" + Twine(ExistingValue) +
" expected=" + Twine(ExpectedValue));
}
for (const WasmRelocation &Rel : Relocations) {
uint8_t *Loc = Buf + Rel.Offset + Off;
uint32_t Value = File->calcNewValue(Rel);
- LLVM_DEBUG(dbgs() << "apply reloc: type=" << ReloctTypeToString(Rel.Type)
+ LLVM_DEBUG(dbgs() << "apply reloc: type=" << reloctTypeToString(Rel.Type)
<< " addend=" << Rel.Addend << " index=" << Rel.Index
<< " value=" << Value << " offset=" << Rel.Offset
<< "\n");
if (ObjSym.isUndefined()) {
if (ObjSym.isExecutable())
- return Symtab->addUndefinedFunction(Name, kDefaultModule, Flags, &F, nullptr);
+ return Symtab->addUndefinedFunction(Name, DefaultModule, Flags, &F, nullptr);
return Symtab->addUndefinedData(Name, Flags, &F);
}
static void undefine(Symbol *S) {
if (auto F = dyn_cast<DefinedFunction>(S))
- replaceSymbol<UndefinedFunction>(F, F->getName(), kDefaultModule, 0,
+ replaceSymbol<UndefinedFunction>(F, F->getName(), DefaultModule, 0,
F->getFile(), F->Signature);
else if (isa<DefinedData>(S))
replaceSymbol<UndefinedData>(S, S->getName(), 0, S->getFile());
using namespace lld;
using namespace lld::wasm;
-static constexpr int kStackAlignment = 16;
-static constexpr const char *kFunctionTableName = "__indirect_function_table";
-const char *lld::wasm::kDefaultModule = "env";
+static constexpr int StackAlignment = 16;
+static constexpr const char *FunctionTableName = "__indirect_function_table";
+const char *lld::wasm::DefaultModule = "env";
namespace {
if (Config->ImportMemory) {
WasmImport Import;
- Import.Module = kDefaultModule;
+ Import.Module = DefaultModule;
Import.Field = "memory";
Import.Kind = WASM_EXTERNAL_MEMORY;
Import.Memory.Flags = 0;
if (Config->ImportTable) {
uint32_t TableSize = TableBase + IndirectFunctions.size();
WasmImport Import;
- Import.Module = kDefaultModule;
- Import.Field = kFunctionTableName;
+ Import.Module = DefaultModule;
+ Import.Field = FunctionTableName;
Import.Kind = WASM_EXTERNAL_TABLE;
Import.Table.ElemType = WASM_TYPE_FUNCREF;
Import.Table.Limits = {0, TableSize, 0};
if (auto *F = dyn_cast<UndefinedFunction>(Sym))
Import.Module = F->Module;
else
- Import.Module = kDefaultModule;
+ Import.Module = DefaultModule;
Import.Field = Sym->getName();
if (auto *FunctionSym = dyn_cast<FunctionSymbol>(Sym)) {
auto PlaceStack = [&]() {
if (Config->Relocatable || Config->Shared)
return;
- MemoryPtr = alignTo(MemoryPtr, kStackAlignment);
- if (Config->ZStackSize != alignTo(Config->ZStackSize, kStackAlignment))
- error("stack size must be " + Twine(kStackAlignment) + "-byte aligned");
+ MemoryPtr = alignTo(MemoryPtr, StackAlignment);
+ if (Config->ZStackSize != alignTo(Config->ZStackSize, StackAlignment))
+ error("stack size must be " + Twine(StackAlignment) + "-byte aligned");
log("mem: stack size = " + Twine(Config->ZStackSize));
log("mem: stack base = " + Twine(MemoryPtr));
MemoryPtr += Config->ZStackSize;
Exports.push_back(WasmExport{"memory", WASM_EXTERNAL_MEMORY, 0});
if (!Config->Relocatable && Config->ExportTable)
- Exports.push_back(WasmExport{kFunctionTableName, WASM_EXTERNAL_TABLE, 0});
+ Exports.push_back(WasmExport{FunctionTableName, WASM_EXTERNAL_TABLE, 0});
unsigned FakeGlobalIndex = NumImportedGlobals + InputGlobals.size();