Fix bits check in ELFObjectFile::isSectionZeroInit().
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 31 Dec 2012 18:20:51 +0000 (18:20 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 31 Dec 2012 18:20:51 +0000 (18:20 +0000)
Fixes PR14723.

Patch by Sami Liedes!

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

include/llvm/Object/ELF.h
test/Object/readobj-shared-object.test

index 163478980961e529ecb98a284895d83eb7c3ab28..fcd77c74ab2f4beea82a852be5a13db574d6cce2 100644 (file)
@@ -1306,10 +1306,7 @@ error_code ELFObjectFile<target_endianness, is64Bits>
   const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
   // For ELF, all zero-init sections are virtual (that is, they occupy no space
   //   in the object image) and vice versa.
-  if (sec->sh_flags & ELF::SHT_NOBITS)
-    Result = true;
-  else
-    Result = false;
+  Result = sec->sh_type == ELF::SHT_NOBITS;
   return object_error::success;
 }
 
index c1dd15b1f9989a917f468ce85ed6b6c9e4d90079..3065c6f63655868d823052d5731b6380d56809e2 100644 (file)
@@ -65,7 +65,7 @@ ELF:  .tdata                      {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  d
 ELF:  .dynamic                    {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  required
 ELF:  .got.plt                    {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  data,required
 ELF:  .data                       {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  data,required
-ELF:  .bss                        {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[a-z,]*}}
+ELF:  .bss                        {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  bss,required,virtual,zeroinit
 ELF:  .shstrtab                   {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  rodata
 ELF:  .symtab                     {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  rodata
 ELF:  .strtab                     {{[0-9a-f]+}}  {{[0-9a-f]+}}  {{[0-9a-f]+}}  rodata