Revert "[Object] .bss sections have no content. PR15005."

This reverts commit r173007.

llvm-svn: 173012
This commit is contained in:
Michael J. Spencer 2013-01-21 08:13:04 +00:00
parent b399118cad
commit a4f9924c79
1 changed files with 5 additions and 7 deletions

View File

@ -1260,18 +1260,16 @@ template<class ELFT>
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;
}