diff options
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r-- | lld/ELF/Writer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 514b21a5826..86915f31beb 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1760,10 +1760,13 @@ template <class ELFT> void Writer<ELFT>::setPhdrs() { } } -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 @@ template <class ELFT> void Writer<ELFT>::writeHeader() { 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); |