diff --git a/test/Object/yaml2obj-elf-section-basic.yaml b/test/Object/yaml2obj-elf-section-basic.yaml index 34be11d3658cc..c1f693518556a 100644 --- a/test/Object/yaml2obj-elf-section-basic.yaml +++ b/test/Object/yaml2obj-elf-section-basic.yaml @@ -33,3 +33,16 @@ Sections: # CHECK: SectionData ( # CHECK-NEXT: 0000: EBFE # CHECK-NEXT: ) +# +# CHECK: Section { +# CHECK: Name: .symtab (7) +# CHECK: Type: SHT_SYMTAB (0x2) +# CHECK: } +# CHECK: Section { +# CHECK: Name: .strtab (15) +# CHECK: Type: SHT_STRTAB (0x3) +# CHECK: } +# CHECK: Section { +# CHECK: Name: .shstrtab (23) +# CHECK: Type: SHT_STRTAB (0x3) +# CHECK: } diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index d46e154987779..e24a5492f916b 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -357,6 +357,7 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { // Section header string table header. Elf_Shdr SHStrTabSHeader; zero(SHStrTabSHeader); + SHStrTabSHeader.sh_name = SHStrTab.addString(StringRef(".shstrtab")); createStringTableSectionHeader(SHStrTabSHeader, SHStrTab, CBA); SHeaders.push_back(SHStrTabSHeader);