• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- MipsAbiFlags.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 TARGET_MIPS_MIPSABIFLAGS_H_
10 #define TARGET_MIPS_MIPSABIFLAGS_H_
11 
12 #include "mcld/Support/MemoryRegion.h"
13 
14 #include <llvm/ADT/Optional.h>
15 #include <llvm/Object/ELFTypes.h>
16 
17 namespace mcld {
18 
19 class Input;
20 class LDSection;
21 
22 /** \class MipsAbiFlags
23  *  \brief Representation of .MIPS.abiflags section.
24  */
25 class MipsAbiFlags {
26  public:
27   /// size of underlaid ELF section structure
28   static uint64_t size();
29 
30   /// write ELF section structure to the memory region
31   static uint64_t emit(const MipsAbiFlags& pInfo, MemoryRegion& pRegion);
32 
33   /// fill the structure by the data from the input section
34   static bool fillBySection(const Input& pInput, const LDSection& pSection,
35                             MipsAbiFlags& mipsAbi);
36 
37   /// fill the structure by the data from ELF header flags
38   static bool fillByElfFlags(const Input& pInput, uint64_t elfFlags,
39                              MipsAbiFlags& mipsAbi);
40 
41   /// check compatibility between two structures
42   static bool isCompatible(const Input& pInput, const MipsAbiFlags& elf,
43                            const MipsAbiFlags& abi);
44 
45   /// merge new abi settings to the old structure
46   static bool merge(const Input& pInput, MipsAbiFlags& oldFlags,
47                     const MipsAbiFlags& newFlags);
48 
49  private:
50   uint32_t m_IsaLevel;
51   uint32_t m_IsaRev;
52   uint32_t m_IsaExt;
53   uint32_t m_GprSize;
54   uint32_t m_Cpr1Size;
55   uint32_t m_Cpr2Size;
56   uint32_t m_FpAbi;
57   uint32_t m_Ases;
58   uint32_t m_Flags1;
59 };
60 
61 }  // namespace mcld
62 
63 #endif  // TARGET_MIPS_MIPSABIFLAGS_H_
64