summaryrefslogtreecommitdiffstats
path: root/lld/wasm/Relocations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/wasm/Relocations.cpp')
-rw-r--r--lld/wasm/Relocations.cpp68
1 files changed, 34 insertions, 34 deletions
diff --git a/lld/wasm/Relocations.cpp b/lld/wasm/Relocations.cpp
index faedd000329..e39f6987a42 100644
--- a/lld/wasm/Relocations.cpp
+++ b/lld/wasm/Relocations.cpp
@@ -17,69 +17,69 @@ using namespace llvm::wasm;
using namespace lld;
using namespace lld::wasm;
-static bool requiresGOTAccess(const Symbol *Sym) {
- return Config->Pic && !Sym->isHidden() && !Sym->isLocal();
+static bool requiresGOTAccess(const Symbol *sym) {
+ return config->isPic && !sym->isHidden() && !sym->isLocal();
}
-static bool allowUndefined(const Symbol* Sym) {
+static bool allowUndefined(const Symbol* sym) {
// Historically --allow-undefined doesn't work for data symbols since we don't
// have any way to represent these as imports in the final binary. The idea
// behind allowing undefined symbols is to allow importing these symbols from
// the embedder and we can't do this for data symbols (at least not without
// compiling with -fPIC)
- if (isa<DataSymbol>(Sym))
+ if (isa<DataSymbol>(sym))
return false;
- return (Config->AllowUndefined ||
- Config->AllowUndefinedSymbols.count(Sym->getName()) != 0);
+ return (config->allowUndefined ||
+ config->allowUndefinedSymbols.count(sym->getName()) != 0);
}
-static void reportUndefined(const Symbol* Sym) {
- assert(Sym->isUndefined());
- assert(!Sym->isWeak());
- if (!allowUndefined(Sym))
- error(toString(Sym->getFile()) + ": undefined symbol: " + toString(*Sym));
+static void reportUndefined(const Symbol* sym) {
+ assert(sym->isUndefined());
+ assert(!sym->isWeak());
+ if (!allowUndefined(sym))
+ error(toString(sym->getFile()) + ": undefined symbol: " + toString(*sym));
}
-void lld::wasm::scanRelocations(InputChunk *Chunk) {
- if (!Chunk->Live)
+void lld::wasm::scanRelocations(InputChunk *chunk) {
+ if (!chunk->live)
return;
- ObjFile *File = Chunk->File;
- ArrayRef<WasmSignature> Types = File->getWasmObj()->types();
- for (const WasmRelocation &Reloc : Chunk->getRelocations()) {
- if (Reloc.Type == R_WASM_TYPE_INDEX_LEB) {
+ ObjFile *file = chunk->file;
+ ArrayRef<WasmSignature> types = file->getWasmObj()->types();
+ for (const WasmRelocation &reloc : chunk->getRelocations()) {
+ if (reloc.Type == R_WASM_TYPE_INDEX_LEB) {
// Mark target type as live
- File->TypeMap[Reloc.Index] =
- Out.TypeSec->registerType(Types[Reloc.Index]);
- File->TypeIsUsed[Reloc.Index] = true;
+ file->typeMap[reloc.Index] =
+ out.typeSec->registerType(types[reloc.Index]);
+ file->typeIsUsed[reloc.Index] = true;
continue;
}
// Other relocation types all have a corresponding symbol
- Symbol *Sym = File->getSymbols()[Reloc.Index];
+ Symbol *sym = file->getSymbols()[reloc.Index];
- switch (Reloc.Type) {
+ switch (reloc.Type) {
case R_WASM_TABLE_INDEX_I32:
case R_WASM_TABLE_INDEX_SLEB:
case R_WASM_TABLE_INDEX_REL_SLEB:
- if (requiresGOTAccess(Sym))
+ if (requiresGOTAccess(sym))
break;
- Out.ElemSec->addEntry(cast<FunctionSymbol>(Sym));
+ out.elemSec->addEntry(cast<FunctionSymbol>(sym));
break;
case R_WASM_GLOBAL_INDEX_LEB:
- if (!isa<GlobalSymbol>(Sym))
- Out.ImportSec->addGOTEntry(Sym);
+ if (!isa<GlobalSymbol>(sym))
+ out.importSec->addGOTEntry(sym);
break;
}
- if (Config->Pic) {
- switch (Reloc.Type) {
+ if (config->isPic) {
+ switch (reloc.Type) {
case R_WASM_TABLE_INDEX_SLEB:
case R_WASM_MEMORY_ADDR_SLEB:
case R_WASM_MEMORY_ADDR_LEB:
// Certain relocation types can't be used when building PIC output,
// since they would require absolute symbol addresses at link time.
- error(toString(File) + ": relocation " + relocTypeToString(Reloc.Type) +
- " cannot be used against symbol " + toString(*Sym) +
+ error(toString(file) + ": relocation " + relocTypeToString(reloc.Type) +
+ " cannot be used against symbol " + toString(*sym) +
"; recompile with -fPIC");
break;
case R_WASM_TABLE_INDEX_I32:
@@ -87,14 +87,14 @@ void lld::wasm::scanRelocations(InputChunk *Chunk) {
// These relocation types are only present in the data section and
// will be converted into code by `generateRelocationCode`. This code
// requires the symbols to have GOT entires.
- if (requiresGOTAccess(Sym))
- Out.ImportSec->addGOTEntry(Sym);
+ if (requiresGOTAccess(sym))
+ out.importSec->addGOTEntry(sym);
break;
}
} else {
// Report undefined symbols
- if (Sym->isUndefined() && !Config->Relocatable && !Sym->isWeak())
- reportUndefined(Sym);
+ if (sym->isUndefined() && !config->relocatable && !sym->isWeak())
+ reportUndefined(sym);
}
}
OpenPOWER on IntegriCloud