summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Object/yaml2obj-elf-section-basic.yaml13
-rw-r--r--tools/yaml2obj/yaml2elf.cpp1
2 files changed, 14 insertions, 0 deletions
diff --git a/test/Object/yaml2obj-elf-section-basic.yaml b/test/Object/yaml2obj-elf-section-basic.yaml
index 34be11d365..c1f6935185 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 d46e154987..e24a5492f9 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);