[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
This commit is contained in:
Matheus Almeida
2014-01-28 19:24:11 +00:00
parent 1c71a20f32
commit 4ed4bd0fee
2 changed files with 31 additions and 4 deletions

View File

@@ -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;