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 //===----------------------------------------------------------------------===// MipsGNUInfo(const llvm::Triple & pTriple)16MipsGNUInfo::MipsGNUInfo(const llvm::Triple& pTriple) 17 : GNUInfo(pTriple), 18 m_ABIVersion(0), 19 m_PICFlags(0) 20 {} 21 setABIVersion(uint8_t ver)22void MipsGNUInfo::setABIVersion(uint8_t ver) 23 { 24 m_ABIVersion = ver; 25 } 26 setPICFlags(uint64_t flags)27void MipsGNUInfo::setPICFlags(uint64_t flags) 28 { 29 m_PICFlags = flags; 30 } 31 machine() const32uint32_t MipsGNUInfo::machine() const 33 { 34 return llvm::ELF::EM_MIPS; 35 } 36 ABIVersion() const37uint8_t MipsGNUInfo::ABIVersion() const 38 { 39 return m_ABIVersion; 40 } 41 defaultTextSegmentAddr() const42uint64_t MipsGNUInfo::defaultTextSegmentAddr() const 43 { 44 if (m_Triple.isArch32Bit()) 45 return 0x400000; 46 else 47 return 0x120000000ull; 48 } 49 flags() const50uint64_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 entry() const62const char* MipsGNUInfo::entry() const 63 { 64 return "__start"; 65 } 66 dyld() const67const char* MipsGNUInfo::dyld() const 68 { 69 return m_Triple.isArch32Bit() ? "/lib/ld.so.1" : "/lib64/ld.so.1"; 70 } 71 abiPageSize() const72uint64_t MipsGNUInfo::abiPageSize() const 73 { 74 return 0x10000; 75 } 76 77 } // end mcld namespace 78