[ELFYAML] Make the Size field for .bss section optional
authorSimon Atanasyan <simon@atanasyan.com>
Fri, 3 Jul 2015 14:19:06 +0000 (14:19 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Fri, 3 Jul 2015 14:19:06 +0000 (14:19 +0000)
It's a common case to have a zero-size .bss section in an object file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241352 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Object/ELFYAML.cpp
test/Object/obj2yaml.test

index 56eb374af23af9b17eb635642f7500e8c02801ee..72c232c3287065c83c77e913eddbf2564c665a95 100644 (file)
@@ -629,7 +629,7 @@ static void sectionMapping(IO &IO, ELFYAML::RawContentSection &Section) {
 
 static void sectionMapping(IO &IO, ELFYAML::NoBitsSection &Section) {
   commonSectionMapping(IO, Section);
-  IO.mapRequired("Size", Section.Size);
+  IO.mapOptional("Size", Section.Size, Hex64(0));
 }
 
 static void sectionMapping(IO &IO, ELFYAML::RelocationSection &Section) {
index a9d39c8cb5692808450f40ead1d84184c5cd3474..8054b23eb560bee2c5917370d36c899bc99f6fe2 100644 (file)
@@ -324,7 +324,6 @@ ELF-MIPS64EL-NEXT:   - Name:            .bss
 ELF-MIPS64EL-NEXT:     Type:            SHT_NOBITS
 ELF-MIPS64EL-NEXT:     Flags:           [ SHF_WRITE, SHF_ALLOC ]
 ELF-MIPS64EL-NEXT:     AddressAlign:    0x0000000000000010
-ELF-MIPS64EL-NEXT:     Size:            0x0000000000000000
 ELF-MIPS64EL-NEXT:   - Name:            .MIPS.options
 ELF-MIPS64EL-NEXT:     Type:            SHT_MIPS_OPTIONS
 ELF-MIPS64EL-NEXT:     Flags:           [ SHF_ALLOC ]