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