[ELF][MIPS] Accept MIPS 64-bit binaries
LLD accepts MIPS 64-bit binaries, supports corresponding eulation (-m)
arguments and emits 64-bit specific ELF flags.
llvm-svn: 268024
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 514b21a..86915f3 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1760,10 +1760,13 @@
}
}
-static uint32_t getMipsEFlags() {
+static uint32_t getMipsEFlags(bool Is64Bits) {
// FIXME: In fact ELF flags depends on ELF flags of input object files
// and selected emulation. For now just use hard coded values.
- uint32_t V = EF_MIPS_ABI_O32 | EF_MIPS_CPIC | EF_MIPS_ARCH_32R2;
+ if (Is64Bits)
+ return EF_MIPS_CPIC | EF_MIPS_PIC | EF_MIPS_ARCH_64R2;
+
+ uint32_t V = EF_MIPS_CPIC | EF_MIPS_ABI_O32 | EF_MIPS_ARCH_32R2;
if (Config->Shared)
V |= EF_MIPS_PIC;
return V;
@@ -1844,7 +1847,7 @@
EHdr->e_shstrndx = Out<ELFT>::ShStrTab->SectionIndex;
if (Config->EMachine == EM_MIPS)
- EHdr->e_flags = getMipsEFlags();
+ EHdr->e_flags = getMipsEFlags(ELFT::Is64Bits);
if (!Config->Relocatable) {
EHdr->e_phoff = sizeof(Elf_Ehdr);