MipsGNUInfo.h revision f7ac0f19a1c8d0ad14bcf6456ce368b830fea886
1//===- MipsGNUInfo.h ------------------------------------------------------===//
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#ifndef MCLD_TARGET_MIPS_GNU_INFO_H
10#define MCLD_TARGET_MIPS_GNU_INFO_H
11#include <mcld/Target/GNUInfo.h>
12
13#include <llvm/Support/ELF.h>
14
15namespace mcld {
16
17class MipsGNUInfo : public GNUInfo
18{
19public:
20  enum {
21    // The original o32 abi.
22    E_MIPS_ABI_O32    = 0x00001000,
23    // O32 extended to work on 64 bit architectures.
24    E_MIPS_ABI_O64    = 0x00002000,
25    // EABI in 32 bit mode.
26    E_MIPS_ABI_EABI32 = 0x00003000,
27    // EABI in 64 bit mode.
28    E_MIPS_ABI_EABI64 = 0x00004000
29  };
30
31public:
32  MipsGNUInfo(const llvm::Triple& pTriple) : GNUInfo(pTriple) { }
33
34  uint32_t machine() const { return llvm::ELF::EM_MIPS; }
35
36  uint64_t defaultTextSegmentAddr() const { return 0x80000; }
37
38  uint64_t flags() const
39  {
40    // TODO: (simon) The correct flag's set depend on command line
41    // arguments and flags from input .o files.
42    return llvm::ELF::EF_MIPS_ARCH_32R2 |
43           llvm::ELF::EF_MIPS_NOREORDER |
44           llvm::ELF::EF_MIPS_PIC |
45           llvm::ELF::EF_MIPS_CPIC |
46           E_MIPS_ABI_O32;
47  }
48
49  const char* entry() const { return "__start"; }
50
51  const char* dyld() const { return "/lib/ld.so.1"; }
52
53  uint64_t abiPageSize() const { return 0x10000; }
54};
55
56} // namespace of mcld
57
58#endif
59
60