Home | History | Annotate | Download | only in Mips
      1 //===- MipsGNUInfo.cpp ----------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #include "MipsGNUInfo.h"
     10 
     11 namespace mcld {
     12 
     13 //===----------------------------------------------------------------------===//
     14 // MipsGNUInfo
     15 //===----------------------------------------------------------------------===//
     16 MipsGNUInfo::MipsGNUInfo(const llvm::Triple& pTriple)
     17     : GNUInfo(pTriple), m_ABIVersion(0), m_PICFlags(0) {
     18 }
     19 
     20 void MipsGNUInfo::setABIVersion(uint8_t ver) {
     21   m_ABIVersion = ver;
     22 }
     23 
     24 void MipsGNUInfo::setPICFlags(uint64_t flags) {
     25   m_PICFlags = flags;
     26 }
     27 
     28 uint32_t MipsGNUInfo::machine() const {
     29   return llvm::ELF::EM_MIPS;
     30 }
     31 
     32 uint8_t MipsGNUInfo::ABIVersion() const {
     33   return m_ABIVersion;
     34 }
     35 
     36 uint64_t MipsGNUInfo::defaultTextSegmentAddr() const {
     37   if (m_Triple.isArch32Bit())
     38     return 0x400000;
     39   else
     40     return 0x120000000ull;
     41 }
     42 
     43 uint64_t MipsGNUInfo::flags() const {
     44   uint64_t val = llvm::ELF::EF_MIPS_NOREORDER | m_PICFlags;
     45 
     46   if (m_Triple.isArch32Bit())
     47     val |= llvm::ELF::EF_MIPS_ARCH_32R2 | llvm::ELF::EF_MIPS_ABI_O32;
     48   else
     49     val |= llvm::ELF::EF_MIPS_ARCH_64R2;
     50 
     51   return val;
     52 }
     53 
     54 const char* MipsGNUInfo::entry() const {
     55   return "__start";
     56 }
     57 
     58 const char* MipsGNUInfo::dyld() const {
     59   return m_Triple.isArch32Bit() ? "/lib/ld.so.1" : "/lib64/ld.so.1";
     60 }
     61 
     62 uint64_t MipsGNUInfo::abiPageSize() const {
     63   return 0x10000;
     64 }
     65 
     66 }  // namespace mcld
     67