[llvm-commits] CVS: llvm/include/Support/ELF.h

Brian Gaeke gaeke at cs.uiuc.edu
Sun Feb 29 00:31:01 PST 2004


Changes in directory llvm/include/Support:

ELF.h updated: 1.2 -> 1.3

---
Log message:

Add more architectures, and ELF64 stuff.


---
Diffs of the changes:  (+49 -1)

Index: llvm/include/Support/ELF.h
diff -u llvm/include/Support/ELF.h:1.2 llvm/include/Support/ELF.h:1.3
--- llvm/include/Support/ELF.h:1.2	Sat Feb 28 16:06:03 2004
+++ llvm/include/Support/ELF.h	Sun Feb 29 00:30:25 2004
@@ -30,6 +30,16 @@
 typedef int32_t  Elf32_Sword;
 typedef uint32_t Elf32_Word;
 
+typedef uint64_t Elf64_Addr;
+typedef uint64_t Elf64_Off;
+typedef int32_t  Elf64_Shalf;
+typedef int32_t  Elf64_Sword;
+typedef uint32_t Elf64_Word;
+typedef int64_t  Elf64_Sxword;
+typedef uint64_t Elf64_Xword;
+typedef uint32_t Elf64_Half;
+typedef uint16_t Elf64_Quarter;
+
 // Object file magic string.
 static const char ElfMagic[] = { 0x7f, 'E', 'L', 'F', '\0' };
 
@@ -55,6 +65,25 @@
   unsigned char getDataEncoding () { return e_ident[5]; }
 };
 
+// 64-bit ELF header. Fields are the same as for ELF32, but with different
+// types (see above).
+typedef struct {
+  unsigned char e_ident[16];
+  Elf64_Quarter e_type;
+  Elf64_Quarter e_machine;
+  Elf64_Half    e_version;
+  Elf64_Addr    e_entry;
+  Elf64_Off     e_phoff;
+  Elf64_Off     e_shoff;
+  Elf64_Half    e_flags;
+  Elf64_Quarter e_ehsize;
+  Elf64_Quarter e_phentsize;
+  Elf64_Quarter e_phnum;
+  Elf64_Quarter e_shentsize;
+  Elf64_Quarter e_shnum;
+  Elf64_Quarter e_shstrndx;
+} Elf64_Ehdr;
+
 // File types
 enum {
   ET_NONE   = 0,      // No file type
@@ -74,8 +103,13 @@
   EM_386 = 3,   // Intel 386
   EM_68K = 4,   // Motorola 68000
   EM_88K = 5,   // Motorola 88000
+  EM_486 = 6,   // Intel 486 (deprecated)
   EM_860 = 7,   // Intel 80860
-  EM_MIPS = 8   // MIPS R3000
+  EM_MIPS = 8,     // MIPS R3000
+  EM_PPC = 20,     // PowerPC
+  EM_ARM = 40,     // ARM
+  EM_ALPHA = 41,   // DEC Alpha
+  EM_SPARCV9 = 43  // SPARC V9
 };
 
 // Object file classes.
@@ -103,6 +137,20 @@
   Elf32_Word sh_addralign; // Section address alignment
   Elf32_Word sh_entsize;   // Size of records contained within the section
 };
+
+// Section header for ELF64 - same fields as ELF32, different types.
+typedef struct {
+  Elf64_Half  sh_name;
+  Elf64_Half  sh_type;
+  Elf64_Xword sh_flags;
+  Elf64_Addr  sh_addr;
+  Elf64_Off   sh_offset;
+  Elf64_Xword sh_size;
+  Elf64_Half  sh_link;
+  Elf64_Half  sh_info;
+  Elf64_Xword sh_addralign;
+  Elf64_Xword sh_entsize;
+} Elf64_Shdr;
 
 // Special section indices.
 enum {





More information about the llvm-commits mailing list