Usermode/libc++ - Implement map::insert and map::erase
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / elf32.h
index 0808747..40c801c 100644 (file)
@@ -12,6 +12,7 @@ typedef uint16_t      Elf32_Half;
 typedef uint32_t       Elf32_Addr;
 typedef uint32_t       Elf32_Off;
 typedef uint32_t       Elf32_Word;
+typedef uint32_t       Elf32_Xword;    // < not strictly correct... but meh
 typedef int32_t        Elf32_Sword;
 
 #define ELFCLASS32     1
@@ -26,19 +27,19 @@ typedef int32_t     Elf32_Sword;
 */
 struct sElf32_Ehdr {
        uint8_t e_ident[16];    //!< Identifier Bytes
-       Elf32_Half      filetype;       //!< File Type
-       Elf32_Half      machine;        //!< Machine / Arch
-       Elf32_Word      version;        //!< Version (File?)
-       Elf32_Addr      entrypoint;     //!< Entry Point
-       Elf32_Off       phoff;  //!< Program Header Offset
-       Elf32_Word      shoff;  //!< Section Header Offset
-       Elf32_Word      flags;  //!< Flags
-       Elf32_Half      headersize;     //!< Header Size
-       Elf32_Half      phentsize;      //!< Program Header Entry Size
-       Elf32_Half      phentcount;     //!< Program Header Entry Count
-       Elf32_Half      shentsize;      //!< Section Header Entry Size
-       Elf32_Half      shentcount;     //!< Section Header Entry Count
-       Elf32_Half      shstrindex;     //!< Section Header String Table Index
+       Elf32_Half      e_filetype;     //!< File Type
+       Elf32_Half      e_machine;      //!< Machine / Arch
+       Elf32_Word      e_version;      //!< Version (File?)
+       Elf32_Addr      e_entry;        //!< Entry Point
+       Elf32_Off       e_phoff;        //!< Program Header Offset
+       Elf32_Word      e_shoff;        //!< Section Header Offset
+       Elf32_Word      e_flags;        //!< Flags
+       Elf32_Half      e_headersize;   //!< Header Size
+       Elf32_Half      e_phentsize;    //!< Program Header Entry Size
+       Elf32_Half      e_phnum;        //!< Program Header Entry Count
+       Elf32_Half      e_shentsize;    //!< Section Header Entry Size
+       Elf32_Half      e_shentcount;   //!< Section Header Entry Count
+       Elf32_Half      e_shstrindex;   //!< Section Header String Table Index
 };
 
 /**
@@ -112,15 +113,24 @@ struct sElf32_Shent {
 #endif
 
 struct elf_sym_s {
-       Elf32_Word      nameOfs;
-       Elf32_Addr      value;  //Address
-       Elf32_Word      size;
-       uint8_t info;
-       uint8_t other;
-       Elf32_Half      shndx;
+       Elf32_Word      st_name;
+       Elf32_Addr      st_value;       //Address
+       Elf32_Word      st_size;
+       uint8_t         st_info;
+       uint8_t         st_other;
+       Elf32_Half      st_shndx;
 };
 #define        STN_UNDEF       0       // Undefined Symbol
 
+#define ELF32_ST_BIND(i)       ((i)>>4)
+#define ELF32_ST_TYPE(i)       ((i)&0xF)
+
+enum {
+       STB_LOCAL,
+       STB_GLOBAL,
+       STB_WEAK,
+};
+
 enum {
        PT_NULL,        //0
        PT_LOAD,        //1
@@ -133,15 +143,19 @@ enum {
        PT_HIPROC = 0x7fffffff
 };
 
+#define PF_X   1
+#define PF_W   2
+#define PF_R   4
+
 struct sElf32_Phdr {
-       Elf32_Word      Type;
-       Elf32_Off       Offset;
-       Elf32_Addr      VAddr;
-       Elf32_Addr      PAddr;
-       Elf32_Word      FileSize;
-       Elf32_Word      MemSize;
-       Elf32_Word      Flags;
-       Elf32_Word      Align;
+       Elf32_Word      p_type;
+       Elf32_Off       p_offset;
+       Elf32_Addr      p_vaddr;
+       Elf32_Addr      p_paddr;
+       Elf32_Word      p_filesz;
+       Elf32_Word      p_memsz;
+       Elf32_Word      p_flags;
+       Elf32_Word      p_align;
 };
 
 struct elf32_rel_s {
@@ -174,30 +188,30 @@ enum {
 //  'T' means the thumb bit
 //  'B(S)' Origin of a symbol
 enum {
-       R_ARM_NONE,     // No action
-       R_ARM_PC24,     // ((S + A) | T) - P
-       R_ARM_ABS32,    // (S + A) | T
-       R_ARM_REL32,    // ((S + A) | T) - P
-       R_ARM_LDR_PC_G0,        // S + A - P
-       R_ARM_ABS16,    // S + A
-       R_ARM_ABS12,    // S + A
-       R_ARM_THM_ABS5, // S + A
-       R_ARM_ABS8,     // S + A
-       R_ARM_SBREL32,  // ((S + A) | T) - B(S)
-       R_ARM_THM_CALL, // ((S + A) | T) - P
-       R_ARM_THM_PC8,  // S + A - Pa,
-       R_ARM_BREL_ADJ, // ΔB(S) + A
-       R_ARM_TLS_DESC, // --
-       R_ARM_THM_SWI8, // (Reserved)
-       R_ARM_XPC25,    // (Reserved)
-       R_ARM_THM_XPC22,        // (Reserved)
-       R_ARM_TLS_DTPMOD32,     // Module[S]
-       R_ARM_TLS_DTPOFF32,     // S + A - TLS
-       R_ARM_TLS_TPOFF32,      // S + A - tp
-       R_ARM_COPY,     // Misc
-       R_ARM_GLOB_DAT, // (S + A) | T
-       R_ARM_JUMP_SLOT,        // (S + A) | T
-       R_ARM_RELATIVE, // B(S) + A (extra?)
+       R_ARM_NONE,     //  0 No action
+       R_ARM_PC24,     //  1 ((S + A) | T) - P
+       R_ARM_ABS32,    //  2 (S + A) | T
+       R_ARM_REL32,    //  3 ((S + A) | T) - P
+       R_ARM_LDR_PC_G0,        //  4 S + A - P
+       R_ARM_ABS16,    //  5 S + A
+       R_ARM_ABS12,    //  6 S + A
+       R_ARM_THM_ABS5, //  7 S + A
+       R_ARM_ABS8,     //  8 S + A
+       R_ARM_SBREL32,  //  9 ((S + A) | T) - B(S)
+       R_ARM_THM_CALL, // 10 ((S + A) | T) - P
+       R_ARM_THM_PC8,  // 11 S + A - Pa,
+       R_ARM_BREL_ADJ, // 12 ΔB(S) + A
+       R_ARM_TLS_DESC, // 13 --
+       R_ARM_THM_SWI8, // 14 (Reserved)
+       R_ARM_XPC25,    // 15 (Reserved)
+       R_ARM_THM_XPC22,        // 16 (Reserved)
+       R_ARM_TLS_DTPMOD32,     // 17 Module[S]
+       R_ARM_TLS_DTPOFF32,     // 18 S + A - TLS
+       R_ARM_TLS_TPOFF32,      // 19 S + A - tp
+       R_ARM_COPY,     // 20 Misc
+       R_ARM_GLOB_DAT, // 21 (S + A) | T
+       R_ARM_JUMP_SLOT,        // 22 (S + A) | T
+       R_ARM_RELATIVE, // 23 B(S) + A (extra?)
        // ... More defined (IHI0044)
 };
 

UCC git Repository :: git.ucc.asn.au