[ELF] Pass Ctx & to Defined & CommonSymbol

This commit is contained in:
Fangrui Song
2024-10-20 01:38:16 +00:00
parent 2deb3a26fa
commit fe8af49a1b
9 changed files with 43 additions and 41 deletions

View File

@@ -227,8 +227,8 @@ void LinkerScript::addSymbol(SymbolAssignment *cmd) {
// write expressions like this: `alignment = 16; . = ALIGN(., alignment)`.
uint64_t symValue = value.sec ? 0 : value.getValue();
Defined newSym(createInternalFile(ctx, cmd->location), cmd->name, STB_GLOBAL,
visibility, value.type, symValue, 0, sec);
Defined newSym(ctx, createInternalFile(ctx, cmd->location), cmd->name,
STB_GLOBAL, visibility, value.type, symValue, 0, sec);
Symbol *sym = ctx.symtab->insert(cmd->name);
sym->mergeProperties(newSym);
@@ -244,7 +244,7 @@ void LinkerScript::declareSymbol(SymbolAssignment *cmd) {
return;
uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT;
Defined newSym(ctx.internalFile, cmd->name, STB_GLOBAL, visibility,
Defined newSym(ctx, ctx.internalFile, cmd->name, STB_GLOBAL, visibility,
STT_NOTYPE, 0, 0, nullptr);
// If the symbol is already defined, its order is 0 (with absence indicating