From ca0170ffa1ba6d53f0008b345cb5ac777e81c3b1 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Tue, 18 Jun 2013 23:19:17 +0000 Subject: [PATCH] [yaml2obj][ELF] Ensure STN_UNDEF entry is present. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184258 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Object/yaml2obj-elf-symbol-basic.yaml | 1 - tools/yaml2obj/yaml2elf.cpp | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Object/yaml2obj-elf-symbol-basic.yaml b/test/Object/yaml2obj-elf-symbol-basic.yaml index c33d3853041..e6a6cbc6d51 100644 --- a/test/Object/yaml2obj-elf-symbol-basic.yaml +++ b/test/Object/yaml2obj-elf-symbol-basic.yaml @@ -12,7 +12,6 @@ Sections: - Name: .symtab Type: SHT_SYMTAB Symbols: - - Name: "" # TODO: Add STN_UNDEF automatically. - Name: main # CHECK: Symbols [ diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index bebcbde256f..a67a275bf99 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -154,7 +154,12 @@ static void handleSymtabSectionHeader( SHeader.sh_entsize = sizeof(Elf_Sym); std::vector Syms; - // FIXME: Ensure STN_UNDEF entry is present. + { + // Ensure STN_UNDEF is present + Elf_Sym Sym; + zero(Sym); + Syms.push_back(Sym); + } for (unsigned i = 0, e = Sec.Symbols.size(); i != e; ++i) { const ELFYAML::Symbol &Sym = Sec.Symbols[i]; Elf_Sym Symbol; -- 2.34.1