summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatheus Almeida <matheus.almeida@imgtec.com>2014-04-30 11:21:10 +0000
committerMatheus Almeida <matheus.almeida@imgtec.com>2014-04-30 11:21:10 +0000
commit737de9db8ee23d1b953aa147b6b36a18f30920f6 (patch)
treea9fc170dc2b764e04fb00a6d50cb745b22edfdb4 /include
parentebde5a5e49a662cd9191041306443b7116034c52 (diff)
downloadllvm-737de9db8ee23d1b953aa147b6b36a18f30920f6.tar.gz
llvm-737de9db8ee23d1b953aa147b6b36a18f30920f6.tar.bz2
llvm-737de9db8ee23d1b953aa147b6b36a18f30920f6.tar.xz
[mips] Emit all three relocation operations for each relocation entry on Mips64 big-endian systems.
Summary: The N64 ABI allows up to three operations to be specified per relocation record independently of the endianness. Reviewers: dsanders Reviewed By: dsanders Differential Revision: http://reviews.llvm.org/D3529 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207636 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Object/ELF.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h
index bc9cc673cb..a9989c2a80 100644
--- a/include/llvm/Object/ELF.h
+++ b/include/llvm/Object/ELF.h
@@ -317,6 +317,11 @@ public:
ELFFile(MemoryBuffer *Object, error_code &ec);
+ bool isMipsELF64() const {
+ return Header->e_machine == ELF::EM_MIPS &&
+ Header->getFileClass() == ELF::ELFCLASS64;
+ }
+
bool isMips64EL() const {
return Header->e_machine == ELF::EM_MIPS &&
Header->getFileClass() == ELF::ELFCLASS64 &&
@@ -537,10 +542,16 @@ StringRef ELFFile<ELFT>::getRelocationTypeName(uint32_t Type) const {
template <class ELFT>
void ELFFile<ELFT>::getRelocationTypeName(uint32_t Type,
SmallVectorImpl<char> &Result) const {
- if (!isMips64EL()) {
+ if (!isMipsELF64()) {
StringRef Name = getRelocationTypeName(Type);
Result.append(Name.begin(), Name.end());
} else {
+ // The Mips N64 ABI allows up to three operations to be specified per
+ // relocation record. Unfortunately there's no easy way to test for the
+ // presence of N64 ELFs as they have no special flag that identifies them
+ // as being N64. We can safely assume at the moment that all Mips
+ // ELFCLASS64 ELFs are N64. New Mips64 ABIs should provide enough
+ // information to disambiguate between old vs new ABIs.
uint8_t Type1 = (Type >> 0) & 0xFF;
uint8_t Type2 = (Type >> 8) & 0xFF;
uint8_t Type3 = (Type >> 16) & 0xFF;