[llvm-commits] [llvm] r173012 - /llvm/trunk/include/llvm/Object/ELF.h

Michael J. Spencer bigcheesegs at gmail.com
Mon Jan 21 00:13:04 PST 2013


Author: mspencer
Date: Mon Jan 21 02:13:04 2013
New Revision: 173012

URL: http://llvm.org/viewvc/llvm-project?rev=173012&view=rev
Log:
Revert "[Object] .bss sections have no content. PR15005."

This reverts commit r173007.

Modified:
    llvm/trunk/include/llvm/Object/ELF.h

Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=173012&r1=173011&r2=173012&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Mon Jan 21 02:13:04 2013
@@ -1260,18 +1260,16 @@
 error_code ELFObjectFile<ELFT>::getSectionContents(DataRefImpl Sec,
                                                    StringRef &Result) const {
   const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
-  return getSectionContents(sec, Result);
+  const char *start = (const char*)base() + sec->sh_offset;
+  Result = StringRef(start, sec->sh_size);
+  return object_error::success;
 }
 
 template<class ELFT>
 error_code ELFObjectFile<ELFT>::getSectionContents(const Elf_Shdr *Sec,
                                                    StringRef &Result) const {
-  if (Sec->sh_type == ELF::SHT_NOBITS)
-    Result = StringRef();
-  else {
-    const char *start = (const char*)base() + Sec->sh_offset;
-    Result = StringRef(start, Sec->sh_size);
-  }
+  const char *start = (const char*)base() + Sec->sh_offset;
+  Result = StringRef(start, Sec->sh_size);
   return object_error::success;
 }
 





More information about the llvm-commits mailing list