From a4f9924c796b0b89f54b9514ac553b84737136c6 Mon Sep 17 00:00:00 2001 From: "Michael J. Spencer" Date: Mon, 21 Jan 2013 08:13:04 +0000 Subject: [PATCH] Revert "[Object] .bss sections have no content. PR15005." This reverts commit r173007. llvm-svn: 173012 --- llvm/include/llvm/Object/ELF.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 5409fc3..136fdf5 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -1260,18 +1260,16 @@ template error_code ELFObjectFile::getSectionContents(DataRefImpl Sec, StringRef &Result) const { const Elf_Shdr *sec = reinterpret_cast(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 error_code ELFObjectFile::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; } -- 2.7.4