diff options
author | Sven Gothel <[email protected]> | 2013-02-08 05:12:39 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-02-08 05:12:39 +0100 |
commit | 2432dbef17c1dc4164f055cf434073bdabf8a6a9 (patch) | |
tree | 348a46b246ead8bb508152a96847a62089b72d0c /make/stub_includes/os/elf_header.h | |
parent | 1118cb7182611d0a77764a3c781a1148849b3022 (diff) |
Bug 681: Add Basic ELF Header + ARM EABI Section Parsing, allowing to distinguish ARM soft-float/hard-float (part-1)
https://jogamp.org/bugzilla/show_bug.cgi?id=681
+ * References:
+ * <ul>
+ * <li>http://linux.die.net/man/5/elf</li>
+ * <li>http://www.sco.com/developers/gabi/latest/contents.html</li>
+ * <li>http://infocenter.arm.com/
+ * <ul>
+ * <li>ARM IHI 0044E, current through ABI release 2.09</li>
+ * <li>ARM IHI 0045D, current through ABI release 2.09</li>
+ * </ul></li>
Added self contained jogamp.common.os.elf package w/ entry point class ElfHeader
to read a RandomAccessFile and parse it as an ELF file.
ELF Parsing completness:
- Header: OK
- SectionHeader: OK
- Section Type SHT_ARM_ATTRIBUTES: OK
- Will be read into SectionArmAttributes
- Used to distinguisgh soft/hard VFP float
Tested manually on:
- Linux intel 32bit / 64bit, arm soft-float and hard-float
Diffstat (limited to 'make/stub_includes/os/elf_header.h')
-rw-r--r-- | make/stub_includes/os/elf_header.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/make/stub_includes/os/elf_header.h b/make/stub_includes/os/elf_header.h new file mode 100644 index 0000000..7d608f0 --- /dev/null +++ b/make/stub_includes/os/elf_header.h @@ -0,0 +1,60 @@ + +#include <gluegen_stddef.h> +#include <gluegen_stdint.h> + +// #define EI_NIDENT 16 + +// #define ElfN_Addr uintptr_t +// #define ElfN_Off size_t +typedef uintptr_t ElfN_Addr; +typedef size_t ElfN_Off; +typedef size_t ElfN_size; + +typedef struct { + unsigned char e_ident[16]; + uint16_t e_type; + uint16_t e_machine; + uint32_t e_version; + ElfN_Addr e_entry; + ElfN_Off e_phoff; + ElfN_Off e_shoff; + uint32_t e_flags; + uint16_t e_ehsize; + uint16_t e_phentsize; + uint16_t e_phnum; + uint16_t e_shentsize; + uint16_t e_shnum; + uint16_t e_shstrndx; +} Ehdr; + +typedef struct { + uint32_t sh_name; + uint32_t sh_type; + ElfN_size sh_flags; + ElfN_Addr sh_addr; + ElfN_Off sh_offset; + ElfN_size sh_size; + uint32_t sh_link; + uint32_t sh_info; + ElfN_size sh_addralign; + ElfN_size sh_entsize; +} Shdr; + +typedef struct { + uint32_t st_name; + ElfN_Addr st_value; + ElfN_size st_size; + uint8_t st_info; + uint8_t st_other; + uint16_t st_shndx; +} Sym32; + +typedef struct { + uint32_t st_name; + uint8_t st_info; + uint8_t st_other; + uint16_t st_shndx; + ElfN_Addr st_value; + ElfN_size st_size; +} Sym64; + |