diff options
author | Sven Gothel <[email protected]> | 2015-02-01 05:21:39 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-02-01 05:21:39 +0100 |
commit | a3f2d08801c5a54048faca52f422bcededf81b2a (patch) | |
tree | 96e83956b62ae3e25043ccc67f4cb1c2c1f232a1 /make/elf-header.cfg | |
parent | 0deceee37d943faa7c34971388863a27f395d6a5 (diff) |
Bug 1125 - Make ELF Reader 'jogamp.common.os.elf' Stateless
ELF Reader 'jogamp.common.os.elf' currently uses
Platform's pre-determined OS_TYPE and CPUType.
It also uses the host platforms MachineDescription,
hence can not read ELF files from other machines.
This also forbids Platform to determine CPUType etc
w/o having a valid 'os.arch' property.
+++
ElfHeader should be split in
- ElfHeaderPart1 (CPUType independent)
- ElfHeaderPart2 (CPUType dependent)
Fix shall make the ELF Reader self containing
by only using ELF CPUType data, etc.
This requires customization of struct parsing,
where MachineDescription.Static index shall be
- defined in ElfHeaderPart1 using e_Ident's CPUType.
- used in ElfHeaderPart2 and all its struct types.
Diffstat (limited to 'make/elf-header.cfg')
-rw-r--r-- | make/elf-header.cfg | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/make/elf-header.cfg b/make/elf-header.cfg index 05c7d79..53da3f6 100644 --- a/make/elf-header.cfg +++ b/make/elf-header.cfg @@ -6,7 +6,61 @@ HierarchicalNativeOutput false #Implements Sym32 Sym #Implements Sym64 Sym -EmitStruct Ehdr +# ELF-1 (part-1) is independent of CPUType/ABI +# hence can use an arbitrary MachineDescriptor index +# for reading the struct Ehdr_p1 ! +StructMachineDescriptorIndex Ehdr_p1 private static final int mdIdx = 0; + +# The following sub structures shall use an mdIdx +# defined by ELF-1 header code, set w/ ctor! +StructMachineDescriptorIndex Ehdr_p2 private final int mdIdx; +StructMachineDescriptorIndex Shdr private final int mdIdx; + +ManuallyImplement Ehdr_p2.size +ManuallyImplement Ehdr_p2.create +ManuallyImplement Ehdr_p2.Ehdr_p2 +ManuallyImplement Shdr.size +ManuallyImplement Shdr.create +ManuallyImplement Shdr.Shdr + +CustomJavaCode Ehdr_p2 public static int size(final int mdIdx) { +CustomJavaCode Ehdr_p2 return Ehdr_p2_size[mdIdx]; +CustomJavaCode Ehdr_p2 } +CustomJavaCode Ehdr_p2 +CustomJavaCode Ehdr_p2 public static Ehdr_p2 create(final int mdIdx) { +CustomJavaCode Ehdr_p2 return create(mdIdx, Buffers.newDirectByteBuffer(size(mdIdx))); +CustomJavaCode Ehdr_p2 } +CustomJavaCode Ehdr_p2 +CustomJavaCode Ehdr_p2 public static Ehdr_p2 create(final int mdIdx, final java.nio.ByteBuffer buf) { +CustomJavaCode Ehdr_p2 return new Ehdr_p2(mdIdx, buf); +CustomJavaCode Ehdr_p2 } +CustomJavaCode Ehdr_p2 +CustomJavaCode Ehdr_p2 Ehdr_p2(final int mdIdx, final java.nio.ByteBuffer buf) { +CustomJavaCode Ehdr_p2 this.mdIdx = mdIdx; +CustomJavaCode Ehdr_p2 this.md = MachineDescription.StaticConfig.values()[mdIdx].md; +CustomJavaCode Ehdr_p2 this.accessor = new StructAccessor(buf); +CustomJavaCode Ehdr_p2 } + +CustomJavaCode Shdr public static int size(final int mdIdx) { +CustomJavaCode Shdr return Shdr_size[mdIdx]; +CustomJavaCode Shdr } +CustomJavaCode Shdr +CustomJavaCode Shdr public static Shdr create(final int mdIdx) { +CustomJavaCode Shdr return create(mdIdx, Buffers.newDirectByteBuffer(size(mdIdx))); +CustomJavaCode Shdr } +CustomJavaCode Shdr +CustomJavaCode Shdr public static Shdr create(final int mdIdx, final java.nio.ByteBuffer buf) { +CustomJavaCode Shdr return new Shdr(mdIdx, buf); +CustomJavaCode Shdr } +CustomJavaCode Shdr +CustomJavaCode Shdr Shdr(final int mdIdx, final java.nio.ByteBuffer buf) { +CustomJavaCode Shdr this.mdIdx = mdIdx; +CustomJavaCode Shdr this.md = MachineDescription.StaticConfig.values()[mdIdx].md; +CustomJavaCode Shdr this.accessor = new StructAccessor(buf); +CustomJavaCode Shdr } + +EmitStruct Ehdr_p1 +EmitStruct Ehdr_p2 EmitStruct Shdr #EmitStruct Sym32 #EmitStruct Sym64 |