aboutsummaryrefslogtreecommitdiff
path: root/lld/wasm/Relocations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/wasm/Relocations.cpp')
-rw-r--r--lld/wasm/Relocations.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/lld/wasm/Relocations.cpp b/lld/wasm/Relocations.cpp
index 45ad327..52888ad 100644
--- a/lld/wasm/Relocations.cpp
+++ b/lld/wasm/Relocations.cpp
@@ -22,13 +22,13 @@ static bool requiresGOTAccess(const Symbol *sym) {
if (sym->isShared())
return true;
if (!ctx.isPic &&
- config->unresolvedSymbols != UnresolvedPolicy::ImportDynamic)
+ ctx.arg.unresolvedSymbols != UnresolvedPolicy::ImportDynamic)
return false;
if (sym->isHidden() || sym->isLocal())
return false;
// With `-Bsymbolic` (or when building an executable) as don't need to use
// the GOT for symbols that are defined within the current module.
- if (sym->isDefined() && (!config->shared || config->bsymbolic))
+ if (sym->isDefined() && (!ctx.arg.shared || ctx.arg.bsymbolic))
return false;
return true;
}
@@ -38,15 +38,15 @@ static bool allowUndefined(const Symbol* sym) {
// link time.
if (sym->isImported())
return true;
- if (isa<UndefinedFunction>(sym) && config->importUndefined)
+ if (isa<UndefinedFunction>(sym) && ctx.arg.importUndefined)
return true;
- return config->allowUndefinedSymbols.count(sym->getName()) != 0;
+ return ctx.arg.allowUndefinedSymbols.count(sym->getName()) != 0;
}
static void reportUndefined(ObjFile *file, Symbol *sym) {
if (!allowUndefined(sym)) {
- switch (config->unresolvedSymbols) {
+ switch (ctx.arg.unresolvedSymbols) {
case UnresolvedPolicy::ReportError:
error(toString(file) + ": undefined symbol: " + toString(*sym));
break;
@@ -63,8 +63,8 @@ static void reportUndefined(ObjFile *file, Symbol *sym) {
if (auto *f = dyn_cast<UndefinedFunction>(sym)) {
if (!f->stubFunction &&
- config->unresolvedSymbols != UnresolvedPolicy::ImportDynamic &&
- !config->importUndefined) {
+ ctx.arg.unresolvedSymbols != UnresolvedPolicy::ImportDynamic &&
+ !ctx.arg.importUndefined) {
f->stubFunction = symtab->createUndefinedStub(*f->getSignature());
f->stubFunction->markLive();
// Mark the function itself as a stub which prevents it from being
@@ -125,7 +125,7 @@ void scanRelocations(InputChunk *chunk) {
// In single-threaded builds TLS is lowered away and TLS data can be
// merged with normal data and allowing TLS relocation in non-TLS
// segments.
- if (config->sharedMemory) {
+ if (ctx.arg.sharedMemory) {
if (!sym->isTLS()) {
error(toString(file) + ": relocation " +
relocTypeToString(reloc.Type) +
@@ -144,9 +144,9 @@ void scanRelocations(InputChunk *chunk) {
break;
}
- if (ctx.isPic ||
+ if (ctx.isPic || sym->isShared() ||
(sym->isUndefined() &&
- config->unresolvedSymbols == UnresolvedPolicy::ImportDynamic)) {
+ ctx.arg.unresolvedSymbols == UnresolvedPolicy::ImportDynamic)) {
switch (reloc.Type) {
case R_WASM_TABLE_INDEX_SLEB:
case R_WASM_TABLE_INDEX_SLEB64:
@@ -173,7 +173,7 @@ void scanRelocations(InputChunk *chunk) {
}
}
- if (!config->relocatable && sym->isUndefined()) {
+ if (!ctx.arg.relocatable && sym->isUndefined()) {
switch (reloc.Type) {
case R_WASM_TABLE_INDEX_REL_SLEB:
case R_WASM_TABLE_INDEX_REL_SLEB64: