summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2013-01-21 06:46:11 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2013-01-21 06:46:11 +0000
commitc47de41e029df085b7d705ec41739e8d2de8059f (patch)
tree9d72d2853cc542ab03a700d4387461bde527aa7f
parent5c84c25bf41b50a1e3b6d39ad4f5ad3f9d40a003 (diff)
downloadbcm5719-llvm-c47de41e029df085b7d705ec41739e8d2de8059f.tar.gz
bcm5719-llvm-c47de41e029df085b7d705ec41739e8d2de8059f.zip
[Object] .bss sections have no content. PR15005.
llvm-svn: 173007
-rw-r--r--llvm/include/llvm/Object/ELF.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h
index 136fdf5e5e7..5409fc3ae59 100644
--- a/llvm/include/llvm/Object/ELF.h
+++ b/llvm/include/llvm/Object/ELF.h
@@ -1260,16 +1260,18 @@ template<class ELFT>
error_code ELFObjectFile<ELFT>::getSectionContents(DataRefImpl Sec,
StringRef &Result) const {
const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p);
- const char *start = (const char*)base() + sec->sh_offset;
- Result = StringRef(start, sec->sh_size);
- return object_error::success;
+ return getSectionContents(sec, Result);
}
template<class ELFT>
error_code ELFObjectFile<ELFT>::getSectionContents(const Elf_Shdr *Sec,
StringRef &Result) const {
- const char *start = (const char*)base() + Sec->sh_offset;
- Result = StringRef(start, Sec->sh_size);
+ 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);
+ }
return object_error::success;
}
OpenPOWER on IntegriCloud