summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
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
commite4dd2e01323ab59dfb5766112fa34516f8fe6265 (patch)
tree6dc2e3effda59bb8126dd8daf757c4b81e047dba /llvm/lib/ExecutionEngine
parent119ad03c67ad93acb5830eb364ddd25abaa046e2 (diff)
downloadbcm5719-llvm-e4dd2e01323ab59dfb5766112fa34516f8fe6265.tar.gz
bcm5719-llvm-e4dd2e01323ab59dfb5766112fa34516f8fe6265.zip
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). llvm-svn: 180736
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp3
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp7
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h3
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h7
4 files changed, 2 insertions, 18 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
index 354795dc5f8..7b32db7f0e0 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
@@ -96,7 +96,8 @@ ObjectImage *RuntimeDyldImpl::loadObject(ObjectBuffer *InputBuffer) {
bool isCommon = flags & SymbolRef::SF_Common;
if (isCommon) {
// Add the common symbols to a list. We'll allocate them all below.
- uint64_t Align = getCommonSymbolAlignment(*i);
+ uint32_t Align;
+ Check(i->getAlignment(Align));
uint64_t Size = 0;
Check(i->getSize(Size));
CommonSize += Size + Align;
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
index ef4a4050e9e..c5bad8e4164 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
@@ -848,13 +848,6 @@ void RuntimeDyldELF::processRelocationRef(unsigned SectionID,
}
}
-unsigned RuntimeDyldELF::getCommonSymbolAlignment(const SymbolRef &Sym) {
- // In ELF, the value of an SHN_COMMON symbol is its alignment requirement.
- uint64_t Align;
- Check(Sym.getValue(Align));
- return Align;
-}
-
bool RuntimeDyldELF::isCompatibleFormat(const ObjectBuffer *Buffer) const {
if (Buffer->getBufferSize() < strlen(ELF::ElfMagic))
return false;
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
index b6ddf2d6a7a..102b1c6b593 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.h
@@ -68,9 +68,6 @@ class RuntimeDyldELF : public RuntimeDyldImpl {
int64_t Addend);
- unsigned getCommonSymbolAlignment(const SymbolRef &Sym);
-
-
uint64_t findPPC64TOC() const;
void findOPDEntrySection(ObjectImage &Obj,
ObjSectionToIDMap &LocalSections,
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
index 3211a1c7eaf..51873b1f4bf 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h
@@ -194,13 +194,6 @@ protected:
return (uint8_t*)Sections[SectionID].Address;
}
- // Subclasses can override this method to get the alignment requirement of
- // a common symbol. Returns no alignment requirement if not implemented.
- virtual unsigned getCommonSymbolAlignment(const SymbolRef &Sym) {
- return 0;
- }
-
-
void writeInt16BE(uint8_t *Addr, uint16_t Value) {
if (sys::IsLittleEndianHost)
Value = sys::SwapByteOrder(Value);
OpenPOWER on IntegriCloud