diff options
Diffstat (limited to 'tools/yaml2obj/yaml2elf.cpp')
-rw-r--r-- | tools/yaml2obj/yaml2elf.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index f9bc566f73..ac6b330e66 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -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); |