Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject...
[oota-llvm.git] / include / llvm / Target / TargetELFWriterInfo.h
index 60378265552781499d19ade964fd4114ae36f6c6..f7e3392577d9d50cb1d3885b0de708f990272491 100644 (file)
@@ -29,6 +29,7 @@ namespace llvm {
     // e_machine member of the ELF header.
     unsigned short EMachine;
     TargetMachine &TM;
+    bool is64Bit, isLittleEndian;
   public:
 
     // Machine architectures
@@ -49,10 +50,35 @@ namespace llvm {
       EM_X86_64 = 62   // AMD64
     };
 
+    // ELF File classes
+    enum {
+      ELFCLASS32 = 1, // 32-bit object file
+      ELFCLASS64 = 2  // 64-bit object file
+    };
+
+    // ELF Endianess
+    enum {
+      ELFDATA2LSB = 1, // Little-endian object file
+      ELFDATA2MSB = 2  // Big-endian object file
+    };
+
     explicit TargetELFWriterInfo(TargetMachine &tm);
     virtual ~TargetELFWriterInfo();
 
     unsigned short getEMachine() const { return EMachine; }
+    unsigned getEFlags() const { return 0; }
+    unsigned getEIClass() const { return is64Bit ? ELFCLASS64 : ELFCLASS32; }
+    unsigned getEIData() const {
+      return isLittleEndian ? ELFDATA2LSB : ELFDATA2MSB;
+    }
+
+    /// ELF Header and ELF Section Header Info
+    unsigned getHdrSize() const { return is64Bit ? 64 : 52; }
+    unsigned getSHdrSize() const { return is64Bit ? 64 : 40; }
+
+    /// Symbol Table Info
+    unsigned getSymTabEntrySize() const { return is64Bit ? 24 : 16; }
+    unsigned getSymTabAlignment() const { return is64Bit ? 8 : 4; }
 
     /// getFunctionAlignment - Returns the alignment for function 'F', targets
     /// with different alignment constraints should overload this method