From 9f685d3951b81515dae30067821deadc4c8d635f Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Fri, 14 Mar 2014 06:53:16 +0000 Subject: [PATCH] [yaml2obj][ELF] Assign name (.shstrtab) to the section holds sections names. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203897 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Object/yaml2obj-elf-section-basic.yaml | 13 +++++++++++++ tools/yaml2obj/yaml2elf.cpp | 1 + 2 files changed, 14 insertions(+) diff --git a/test/Object/yaml2obj-elf-section-basic.yaml b/test/Object/yaml2obj-elf-section-basic.yaml index 34be11d3658..c1f69351855 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 d46e1549877..e24a5492f91 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);