diff options
Diffstat (limited to 'include/llvm/Target')
-rw-r--r-- | include/llvm/Target/TargetELFWriterInfo.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetELFWriterInfo.h b/include/llvm/Target/TargetELFWriterInfo.h index 6037826..f7e3392 100644 --- a/include/llvm/Target/TargetELFWriterInfo.h +++ b/include/llvm/Target/TargetELFWriterInfo.h @@ -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 |