diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-10 21:55:43 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2011-10-10 21:55:43 +0000 |
commit | 7989460a1fba308128a7993cbabd178d2cc5ffa8 (patch) | |
tree | 9a9140e6b83555d05c3eed2d27d8164545654f5f /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 55b4e5c208d614c71347d74069ff5a70a6c4ddcf (diff) | |
download | llvm-7989460a1fba308128a7993cbabd178d2cc5ffa8.zip llvm-7989460a1fba308128a7993cbabd178d2cc5ffa8.tar.gz llvm-7989460a1fba308128a7993cbabd178d2cc5ffa8.tar.bz2 |
Object: add getSectionAlignment.
llvm-svn: 141581
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 6a6870a..16e9d14 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -337,6 +337,7 @@ protected: virtual error_code getSectionAddress(DataRefImpl Sec, uint64_t &Res) const; virtual error_code getSectionSize(DataRefImpl Sec, uint64_t &Res) const; virtual error_code getSectionContents(DataRefImpl Sec, StringRef &Res) const; + virtual error_code getSectionAlignment(DataRefImpl Sec, uint64_t &Res) const; virtual error_code isSectionText(DataRefImpl Sec, bool &Res) const; virtual error_code isSectionData(DataRefImpl Sec, bool &Res) const; virtual error_code isSectionBSS(DataRefImpl Sec, bool &Res) const; @@ -673,6 +674,15 @@ error_code ELFObjectFile<target_endianness, is64Bits> template<support::endianness target_endianness, bool is64Bits> error_code ELFObjectFile<target_endianness, is64Bits> + ::getSectionAlignment(DataRefImpl Sec, + uint64_t &Result) const { + const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p); + Result = sec->sh_addralign; + return object_error::success; +} + +template<support::endianness target_endianness, bool is64Bits> +error_code ELFObjectFile<target_endianness, is64Bits> ::isSectionText(DataRefImpl Sec, bool &Result) const { const Elf_Shdr *sec = reinterpret_cast<const Elf_Shdr *>(Sec.p); |