summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMatheus Almeida <matheus.almeida@imgtec.com>2014-01-28 19:24:11 +0000
committerMatheus Almeida <matheus.almeida@imgtec.com>2014-01-28 19:24:11 +0000
commit4ed4bd0feec4dbf23282e6fbbb360c60b3a98052 (patch)
tree23f3efd72448ac70a2269661cf6fc50e3b65cd9e /lib
parent1c71a20f32b6c6af85fb26d56b26effe71c710b9 (diff)
downloadllvm-4ed4bd0feec4dbf23282e6fbbb360c60b3a98052.tar.gz
llvm-4ed4bd0feec4dbf23282e6fbbb360c60b3a98052.tar.bz2
llvm-4ed4bd0feec4dbf23282e6fbbb360c60b3a98052.tar.xz
[mips] Fix ELF header flags.
As opposed to GCC/GAS the default ABI for Mips64 is n64. Compatibility bit should be set if o32 ABI is used when targeting Mips64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200332 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
index 0dec292908..41b8ad6b96 100644
--- a/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
+++ b/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
@@ -137,7 +137,14 @@ MipsTargetELFStreamer::MipsTargetELFStreamer(MCStreamer &S,
EFlags |= ELF::EF_MIPS_ARCH_32;
if (T.isArch64Bit()) {
- EFlags |= ELF::EF_MIPS_ABI2;
+ if (Features & Mips::FeatureN32)
+ EFlags |= ELF::EF_MIPS_ABI2;
+ else if (Features & Mips::FeatureO32) {
+ EFlags |= ELF::EF_MIPS_ABI_O32;
+ EFlags |= ELF::EF_MIPS_32BITMODE; /* Compatibility Mode */
+ }
+ // No need to set any bit for N64 which is the default ABI at the moment
+ // for 64-bit Mips architectures.
} else {
if (Features & Mips::FeatureMips64r2 || Features & Mips::FeatureMips64)
EFlags |= ELF::EF_MIPS_32BITMODE;