if (Value == 0 || Value >= UINT32_MAX)
fatal(toString(this) + ": common symbol '" + Name +
"' has invalid alignment: " + Twine(Value));
- return Symtab->addCommon(Name, Size, Value, Binding, StOther, Type, this);
+ return Symtab->addCommon(Name, Size, Value, Binding, StOther, Type, *this);
}
switch (Binding) {
if (ObjSym.isCommon())
return Symtab->addCommon(NameRef, ObjSym.getCommonSize(),
ObjSym.getCommonAlignment(), Binding, Visibility,
- STT_OBJECT, &F);
+ STT_OBJECT, F);
return Symtab->addBitcode(NameRef, Binding, Visibility, Type,
CanOmitFromDynSym, F);
Symbol *SymbolTable::addCommon(StringRef N, uint64_t Size, uint32_t Alignment,
uint8_t Binding, uint8_t StOther, uint8_t Type,
- InputFile *File) {
+ InputFile &File) {
Symbol *S;
bool WasInserted;
std::tie(S, WasInserted) = insert(N, Type, getVisibility(StOther),
- /*CanOmitFromDynSym*/ false, File);
+ /*CanOmitFromDynSym*/ false, &File);
int Cmp = compareDefined(S, WasInserted, Binding, N);
if (Cmp > 0) {
auto *Bss = make<BssSection>("COMMON", Size, Alignment);
- Bss->File = File;
+ Bss->File = &File;
Bss->Live = !Config->GcSections;
InputSections.push_back(Bss);
- replaceSymbol<Defined>(S, File, N, Binding, StOther, Type, 0, Size, Bss);
+ replaceSymbol<Defined>(S, &File, N, Binding, StOther, Type, 0, Size, Bss);
} else if (Cmp == 0) {
auto *D = cast<Defined>(S);
auto *Bss = dyn_cast_or_null<BssSection>(D->Section);
Bss->Alignment = std::max(Bss->Alignment, Alignment);
if (Size > Bss->Size) {
- D->File = Bss->File = File;
+ D->File = Bss->File = &File;
D->Size = Bss->Size = Size;
}
}
Symbol *addCommon(StringRef Name, uint64_t Size, uint32_t Alignment,
uint8_t Binding, uint8_t StOther, uint8_t Type,
- InputFile *File);
+ InputFile &File);
std::pair<Symbol *, bool> insert(StringRef Name);
std::pair<Symbol *, bool> insert(StringRef Name, uint8_t Type,