GNUInfo.h revision d0fbbb227051be16931a1aa9b4a7722ac039c698
1//===- GNUInfo.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_GNU_INFO_H
10#define MCLD_TARGET_GNU_INFO_H
11#ifdef ENABLE_UNITTEST
12#include <gtest.h>
13#endif
14#include <llvm/ADT/Triple.h>
15#include <llvm/Support/ELF.h>
16
17namespace mcld {
18
19/** \class GNUInfo
20 *  \brief GNUInfo records ELF-dependent and target-dependnet data fields
21 */
22class GNUInfo
23{
24public:
25  GNUInfo(const llvm::Triple& pTriple);
26
27  virtual ~GNUInfo() { }
28
29  /// ELFVersion - the value of e_ident[EI_VERSION]
30  virtual uint8_t ELFVersion() const { return llvm::ELF::EV_CURRENT; }
31
32  /// The return value of machine() it the same as e_machine in the ELF header
33  virtual uint32_t machine() const = 0;
34
35  /// OSABI - the value of e_ident[EI_OSABI]
36  uint8_t OSABI() const;
37
38  /// ABIVersion - the value of e_ident[EI_ABIVRESION]
39  uint8_t ABIVersion() const { return 0x0; }
40
41private:
42  const llvm::Triple& m_Triple;
43};
44
45} // namespace of mcld
46
47#endif
48
49