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),
     18     m_ABIVersion(0),
     19     m_PICFlags(0)
     20 {}
     21 
     22 void MipsGNUInfo::setABIVersion(uint8_t ver)
     23 {
     24   m_ABIVersion = ver;
     25 }
     26 
     27 void MipsGNUInfo::setPICFlags(uint64_t flags)
     28 {
     29   m_PICFlags = flags;
     30 }
     31 
     32 uint32_t MipsGNUInfo::machine() const
     33 {
     34   return llvm::ELF::EM_MIPS;
     35 }
     36 
     37 uint8_t MipsGNUInfo::ABIVersion() const
     38 {
     39   return m_ABIVersion;
     40 }
     41 
     42 uint64_t MipsGNUInfo::defaultTextSegmentAddr() const
     43 {
     44   if (m_Triple.isArch32Bit())
     45     return 0x400000;
     46   else
     47     return 0x120000000ull;
     48 }
     49 
     50 uint64_t MipsGNUInfo::flags() const
     51 {
     52   uint64_t val = llvm::ELF::EF_MIPS_NOREORDER | m_PICFlags;
     53 
     54   if (m_Triple.isArch32Bit())
     55     val |= llvm::ELF::EF_MIPS_ARCH_32R2 | llvm::ELF::EF_MIPS_ABI_O32;
     56   else
     57     val |= llvm::ELF::EF_MIPS_ARCH_64R2;
     58 
     59   return val;
     60 }
     61 
     62 const char* MipsGNUInfo::entry() const
     63 {
     64   return "__start";
     65 }
     66 
     67 const char* MipsGNUInfo::dyld() const
     68 {
     69   return m_Triple.isArch32Bit() ? "/lib/ld.so.1" : "/lib64/ld.so.1";
     70 }
     71 
     72 uint64_t MipsGNUInfo::abiPageSize() const
     73 {
     74   return 0x10000;
     75 }
     76 
     77 } // end mcld namespace
     78