[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
This commit is contained in:
Simon Atanasyan 2014-03-14 06:53:16 +00:00
parent dfbd26215e
commit 9f685d3951
2 changed files with 14 additions and 0 deletions

View File

@ -33,3 +33,16 @@ Sections:
# CHECK: SectionData ( # CHECK: SectionData (
# CHECK-NEXT: 0000: EBFE # CHECK-NEXT: 0000: EBFE
# CHECK-NEXT: ) # 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: }

View File

@ -357,6 +357,7 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) {
// Section header string table header. // Section header string table header.
Elf_Shdr SHStrTabSHeader; Elf_Shdr SHStrTabSHeader;
zero(SHStrTabSHeader); zero(SHStrTabSHeader);
SHStrTabSHeader.sh_name = SHStrTab.addString(StringRef(".shstrtab"));
createStringTableSectionHeader(SHStrTabSHeader, SHStrTab, CBA); createStringTableSectionHeader(SHStrTabSHeader, SHStrTab, CBA);
SHeaders.push_back(SHStrTabSHeader); SHeaders.push_back(SHStrTabSHeader);