aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Object/ObjectFile.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-04-29 22:24:22 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-04-29 22:24:22 +0000
commit59a0e79631ed851d98cf9c2ba6fa5f9aafdfdc93 (patch)
treea910559464f8b9b14301d59fcb7948052071b3bd /include/llvm/Object/ObjectFile.h
parentd8b2da11360419a9f1d569468a9b2a8ca3dace20 (diff)
downloadexternal_llvm-59a0e79631ed851d98cf9c2ba6fa5f9aafdfdc93.zip
external_llvm-59a0e79631ed851d98cf9c2ba6fa5f9aafdfdc93.tar.gz
external_llvm-59a0e79631ed851d98cf9c2ba6fa5f9aafdfdc93.tar.bz2
Add getSymbolAlignment to the ObjectFile interface.
For regular object files this is only meaningful for common symbols. An object file format with direct support for atoms should be able to provide alignment information for all symbols. This replaces getCommonSymbolAlignment and fixes test-common-symbols-alignment.ll on darwin. This also includes a fix to MachOObjectFile::getSymbolFlags. It was marking undefined symbols as common (already tested by existing mcjit tests now that it is used). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Object/ObjectFile.h')
-rw-r--r--include/llvm/Object/ObjectFile.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h
index cbe7ec9..eb53cc0 100644
--- a/include/llvm/Object/ObjectFile.h
+++ b/include/llvm/Object/ObjectFile.h
@@ -217,6 +217,8 @@ public:
/// mapped).
error_code getAddress(uint64_t &Result) const;
error_code getFileOffset(uint64_t &Result) const;
+ /// @brief Get the alignment of this symbol as the actual value (not log 2).
+ error_code getAlignment(uint32_t &Result) const;
error_code getSize(uint64_t &Result) const;
error_code getType(SymbolRef::Type &Result) const;
@@ -292,6 +294,7 @@ protected:
virtual error_code getSymbolName(DataRefImpl Symb, StringRef &Res) const = 0;
virtual error_code getSymbolAddress(DataRefImpl Symb, uint64_t &Res) const = 0;
virtual error_code getSymbolFileOffset(DataRefImpl Symb, uint64_t &Res)const=0;
+ virtual error_code getSymbolAlignment(DataRefImpl Symb, uint32_t &Res) const;
virtual error_code getSymbolSize(DataRefImpl Symb, uint64_t &Res) const = 0;
virtual error_code getSymbolType(DataRefImpl Symb,
SymbolRef::Type &Res) const = 0;
@@ -425,6 +428,10 @@ inline error_code SymbolRef::getFileOffset(uint64_t &Result) const {
return OwningObject->getSymbolFileOffset(SymbolPimpl, Result);
}
+inline error_code SymbolRef::getAlignment(uint32_t &Result) const {
+ return OwningObject->getSymbolAlignment(SymbolPimpl, Result);
+}
+
inline error_code SymbolRef::getSize(uint64_t &Result) const {
return OwningObject->getSymbolSize(SymbolPimpl, Result);
}