summaryrefslogtreecommitdiff
path: root/tools/yaml2obj/yaml2elf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/yaml2obj/yaml2elf.cpp')
-rw-r--r--tools/yaml2obj/yaml2elf.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp
index 667718af38..421781ce14 100644
--- a/tools/yaml2obj/yaml2elf.cpp
+++ b/tools/yaml2obj/yaml2elf.cpp
@@ -199,6 +199,13 @@ static void handleSymtabSectionHeader(
if (!Sym.Name.empty())
Symbol.st_name = State.getStringTable().addString(Sym.Name);
Symbol.setBindingAndType(Sym.Binding, 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;
Syms.push_back(Symbol);
}