mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
[yaml2obj][ELF] Allow expressing undefined symbols.
Previously we unconditionally enforced that section references in symbols in the YAML had a name that was a section name present in the object, and linked the references to that section. Now, permit empty section names (already the default, if the `Section` key is not provided) to indicate SHN_UNDEF. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184513 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -184,13 +184,15 @@ addSymbols(const std::vector<ELFYAML::Symbol> &Symbols, ELFState<ELFT> &State,
|
||||
if (!Sym.Name.empty())
|
||||
Symbol.st_name = State.getStringTable().addString(Sym.Name);
|
||||
Symbol.setBindingAndType(SymbolBinding, Sym.Type);
|
||||
unsigned Index;
|
||||
if (State.getSN2I().lookupSection(Sym.Section, Index)) {
|
||||
errs() << "error: Unknown section referenced: '" << Sym.Section
|
||||
<< "' by YAML symbol " << Sym.Name << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
Symbol.st_shndx = Index;
|
||||
if (!Sym.Section.empty()) {
|
||||
unsigned Index;
|
||||
if (State.getSN2I().lookupSection(Sym.Section, Index)) {
|
||||
errs() << "error: Unknown section referenced: '" << Sym.Section
|
||||
<< "' by YAML symbol " << Sym.Name << ".\n";
|
||||
exit(1);
|
||||
}
|
||||
Symbol.st_shndx = Index;
|
||||
} // else Symbol.st_shndex == SHN_UNDEF (== 0), since it was zero'd earlier.
|
||||
Symbol.st_value = Sym.Value;
|
||||
Symbol.st_size = Sym.Size;
|
||||
Syms.push_back(Symbol);
|
||||
|
Reference in New Issue
Block a user