This page hosts a formal specification of Executable and Linkable Format using Kaitai Struct. This specification can be automatically translated into a variety of programming languages to get a parsing library.
// Code generated by kaitai-struct-compiler from a .ksy source file. DO NOT EDIT.
import (
"github.com/kaitai-io/kaitai_struct_go_runtime/kaitai"
"bytes"
"io"
)
/**
* @see <a href="https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/elf.h;hb=0f62fe0532">Source</a>
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/contents.html">Source</a>
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/elf-application-binary-interface.html">Source</a>
*/
type Elf_Bits int
const (
Elf_Bits__B32 Elf_Bits = 1
Elf_Bits__B64 Elf_Bits = 2
)
var values_Elf_Bits = map[Elf_Bits]struct{}{1: {}, 2: {}}
func (v Elf_Bits) isDefined() bool {
_, ok := values_Elf_Bits[v]
return ok
}
type Elf_DynamicArrayTags int
const (
Elf_DynamicArrayTags__Null Elf_DynamicArrayTags = 0
Elf_DynamicArrayTags__Needed Elf_DynamicArrayTags = 1
Elf_DynamicArrayTags__Pltrelsz Elf_DynamicArrayTags = 2
Elf_DynamicArrayTags__Pltgot Elf_DynamicArrayTags = 3
Elf_DynamicArrayTags__Hash Elf_DynamicArrayTags = 4
Elf_DynamicArrayTags__Strtab Elf_DynamicArrayTags = 5
Elf_DynamicArrayTags__Symtab Elf_DynamicArrayTags = 6
Elf_DynamicArrayTags__Rela Elf_DynamicArrayTags = 7
Elf_DynamicArrayTags__Relasz Elf_DynamicArrayTags = 8
Elf_DynamicArrayTags__Relaent Elf_DynamicArrayTags = 9
Elf_DynamicArrayTags__Strsz Elf_DynamicArrayTags = 10
Elf_DynamicArrayTags__Syment Elf_DynamicArrayTags = 11
Elf_DynamicArrayTags__Init Elf_DynamicArrayTags = 12
Elf_DynamicArrayTags__Fini Elf_DynamicArrayTags = 13
Elf_DynamicArrayTags__Soname Elf_DynamicArrayTags = 14
Elf_DynamicArrayTags__Rpath Elf_DynamicArrayTags = 15
Elf_DynamicArrayTags__Symbolic Elf_DynamicArrayTags = 16
Elf_DynamicArrayTags__Rel Elf_DynamicArrayTags = 17
Elf_DynamicArrayTags__Relsz Elf_DynamicArrayTags = 18
Elf_DynamicArrayTags__Relent Elf_DynamicArrayTags = 19
Elf_DynamicArrayTags__Pltrel Elf_DynamicArrayTags = 20
Elf_DynamicArrayTags__Debug Elf_DynamicArrayTags = 21
Elf_DynamicArrayTags__Textrel Elf_DynamicArrayTags = 22
Elf_DynamicArrayTags__Jmprel Elf_DynamicArrayTags = 23
Elf_DynamicArrayTags__BindNow Elf_DynamicArrayTags = 24
Elf_DynamicArrayTags__InitArray Elf_DynamicArrayTags = 25
Elf_DynamicArrayTags__FiniArray Elf_DynamicArrayTags = 26
Elf_DynamicArrayTags__InitArraysz Elf_DynamicArrayTags = 27
Elf_DynamicArrayTags__FiniArraysz Elf_DynamicArrayTags = 28
Elf_DynamicArrayTags__Runpath Elf_DynamicArrayTags = 29
Elf_DynamicArrayTags__Flags Elf_DynamicArrayTags = 30
Elf_DynamicArrayTags__PreinitArray Elf_DynamicArrayTags = 32
Elf_DynamicArrayTags__PreinitArraysz Elf_DynamicArrayTags = 33
Elf_DynamicArrayTags__SymtabShndx Elf_DynamicArrayTags = 34
Elf_DynamicArrayTags__Relrsz Elf_DynamicArrayTags = 35
Elf_DynamicArrayTags__Relr Elf_DynamicArrayTags = 36
Elf_DynamicArrayTags__Relrent Elf_DynamicArrayTags = 37
Elf_DynamicArrayTags__DeprecatedSparcRegister Elf_DynamicArrayTags = 117440513
Elf_DynamicArrayTags__SunwAuxiliary Elf_DynamicArrayTags = 1610612749
Elf_DynamicArrayTags__SunwRtldinf Elf_DynamicArrayTags = 1610612750
Elf_DynamicArrayTags__SunwFilter Elf_DynamicArrayTags = 1610612751
Elf_DynamicArrayTags__SunwCap Elf_DynamicArrayTags = 1610612752
Elf_DynamicArrayTags__SunwSymtab Elf_DynamicArrayTags = 1610612753
Elf_DynamicArrayTags__SunwSymsz Elf_DynamicArrayTags = 1610612754
Elf_DynamicArrayTags__SunwSortent Elf_DynamicArrayTags = 1610612755
Elf_DynamicArrayTags__SunwSymsort Elf_DynamicArrayTags = 1610612756
Elf_DynamicArrayTags__SunwSymsortsz Elf_DynamicArrayTags = 1610612757
Elf_DynamicArrayTags__SunwTlssort Elf_DynamicArrayTags = 1610612758
Elf_DynamicArrayTags__SunwTlssortsz Elf_DynamicArrayTags = 1610612759
Elf_DynamicArrayTags__SunwCapinfo Elf_DynamicArrayTags = 1610612760
Elf_DynamicArrayTags__SunwStrpad Elf_DynamicArrayTags = 1610612761
Elf_DynamicArrayTags__SunwCapchain Elf_DynamicArrayTags = 1610612762
Elf_DynamicArrayTags__SunwLdmach Elf_DynamicArrayTags = 1610612763
Elf_DynamicArrayTags__SunwSymtabShndx Elf_DynamicArrayTags = 1610612764
Elf_DynamicArrayTags__SunwCapchainent Elf_DynamicArrayTags = 1610612765
Elf_DynamicArrayTags__SunwDeferred Elf_DynamicArrayTags = 1610612766
Elf_DynamicArrayTags__SunwCapchainsz Elf_DynamicArrayTags = 1610612767
Elf_DynamicArrayTags__SunwPhname Elf_DynamicArrayTags = 1610612768
Elf_DynamicArrayTags__SunwParent Elf_DynamicArrayTags = 1610612769
Elf_DynamicArrayTags__SunwSxAslr Elf_DynamicArrayTags = 1610612771
Elf_DynamicArrayTags__SunwRelax Elf_DynamicArrayTags = 1610612773
Elf_DynamicArrayTags__SunwKmod Elf_DynamicArrayTags = 1610612775
Elf_DynamicArrayTags__SunwSxNxheap Elf_DynamicArrayTags = 1610612777
Elf_DynamicArrayTags__SunwSxNxstack Elf_DynamicArrayTags = 1610612779
Elf_DynamicArrayTags__SunwSxAdiheap Elf_DynamicArrayTags = 1610612781
Elf_DynamicArrayTags__SunwSxAdistack Elf_DynamicArrayTags = 1610612783
Elf_DynamicArrayTags__SunwSxSsbd Elf_DynamicArrayTags = 1610612785
Elf_DynamicArrayTags__SunwSymnsort Elf_DynamicArrayTags = 1610612786
Elf_DynamicArrayTags__SunwSymnsortsz Elf_DynamicArrayTags = 1610612787
Elf_DynamicArrayTags__GnuFlags1 Elf_DynamicArrayTags = 1879047668
Elf_DynamicArrayTags__GnuPrelinked Elf_DynamicArrayTags = 1879047669
Elf_DynamicArrayTags__GnuConflictsz Elf_DynamicArrayTags = 1879047670
Elf_DynamicArrayTags__GnuLiblistsz Elf_DynamicArrayTags = 1879047671
Elf_DynamicArrayTags__Checksum Elf_DynamicArrayTags = 1879047672
Elf_DynamicArrayTags__Pltpadsz Elf_DynamicArrayTags = 1879047673
Elf_DynamicArrayTags__Moveent Elf_DynamicArrayTags = 1879047674
Elf_DynamicArrayTags__Movesz Elf_DynamicArrayTags = 1879047675
Elf_DynamicArrayTags__Feature1 Elf_DynamicArrayTags = 1879047676
Elf_DynamicArrayTags__Posflag1 Elf_DynamicArrayTags = 1879047677
Elf_DynamicArrayTags__Syminsz Elf_DynamicArrayTags = 1879047678
Elf_DynamicArrayTags__Syminent Elf_DynamicArrayTags = 1879047679
Elf_DynamicArrayTags__GnuHash Elf_DynamicArrayTags = 1879047925
Elf_DynamicArrayTags__TlsdescPlt Elf_DynamicArrayTags = 1879047926
Elf_DynamicArrayTags__TlsdescGot Elf_DynamicArrayTags = 1879047927
Elf_DynamicArrayTags__GnuConflict Elf_DynamicArrayTags = 1879047928
Elf_DynamicArrayTags__GnuLiblist Elf_DynamicArrayTags = 1879047929
Elf_DynamicArrayTags__Config Elf_DynamicArrayTags = 1879047930
Elf_DynamicArrayTags__Depaudit Elf_DynamicArrayTags = 1879047931
Elf_DynamicArrayTags__Audit Elf_DynamicArrayTags = 1879047932
Elf_DynamicArrayTags__Pltpad Elf_DynamicArrayTags = 1879047933
Elf_DynamicArrayTags__Movetab Elf_DynamicArrayTags = 1879047934
Elf_DynamicArrayTags__Syminfo Elf_DynamicArrayTags = 1879047935
Elf_DynamicArrayTags__Versym Elf_DynamicArrayTags = 1879048176
Elf_DynamicArrayTags__Relacount Elf_DynamicArrayTags = 1879048185
Elf_DynamicArrayTags__Relcount Elf_DynamicArrayTags = 1879048186
Elf_DynamicArrayTags__Flags1 Elf_DynamicArrayTags = 1879048187
Elf_DynamicArrayTags__Verdef Elf_DynamicArrayTags = 1879048188
Elf_DynamicArrayTags__Verdefnum Elf_DynamicArrayTags = 1879048189
Elf_DynamicArrayTags__Verneed Elf_DynamicArrayTags = 1879048190
Elf_DynamicArrayTags__Verneednum Elf_DynamicArrayTags = 1879048191
Elf_DynamicArrayTags__SparcRegister Elf_DynamicArrayTags = 1879048193
Elf_DynamicArrayTags__Auxiliary Elf_DynamicArrayTags = 2147483645
Elf_DynamicArrayTags__Used Elf_DynamicArrayTags = 2147483646
Elf_DynamicArrayTags__Filter Elf_DynamicArrayTags = 2147483647
)
var values_Elf_DynamicArrayTags = map[Elf_DynamicArrayTags]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 8: {}, 9: {}, 10: {}, 11: {}, 12: {}, 13: {}, 14: {}, 15: {}, 16: {}, 17: {}, 18: {}, 19: {}, 20: {}, 21: {}, 22: {}, 23: {}, 24: {}, 25: {}, 26: {}, 27: {}, 28: {}, 29: {}, 30: {}, 32: {}, 33: {}, 34: {}, 35: {}, 36: {}, 37: {}, 117440513: {}, 1610612749: {}, 1610612750: {}, 1610612751: {}, 1610612752: {}, 1610612753: {}, 1610612754: {}, 1610612755: {}, 1610612756: {}, 1610612757: {}, 1610612758: {}, 1610612759: {}, 1610612760: {}, 1610612761: {}, 1610612762: {}, 1610612763: {}, 1610612764: {}, 1610612765: {}, 1610612766: {}, 1610612767: {}, 1610612768: {}, 1610612769: {}, 1610612771: {}, 1610612773: {}, 1610612775: {}, 1610612777: {}, 1610612779: {}, 1610612781: {}, 1610612783: {}, 1610612785: {}, 1610612786: {}, 1610612787: {}, 1879047668: {}, 1879047669: {}, 1879047670: {}, 1879047671: {}, 1879047672: {}, 1879047673: {}, 1879047674: {}, 1879047675: {}, 1879047676: {}, 1879047677: {}, 1879047678: {}, 1879047679: {}, 1879047925: {}, 1879047926: {}, 1879047927: {}, 1879047928: {}, 1879047929: {}, 1879047930: {}, 1879047931: {}, 1879047932: {}, 1879047933: {}, 1879047934: {}, 1879047935: {}, 1879048176: {}, 1879048185: {}, 1879048186: {}, 1879048187: {}, 1879048188: {}, 1879048189: {}, 1879048190: {}, 1879048191: {}, 1879048193: {}, 2147483645: {}, 2147483646: {}, 2147483647: {}}
func (v Elf_DynamicArrayTags) isDefined() bool {
_, ok := values_Elf_DynamicArrayTags[v]
return ok
}
type Elf_Endian int
const (
Elf_Endian__Le Elf_Endian = 1
Elf_Endian__Be Elf_Endian = 2
)
var values_Elf_Endian = map[Elf_Endian]struct{}{1: {}, 2: {}}
func (v Elf_Endian) isDefined() bool {
_, ok := values_Elf_Endian[v]
return ok
}
type Elf_Machine int
const (
Elf_Machine__NoMachine Elf_Machine = 0
Elf_Machine__M32 Elf_Machine = 1
Elf_Machine__Sparc Elf_Machine = 2
Elf_Machine__X86 Elf_Machine = 3
Elf_Machine__M68k Elf_Machine = 4
Elf_Machine__M88k Elf_Machine = 5
Elf_Machine__Iamcu Elf_Machine = 6
Elf_Machine__I860 Elf_Machine = 7
Elf_Machine__Mips Elf_Machine = 8
Elf_Machine__S370 Elf_Machine = 9
Elf_Machine__MipsRs3Le Elf_Machine = 10
Elf_Machine__Parisc Elf_Machine = 15
Elf_Machine__Vpp500 Elf_Machine = 17
Elf_Machine__Sparc32plus Elf_Machine = 18
Elf_Machine__I960 Elf_Machine = 19
Elf_Machine__Powerpc Elf_Machine = 20
Elf_Machine__Powerpc64 Elf_Machine = 21
Elf_Machine__S390 Elf_Machine = 22
Elf_Machine__Spu Elf_Machine = 23
Elf_Machine__V800 Elf_Machine = 36
Elf_Machine__Fr20 Elf_Machine = 37
Elf_Machine__Rh32 Elf_Machine = 38
Elf_Machine__Rce Elf_Machine = 39
Elf_Machine__Arm Elf_Machine = 40
Elf_Machine__OldAlpha Elf_Machine = 41
Elf_Machine__Superh Elf_Machine = 42
Elf_Machine__SparcV9 Elf_Machine = 43
Elf_Machine__Tricore Elf_Machine = 44
Elf_Machine__Arc Elf_Machine = 45
Elf_Machine__H8300 Elf_Machine = 46
Elf_Machine__H8300h Elf_Machine = 47
Elf_Machine__H8s Elf_Machine = 48
Elf_Machine__H8500 Elf_Machine = 49
Elf_Machine__Ia64 Elf_Machine = 50
Elf_Machine__MipsX Elf_Machine = 51
Elf_Machine__Coldfire Elf_Machine = 52
Elf_Machine__M68hc12 Elf_Machine = 53
Elf_Machine__Mma Elf_Machine = 54
Elf_Machine__Pcp Elf_Machine = 55
Elf_Machine__Ncpu Elf_Machine = 56
Elf_Machine__Ndr1 Elf_Machine = 57
Elf_Machine__Starcore Elf_Machine = 58
Elf_Machine__Me16 Elf_Machine = 59
Elf_Machine__St100 Elf_Machine = 60
Elf_Machine__Tinyj Elf_Machine = 61
Elf_Machine__X8664 Elf_Machine = 62
Elf_Machine__Pdsp Elf_Machine = 63
Elf_Machine__Pdp10 Elf_Machine = 64
Elf_Machine__Pdp11 Elf_Machine = 65
Elf_Machine__Fx66 Elf_Machine = 66
Elf_Machine__St9plus Elf_Machine = 67
Elf_Machine__St7 Elf_Machine = 68
Elf_Machine__Mc68hc16 Elf_Machine = 69
Elf_Machine__Mc68hc11 Elf_Machine = 70
Elf_Machine__Mc68hc08 Elf_Machine = 71
Elf_Machine__Mc68hc05 Elf_Machine = 72
Elf_Machine__Svx Elf_Machine = 73
Elf_Machine__St19 Elf_Machine = 74
Elf_Machine__Vax Elf_Machine = 75
Elf_Machine__Cris Elf_Machine = 76
Elf_Machine__Javelin Elf_Machine = 77
Elf_Machine__Firepath Elf_Machine = 78
Elf_Machine__Zsp Elf_Machine = 79
Elf_Machine__Mmix Elf_Machine = 80
Elf_Machine__Huany Elf_Machine = 81
Elf_Machine__Prism Elf_Machine = 82
Elf_Machine__Avr Elf_Machine = 83
Elf_Machine__Fr30 Elf_Machine = 84
Elf_Machine__D10v Elf_Machine = 85
Elf_Machine__D30v Elf_Machine = 86
Elf_Machine__V850 Elf_Machine = 87
Elf_Machine__M32r Elf_Machine = 88
Elf_Machine__Mn10300 Elf_Machine = 89
Elf_Machine__Mn10200 Elf_Machine = 90
Elf_Machine__Picojava Elf_Machine = 91
Elf_Machine__Openrisc Elf_Machine = 92
Elf_Machine__ArcCompact Elf_Machine = 93
Elf_Machine__Xtensa Elf_Machine = 94
Elf_Machine__Videocore Elf_Machine = 95
Elf_Machine__TmmGpp Elf_Machine = 96
Elf_Machine__Ns32k Elf_Machine = 97
Elf_Machine__Tpc Elf_Machine = 98
Elf_Machine__Snp1k Elf_Machine = 99
Elf_Machine__St200 Elf_Machine = 100
Elf_Machine__Ip2k Elf_Machine = 101
Elf_Machine__Max Elf_Machine = 102
Elf_Machine__CompactRisc Elf_Machine = 103
Elf_Machine__F2mc16 Elf_Machine = 104
Elf_Machine__Msp430 Elf_Machine = 105
Elf_Machine__Blackfin Elf_Machine = 106
Elf_Machine__SeC33 Elf_Machine = 107
Elf_Machine__Sep Elf_Machine = 108
Elf_Machine__Arca Elf_Machine = 109
Elf_Machine__Unicore Elf_Machine = 110
Elf_Machine__Excess Elf_Machine = 111
Elf_Machine__Dxp Elf_Machine = 112
Elf_Machine__AlteraNios2 Elf_Machine = 113
Elf_Machine__Crx Elf_Machine = 114
Elf_Machine__Xgate Elf_Machine = 115
Elf_Machine__C166 Elf_Machine = 116
Elf_Machine__M16c Elf_Machine = 117
Elf_Machine__Dspic30f Elf_Machine = 118
Elf_Machine__FreescaleCe Elf_Machine = 119
Elf_Machine__M32c Elf_Machine = 120
Elf_Machine__Tsk3000 Elf_Machine = 131
Elf_Machine__Rs08 Elf_Machine = 132
Elf_Machine__Sharc Elf_Machine = 133
Elf_Machine__Ecog2 Elf_Machine = 134
Elf_Machine__Score7 Elf_Machine = 135
Elf_Machine__Dsp24 Elf_Machine = 136
Elf_Machine__Videocore3 Elf_Machine = 137
Elf_Machine__Latticemico32 Elf_Machine = 138
Elf_Machine__SeC17 Elf_Machine = 139
Elf_Machine__TiC6000 Elf_Machine = 140
Elf_Machine__TiC2000 Elf_Machine = 141
Elf_Machine__TiC5500 Elf_Machine = 142
Elf_Machine__TiArp32 Elf_Machine = 143
Elf_Machine__TiPru Elf_Machine = 144
Elf_Machine__MmdspPlus Elf_Machine = 160
Elf_Machine__CypressM8c Elf_Machine = 161
Elf_Machine__R32c Elf_Machine = 162
Elf_Machine__Trimedia Elf_Machine = 163
Elf_Machine__Qdsp6 Elf_Machine = 164
Elf_Machine__I8051 Elf_Machine = 165
Elf_Machine__Stxp7x Elf_Machine = 166
Elf_Machine__Nds32 Elf_Machine = 167
Elf_Machine__Ecog1x Elf_Machine = 168
Elf_Machine__Maxq30 Elf_Machine = 169
Elf_Machine__Ximo16 Elf_Machine = 170
Elf_Machine__Manik Elf_Machine = 171
Elf_Machine__Craynv2 Elf_Machine = 172
Elf_Machine__Rx Elf_Machine = 173
Elf_Machine__Metag Elf_Machine = 174
Elf_Machine__McstElbrus Elf_Machine = 175
Elf_Machine__Ecog16 Elf_Machine = 176
Elf_Machine__Cr16 Elf_Machine = 177
Elf_Machine__Etpu Elf_Machine = 178
Elf_Machine__Sle9x Elf_Machine = 179
Elf_Machine__L10m Elf_Machine = 180
Elf_Machine__K10m Elf_Machine = 181
Elf_Machine__Aarch64 Elf_Machine = 183
Elf_Machine__Avr32 Elf_Machine = 185
Elf_Machine__Stm8 Elf_Machine = 186
Elf_Machine__Tile64 Elf_Machine = 187
Elf_Machine__Tilepro Elf_Machine = 188
Elf_Machine__Microblaze Elf_Machine = 189
Elf_Machine__Cuda Elf_Machine = 190
Elf_Machine__Tilegx Elf_Machine = 191
Elf_Machine__Cloudshield Elf_Machine = 192
Elf_Machine__Corea1st Elf_Machine = 193
Elf_Machine__Corea2nd Elf_Machine = 194
Elf_Machine__Arcv2 Elf_Machine = 195
Elf_Machine__Open8 Elf_Machine = 196
Elf_Machine__Rl78 Elf_Machine = 197
Elf_Machine__Videocore5 Elf_Machine = 198
Elf_Machine__Renesas78kor Elf_Machine = 199
Elf_Machine__Freescale56800ex Elf_Machine = 200
Elf_Machine__Ba1 Elf_Machine = 201
Elf_Machine__Ba2 Elf_Machine = 202
Elf_Machine__Xcore Elf_Machine = 203
Elf_Machine__MchpPic Elf_Machine = 204
Elf_Machine__Intelgt Elf_Machine = 205
Elf_Machine__Intel206 Elf_Machine = 206
Elf_Machine__Intel207 Elf_Machine = 207
Elf_Machine__Intel208 Elf_Machine = 208
Elf_Machine__Intel209 Elf_Machine = 209
Elf_Machine__Km32 Elf_Machine = 210
Elf_Machine__Kmx32 Elf_Machine = 211
Elf_Machine__Kmx16 Elf_Machine = 212
Elf_Machine__Kmx8 Elf_Machine = 213
Elf_Machine__Kvarc Elf_Machine = 214
Elf_Machine__Cdp Elf_Machine = 215
Elf_Machine__Coge Elf_Machine = 216
Elf_Machine__Cool Elf_Machine = 217
Elf_Machine__Norc Elf_Machine = 218
Elf_Machine__CsrKalimba Elf_Machine = 219
Elf_Machine__Z80 Elf_Machine = 220
Elf_Machine__Visium Elf_Machine = 221
Elf_Machine__Ft32 Elf_Machine = 222
Elf_Machine__Moxie Elf_Machine = 223
Elf_Machine__AmdGpu Elf_Machine = 224
Elf_Machine__Riscv Elf_Machine = 243
Elf_Machine__Lanai Elf_Machine = 244
Elf_Machine__Ceva Elf_Machine = 245
Elf_Machine__CevaX2 Elf_Machine = 246
Elf_Machine__Bpf Elf_Machine = 247
Elf_Machine__GraphcoreIpu Elf_Machine = 248
Elf_Machine__Img1 Elf_Machine = 249
Elf_Machine__Nfp Elf_Machine = 250
Elf_Machine__Ve Elf_Machine = 251
Elf_Machine__Csky Elf_Machine = 252
Elf_Machine__ArcCompact364 Elf_Machine = 253
Elf_Machine__Mcs6502 Elf_Machine = 254
Elf_Machine__ArcCompact3 Elf_Machine = 255
Elf_Machine__Kvx Elf_Machine = 256
Elf_Machine__Wdc65816 Elf_Machine = 257
Elf_Machine__Loongarch Elf_Machine = 258
Elf_Machine__Kf32 Elf_Machine = 259
Elf_Machine__U16U8core Elf_Machine = 260
Elf_Machine__Tachyum Elf_Machine = 261
Elf_Machine__Nxp56800ef Elf_Machine = 262
Elf_Machine__AvrOld Elf_Machine = 4183
Elf_Machine__Msp430Old Elf_Machine = 4185
Elf_Machine__AdaptevaEpiphany Elf_Machine = 4643
Elf_Machine__Mt Elf_Machine = 9520
Elf_Machine__CygnusFr30 Elf_Machine = 13104
Elf_Machine__Webassembly Elf_Machine = 16727
Elf_Machine__Xc16x Elf_Machine = 18056
Elf_Machine__S12z Elf_Machine = 19951
Elf_Machine__CygnusFrv Elf_Machine = 21569
Elf_Machine__Dlx Elf_Machine = 23205
Elf_Machine__CygnusD10v Elf_Machine = 30288
Elf_Machine__CygnusD30v Elf_Machine = 30326
Elf_Machine__Ip2kOld Elf_Machine = 33303
Elf_Machine__CygnusPowerpc Elf_Machine = 36901
Elf_Machine__Alpha Elf_Machine = 36902
Elf_Machine__CygnusM32r Elf_Machine = 36929
Elf_Machine__CygnusV850 Elf_Machine = 36992
Elf_Machine__S390Old Elf_Machine = 41872
Elf_Machine__XtensaOld Elf_Machine = 43975
Elf_Machine__Xstormy16 Elf_Machine = 44357
Elf_Machine__MicroblazeOld Elf_Machine = 47787
Elf_Machine__CygnusMn10300 Elf_Machine = 48879
Elf_Machine__CygnusMn10200 Elf_Machine = 57005
Elf_Machine__CygnusMep Elf_Machine = 61453
Elf_Machine__M32cOld Elf_Machine = 65200
Elf_Machine__Iq2000 Elf_Machine = 65210
Elf_Machine__Nios32 Elf_Machine = 65211
Elf_Machine__MoxieOld Elf_Machine = 65261
)
var values_Elf_Machine = map[Elf_Machine]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 8: {}, 9: {}, 10: {}, 15: {}, 17: {}, 18: {}, 19: {}, 20: {}, 21: {}, 22: {}, 23: {}, 36: {}, 37: {}, 38: {}, 39: {}, 40: {}, 41: {}, 42: {}, 43: {}, 44: {}, 45: {}, 46: {}, 47: {}, 48: {}, 49: {}, 50: {}, 51: {}, 52: {}, 53: {}, 54: {}, 55: {}, 56: {}, 57: {}, 58: {}, 59: {}, 60: {}, 61: {}, 62: {}, 63: {}, 64: {}, 65: {}, 66: {}, 67: {}, 68: {}, 69: {}, 70: {}, 71: {}, 72: {}, 73: {}, 74: {}, 75: {}, 76: {}, 77: {}, 78: {}, 79: {}, 80: {}, 81: {}, 82: {}, 83: {}, 84: {}, 85: {}, 86: {}, 87: {}, 88: {}, 89: {}, 90: {}, 91: {}, 92: {}, 93: {}, 94: {}, 95: {}, 96: {}, 97: {}, 98: {}, 99: {}, 100: {}, 101: {}, 102: {}, 103: {}, 104: {}, 105: {}, 106: {}, 107: {}, 108: {}, 109: {}, 110: {}, 111: {}, 112: {}, 113: {}, 114: {}, 115: {}, 116: {}, 117: {}, 118: {}, 119: {}, 120: {}, 131: {}, 132: {}, 133: {}, 134: {}, 135: {}, 136: {}, 137: {}, 138: {}, 139: {}, 140: {}, 141: {}, 142: {}, 143: {}, 144: {}, 160: {}, 161: {}, 162: {}, 163: {}, 164: {}, 165: {}, 166: {}, 167: {}, 168: {}, 169: {}, 170: {}, 171: {}, 172: {}, 173: {}, 174: {}, 175: {}, 176: {}, 177: {}, 178: {}, 179: {}, 180: {}, 181: {}, 183: {}, 185: {}, 186: {}, 187: {}, 188: {}, 189: {}, 190: {}, 191: {}, 192: {}, 193: {}, 194: {}, 195: {}, 196: {}, 197: {}, 198: {}, 199: {}, 200: {}, 201: {}, 202: {}, 203: {}, 204: {}, 205: {}, 206: {}, 207: {}, 208: {}, 209: {}, 210: {}, 211: {}, 212: {}, 213: {}, 214: {}, 215: {}, 216: {}, 217: {}, 218: {}, 219: {}, 220: {}, 221: {}, 222: {}, 223: {}, 224: {}, 243: {}, 244: {}, 245: {}, 246: {}, 247: {}, 248: {}, 249: {}, 250: {}, 251: {}, 252: {}, 253: {}, 254: {}, 255: {}, 256: {}, 257: {}, 258: {}, 259: {}, 260: {}, 261: {}, 262: {}, 4183: {}, 4185: {}, 4643: {}, 9520: {}, 13104: {}, 16727: {}, 18056: {}, 19951: {}, 21569: {}, 23205: {}, 30288: {}, 30326: {}, 33303: {}, 36901: {}, 36902: {}, 36929: {}, 36992: {}, 41872: {}, 43975: {}, 44357: {}, 47787: {}, 48879: {}, 57005: {}, 61453: {}, 65200: {}, 65210: {}, 65211: {}, 65261: {}}
func (v Elf_Machine) isDefined() bool {
_, ok := values_Elf_Machine[v]
return ok
}
type Elf_ObjType int
const (
Elf_ObjType__NoFileType Elf_ObjType = 0
Elf_ObjType__Relocatable Elf_ObjType = 1
Elf_ObjType__Executable Elf_ObjType = 2
Elf_ObjType__Shared Elf_ObjType = 3
Elf_ObjType__Core Elf_ObjType = 4
)
var values_Elf_ObjType = map[Elf_ObjType]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}}
func (v Elf_ObjType) isDefined() bool {
_, ok := values_Elf_ObjType[v]
return ok
}
type Elf_OsAbi int
const (
Elf_OsAbi__SystemV Elf_OsAbi = 0
Elf_OsAbi__HpUx Elf_OsAbi = 1
Elf_OsAbi__Netbsd Elf_OsAbi = 2
Elf_OsAbi__Gnu Elf_OsAbi = 3
Elf_OsAbi__Solaris Elf_OsAbi = 6
Elf_OsAbi__Aix Elf_OsAbi = 7
Elf_OsAbi__Irix Elf_OsAbi = 8
Elf_OsAbi__Freebsd Elf_OsAbi = 9
Elf_OsAbi__Tru64 Elf_OsAbi = 10
Elf_OsAbi__Modesto Elf_OsAbi = 11
Elf_OsAbi__Openbsd Elf_OsAbi = 12
Elf_OsAbi__Openvms Elf_OsAbi = 13
Elf_OsAbi__Nsk Elf_OsAbi = 14
Elf_OsAbi__Aros Elf_OsAbi = 15
Elf_OsAbi__Fenixos Elf_OsAbi = 16
Elf_OsAbi__Cloudabi Elf_OsAbi = 17
Elf_OsAbi__Openvos Elf_OsAbi = 18
)
var values_Elf_OsAbi = map[Elf_OsAbi]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 6: {}, 7: {}, 8: {}, 9: {}, 10: {}, 11: {}, 12: {}, 13: {}, 14: {}, 15: {}, 16: {}, 17: {}, 18: {}}
func (v Elf_OsAbi) isDefined() bool {
_, ok := values_Elf_OsAbi[v]
return ok
}
type Elf_PhType int
const (
Elf_PhType__NullType Elf_PhType = 0
Elf_PhType__Load Elf_PhType = 1
Elf_PhType__Dynamic Elf_PhType = 2
Elf_PhType__Interp Elf_PhType = 3
Elf_PhType__Note Elf_PhType = 4
Elf_PhType__Shlib Elf_PhType = 5
Elf_PhType__Phdr Elf_PhType = 6
Elf_PhType__Tls Elf_PhType = 7
Elf_PhType__GnuEhFrame Elf_PhType = 1685382480
Elf_PhType__GnuStack Elf_PhType = 1685382481
Elf_PhType__GnuRelro Elf_PhType = 1685382482
Elf_PhType__GnuProperty Elf_PhType = 1685382483
Elf_PhType__PaxFlags Elf_PhType = 1694766464
Elf_PhType__ArmExidx Elf_PhType = 1879048193
)
var values_Elf_PhType = map[Elf_PhType]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 1685382480: {}, 1685382481: {}, 1685382482: {}, 1685382483: {}, 1694766464: {}, 1879048193: {}}
func (v Elf_PhType) isDefined() bool {
_, ok := values_Elf_PhType[v]
return ok
}
type Elf_SectionHeaderIdxSpecial int
const (
Elf_SectionHeaderIdxSpecial__Undefined Elf_SectionHeaderIdxSpecial = 0
Elf_SectionHeaderIdxSpecial__Before Elf_SectionHeaderIdxSpecial = 65280
Elf_SectionHeaderIdxSpecial__After Elf_SectionHeaderIdxSpecial = 65281
Elf_SectionHeaderIdxSpecial__Amd64Lcommon Elf_SectionHeaderIdxSpecial = 65282
Elf_SectionHeaderIdxSpecial__SunwIgnore Elf_SectionHeaderIdxSpecial = 65343
Elf_SectionHeaderIdxSpecial__Abs Elf_SectionHeaderIdxSpecial = 65521
Elf_SectionHeaderIdxSpecial__Common Elf_SectionHeaderIdxSpecial = 65522
Elf_SectionHeaderIdxSpecial__Xindex Elf_SectionHeaderIdxSpecial = 65535
)
var values_Elf_SectionHeaderIdxSpecial = map[Elf_SectionHeaderIdxSpecial]struct{}{0: {}, 65280: {}, 65281: {}, 65282: {}, 65343: {}, 65521: {}, 65522: {}, 65535: {}}
func (v Elf_SectionHeaderIdxSpecial) isDefined() bool {
_, ok := values_Elf_SectionHeaderIdxSpecial[v]
return ok
}
type Elf_ShType int
const (
Elf_ShType__NullType Elf_ShType = 0
Elf_ShType__Progbits Elf_ShType = 1
Elf_ShType__Symtab Elf_ShType = 2
Elf_ShType__Strtab Elf_ShType = 3
Elf_ShType__Rela Elf_ShType = 4
Elf_ShType__Hash Elf_ShType = 5
Elf_ShType__Dynamic Elf_ShType = 6
Elf_ShType__Note Elf_ShType = 7
Elf_ShType__Nobits Elf_ShType = 8
Elf_ShType__Rel Elf_ShType = 9
Elf_ShType__Shlib Elf_ShType = 10
Elf_ShType__Dynsym Elf_ShType = 11
Elf_ShType__InitArray Elf_ShType = 14
Elf_ShType__FiniArray Elf_ShType = 15
Elf_ShType__PreinitArray Elf_ShType = 16
Elf_ShType__Group Elf_ShType = 17
Elf_ShType__SymtabShndx Elf_ShType = 18
Elf_ShType__Relr Elf_ShType = 19
Elf_ShType__SunwSymnsort Elf_ShType = 1879048172
Elf_ShType__SunwPhname Elf_ShType = 1879048173
Elf_ShType__SunwAncillary Elf_ShType = 1879048174
Elf_ShType__SunwCapchain Elf_ShType = 1879048175
Elf_ShType__SunwCapinfo Elf_ShType = 1879048176
Elf_ShType__SunwSymsort Elf_ShType = 1879048177
Elf_ShType__SunwTlssort Elf_ShType = 1879048178
Elf_ShType__SunwLdynsym Elf_ShType = 1879048179
Elf_ShType__SunwDof Elf_ShType = 1879048180
Elf_ShType__SunwCap Elf_ShType = 1879048181
Elf_ShType__SunwSignature Elf_ShType = 1879048182
Elf_ShType__SunwAnnotate Elf_ShType = 1879048183
Elf_ShType__SunwDebugstr Elf_ShType = 1879048184
Elf_ShType__SunwDebug Elf_ShType = 1879048185
Elf_ShType__SunwMove Elf_ShType = 1879048186
Elf_ShType__SunwComdat Elf_ShType = 1879048187
Elf_ShType__SunwSyminfo Elf_ShType = 1879048188
Elf_ShType__SunwVerdef Elf_ShType = 1879048189
Elf_ShType__SunwVerneed Elf_ShType = 1879048190
Elf_ShType__SunwVersym Elf_ShType = 1879048191
Elf_ShType__SparcGotdata Elf_ShType = 1879048192
Elf_ShType__Amd64Unwind Elf_ShType = 1879048193
Elf_ShType__ArmPreemptmap Elf_ShType = 1879048194
Elf_ShType__ArmAttributes Elf_ShType = 1879048195
Elf_ShType__ArmDebugoverlay Elf_ShType = 1879048196
Elf_ShType__ArmOverlaysection Elf_ShType = 1879048197
)
var values_Elf_ShType = map[Elf_ShType]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {}, 8: {}, 9: {}, 10: {}, 11: {}, 14: {}, 15: {}, 16: {}, 17: {}, 18: {}, 19: {}, 1879048172: {}, 1879048173: {}, 1879048174: {}, 1879048175: {}, 1879048176: {}, 1879048177: {}, 1879048178: {}, 1879048179: {}, 1879048180: {}, 1879048181: {}, 1879048182: {}, 1879048183: {}, 1879048184: {}, 1879048185: {}, 1879048186: {}, 1879048187: {}, 1879048188: {}, 1879048189: {}, 1879048190: {}, 1879048191: {}, 1879048192: {}, 1879048193: {}, 1879048194: {}, 1879048195: {}, 1879048196: {}, 1879048197: {}}
func (v Elf_ShType) isDefined() bool {
_, ok := values_Elf_ShType[v]
return ok
}
type Elf_SymbolBinding int
const (
Elf_SymbolBinding__Local Elf_SymbolBinding = 0
Elf_SymbolBinding__GlobalSymbol Elf_SymbolBinding = 1
Elf_SymbolBinding__Weak Elf_SymbolBinding = 2
Elf_SymbolBinding__Os10 Elf_SymbolBinding = 10
Elf_SymbolBinding__Os11 Elf_SymbolBinding = 11
Elf_SymbolBinding__Os12 Elf_SymbolBinding = 12
Elf_SymbolBinding__Proc13 Elf_SymbolBinding = 13
Elf_SymbolBinding__Proc14 Elf_SymbolBinding = 14
Elf_SymbolBinding__Proc15 Elf_SymbolBinding = 15
)
var values_Elf_SymbolBinding = map[Elf_SymbolBinding]struct{}{0: {}, 1: {}, 2: {}, 10: {}, 11: {}, 12: {}, 13: {}, 14: {}, 15: {}}
func (v Elf_SymbolBinding) isDefined() bool {
_, ok := values_Elf_SymbolBinding[v]
return ok
}
type Elf_SymbolType int
const (
Elf_SymbolType__NoType Elf_SymbolType = 0
Elf_SymbolType__Object Elf_SymbolType = 1
Elf_SymbolType__Func Elf_SymbolType = 2
Elf_SymbolType__Section Elf_SymbolType = 3
Elf_SymbolType__File Elf_SymbolType = 4
Elf_SymbolType__Common Elf_SymbolType = 5
Elf_SymbolType__Tls Elf_SymbolType = 6
Elf_SymbolType__Relc Elf_SymbolType = 8
Elf_SymbolType__Srelc Elf_SymbolType = 9
Elf_SymbolType__GnuIfunc Elf_SymbolType = 10
Elf_SymbolType__Os11 Elf_SymbolType = 11
Elf_SymbolType__Os12 Elf_SymbolType = 12
Elf_SymbolType__Proc13 Elf_SymbolType = 13
Elf_SymbolType__Proc14 Elf_SymbolType = 14
Elf_SymbolType__Proc15 Elf_SymbolType = 15
)
var values_Elf_SymbolType = map[Elf_SymbolType]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 8: {}, 9: {}, 10: {}, 11: {}, 12: {}, 13: {}, 14: {}, 15: {}}
func (v Elf_SymbolType) isDefined() bool {
_, ok := values_Elf_SymbolType[v]
return ok
}
type Elf_SymbolVisibility int
const (
Elf_SymbolVisibility__Default Elf_SymbolVisibility = 0
Elf_SymbolVisibility__Internal Elf_SymbolVisibility = 1
Elf_SymbolVisibility__Hidden Elf_SymbolVisibility = 2
Elf_SymbolVisibility__Protected Elf_SymbolVisibility = 3
Elf_SymbolVisibility__Exported Elf_SymbolVisibility = 4
Elf_SymbolVisibility__Singleton Elf_SymbolVisibility = 5
Elf_SymbolVisibility__Eliminate Elf_SymbolVisibility = 6
)
var values_Elf_SymbolVisibility = map[Elf_SymbolVisibility]struct{}{0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}}
func (v Elf_SymbolVisibility) isDefined() bool {
_, ok := values_Elf_SymbolVisibility[v]
return ok
}
type Elf struct {
Magic []byte
Bits Elf_Bits
Endian Elf_Endian
EiVersion uint8
Abi Elf_OsAbi
AbiVersion uint8
Pad []byte
Header *Elf_EndianElf
_io *kaitai.Stream
_root *Elf
_parent kaitai.Struct
_f_shIdxHiOs bool
shIdxHiOs int
_f_shIdxHiProc bool
shIdxHiProc int
_f_shIdxHiReserved bool
shIdxHiReserved int
_f_shIdxLoOs bool
shIdxLoOs int
_f_shIdxLoProc bool
shIdxLoProc int
_f_shIdxLoReserved bool
shIdxLoReserved int
}
func NewElf() *Elf {
return &Elf{
}
}
func (this Elf) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf) Read(io *kaitai.Stream, parent kaitai.Struct, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
tmp1, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp1 = tmp1
this.Magic = tmp1
if !(bytes.Equal(this.Magic, []uint8{127, 69, 76, 70})) {
return kaitai.NewValidationNotEqualError([]uint8{127, 69, 76, 70}, this.Magic, this._io, "/seq/0")
}
tmp2, err := this._io.ReadU1()
if err != nil {
return err
}
this.Bits = Elf_Bits(tmp2)
tmp3, err := this._io.ReadU1()
if err != nil {
return err
}
this.Endian = Elf_Endian(tmp3)
tmp4, err := this._io.ReadU1()
if err != nil {
return err
}
this.EiVersion = tmp4
if !(this.EiVersion == 1) {
return kaitai.NewValidationNotEqualError(1, this.EiVersion, this._io, "/seq/3")
}
tmp5, err := this._io.ReadU1()
if err != nil {
return err
}
this.Abi = Elf_OsAbi(tmp5)
tmp6, err := this._io.ReadU1()
if err != nil {
return err
}
this.AbiVersion = tmp6
tmp7, err := this._io.ReadBytes(int(7))
if err != nil {
return err
}
tmp7 = tmp7
this.Pad = tmp7
if !(bytes.Equal(this.Pad, []uint8{0, 0, 0, 0, 0, 0, 0})) {
return kaitai.NewValidationNotEqualError([]uint8{0, 0, 0, 0, 0, 0, 0}, this.Pad, this._io, "/seq/6")
}
tmp8 := NewElf_EndianElf()
err = tmp8.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Header = tmp8
return err
}
func (this *Elf) ShIdxHiOs() (v int, err error) {
if (this._f_shIdxHiOs) {
return this.shIdxHiOs, nil
}
this._f_shIdxHiOs = true
this.shIdxHiOs = int(65343)
return this.shIdxHiOs, nil
}
func (this *Elf) ShIdxHiProc() (v int, err error) {
if (this._f_shIdxHiProc) {
return this.shIdxHiProc, nil
}
this._f_shIdxHiProc = true
this.shIdxHiProc = int(65311)
return this.shIdxHiProc, nil
}
func (this *Elf) ShIdxHiReserved() (v int, err error) {
if (this._f_shIdxHiReserved) {
return this.shIdxHiReserved, nil
}
this._f_shIdxHiReserved = true
this.shIdxHiReserved = int(65535)
return this.shIdxHiReserved, nil
}
func (this *Elf) ShIdxLoOs() (v int, err error) {
if (this._f_shIdxLoOs) {
return this.shIdxLoOs, nil
}
this._f_shIdxLoOs = true
this.shIdxLoOs = int(65312)
return this.shIdxLoOs, nil
}
func (this *Elf) ShIdxLoProc() (v int, err error) {
if (this._f_shIdxLoProc) {
return this.shIdxLoProc, nil
}
this._f_shIdxLoProc = true
this.shIdxLoProc = int(65280)
return this.shIdxLoProc, nil
}
func (this *Elf) ShIdxLoReserved() (v int, err error) {
if (this._f_shIdxLoReserved) {
return this.shIdxLoReserved, nil
}
this._f_shIdxLoReserved = true
this.shIdxLoReserved = int(65280)
return this.shIdxLoReserved, nil
}
/**
* File identification, must be 0x7f + "ELF".
*/
/**
* File class: designates target machine word size (32 or 64
* bits). The size of many integer fields in this format will
* depend on this setting.
*/
/**
* Endianness used for all integers.
*/
/**
* ELF header version.
*/
/**
* Specifies which OS- and ABI-related extensions will be used
* in this ELF file.
*/
/**
* Version of ABI targeted by this ELF file. Interpretation
* depends on `abi` attribute.
*/
type Elf_DtFlag1Values struct {
Value uint32
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_DynamicSectionEntry
_f_confalt bool
confalt bool
_f_direct bool
direct bool
_f_dispreldne bool
dispreldne bool
_f_disprelpnd bool
disprelpnd bool
_f_edited bool
edited bool
_f_endfiltee bool
endfiltee bool
_f_globaudit bool
globaudit bool
_f_group bool
group bool
_f_ignmuldef bool
ignmuldef bool
_f_initfirst bool
initfirst bool
_f_interpose bool
interpose bool
_f_loadfltr bool
loadfltr bool
_f_nodeflib bool
nodeflib bool
_f_nodelete bool
nodelete bool
_f_nodirect bool
nodirect bool
_f_nodump bool
nodump bool
_f_nohdr bool
nohdr bool
_f_noksyms bool
noksyms bool
_f_noopen bool
noopen bool
_f_noreloc bool
noreloc bool
_f_now bool
now bool
_f_origin bool
origin bool
_f_pie bool
pie bool
_f_rtldGlobal bool
rtldGlobal bool
_f_singleton bool
singleton bool
_f_stub bool
stub bool
_f_symintpose bool
symintpose bool
_f_trans bool
trans bool
}
func NewElf_DtFlag1Values(value uint32) *Elf_DtFlag1Values {
return &Elf_DtFlag1Values{
Value: value,
}
}
func (this Elf_DtFlag1Values) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_DtFlag1Values) Read(io *kaitai.Stream, parent *Elf_EndianElf_DynamicSectionEntry, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
return err
}
/**
* Configuration alternative created.
*/
func (this *Elf_DtFlag1Values) Confalt() (v bool, err error) {
if (this._f_confalt) {
return this.confalt, nil
}
this._f_confalt = true
this.confalt = bool(this.Value & 8192 != 0)
return this.confalt, nil
}
/**
* Direct binding enabled.
*/
func (this *Elf_DtFlag1Values) Direct() (v bool, err error) {
if (this._f_direct) {
return this.direct, nil
}
this._f_direct = true
this.direct = bool(this.Value & 256 != 0)
return this.direct, nil
}
/**
* Disp reloc applied at build time.
*/
func (this *Elf_DtFlag1Values) Dispreldne() (v bool, err error) {
if (this._f_dispreldne) {
return this.dispreldne, nil
}
this._f_dispreldne = true
this.dispreldne = bool(this.Value & 32768 != 0)
return this.dispreldne, nil
}
/**
* Disp reloc applied at run-time.
*/
func (this *Elf_DtFlag1Values) Disprelpnd() (v bool, err error) {
if (this._f_disprelpnd) {
return this.disprelpnd, nil
}
this._f_disprelpnd = true
this.disprelpnd = bool(this.Value & 65536 != 0)
return this.disprelpnd, nil
}
/**
* Object is modified after built.
*/
func (this *Elf_DtFlag1Values) Edited() (v bool, err error) {
if (this._f_edited) {
return this.edited, nil
}
this._f_edited = true
this.edited = bool(this.Value & 2097152 != 0)
return this.edited, nil
}
/**
* Filtee terminates filters search.
*/
func (this *Elf_DtFlag1Values) Endfiltee() (v bool, err error) {
if (this._f_endfiltee) {
return this.endfiltee, nil
}
this._f_endfiltee = true
this.endfiltee = bool(this.Value & 16384 != 0)
return this.endfiltee, nil
}
/**
* Global auditing required.
*/
func (this *Elf_DtFlag1Values) Globaudit() (v bool, err error) {
if (this._f_globaudit) {
return this.globaudit, nil
}
this._f_globaudit = true
this.globaudit = bool(this.Value & 16777216 != 0)
return this.globaudit, nil
}
/**
* Set RTLD_GROUP for this object.
*/
func (this *Elf_DtFlag1Values) Group() (v bool, err error) {
if (this._f_group) {
return this.group, nil
}
this._f_group = true
this.group = bool(this.Value & 4 != 0)
return this.group, nil
}
func (this *Elf_DtFlag1Values) Ignmuldef() (v bool, err error) {
if (this._f_ignmuldef) {
return this.ignmuldef, nil
}
this._f_ignmuldef = true
this.ignmuldef = bool(this.Value & 262144 != 0)
return this.ignmuldef, nil
}
/**
* Set RTLD_INITFIRST for this object
*/
func (this *Elf_DtFlag1Values) Initfirst() (v bool, err error) {
if (this._f_initfirst) {
return this.initfirst, nil
}
this._f_initfirst = true
this.initfirst = bool(this.Value & 32 != 0)
return this.initfirst, nil
}
/**
* Object is used to interpose.
*/
func (this *Elf_DtFlag1Values) Interpose() (v bool, err error) {
if (this._f_interpose) {
return this.interpose, nil
}
this._f_interpose = true
this.interpose = bool(this.Value & 1024 != 0)
return this.interpose, nil
}
/**
* Trigger filtee loading at runtime.
*/
func (this *Elf_DtFlag1Values) Loadfltr() (v bool, err error) {
if (this._f_loadfltr) {
return this.loadfltr, nil
}
this._f_loadfltr = true
this.loadfltr = bool(this.Value & 16 != 0)
return this.loadfltr, nil
}
/**
* Ignore default lib search path.
*/
func (this *Elf_DtFlag1Values) Nodeflib() (v bool, err error) {
if (this._f_nodeflib) {
return this.nodeflib, nil
}
this._f_nodeflib = true
this.nodeflib = bool(this.Value & 2048 != 0)
return this.nodeflib, nil
}
/**
* Set RTLD_NODELETE for this object.
*/
func (this *Elf_DtFlag1Values) Nodelete() (v bool, err error) {
if (this._f_nodelete) {
return this.nodelete, nil
}
this._f_nodelete = true
this.nodelete = bool(this.Value & 8 != 0)
return this.nodelete, nil
}
/**
* Object has no-direct binding.
*/
func (this *Elf_DtFlag1Values) Nodirect() (v bool, err error) {
if (this._f_nodirect) {
return this.nodirect, nil
}
this._f_nodirect = true
this.nodirect = bool(this.Value & 131072 != 0)
return this.nodirect, nil
}
/**
* Object can't be dldump'ed.
*/
func (this *Elf_DtFlag1Values) Nodump() (v bool, err error) {
if (this._f_nodump) {
return this.nodump, nil
}
this._f_nodump = true
this.nodump = bool(this.Value & 4096 != 0)
return this.nodump, nil
}
func (this *Elf_DtFlag1Values) Nohdr() (v bool, err error) {
if (this._f_nohdr) {
return this.nohdr, nil
}
this._f_nohdr = true
this.nohdr = bool(this.Value & 1048576 != 0)
return this.nohdr, nil
}
func (this *Elf_DtFlag1Values) Noksyms() (v bool, err error) {
if (this._f_noksyms) {
return this.noksyms, nil
}
this._f_noksyms = true
this.noksyms = bool(this.Value & 524288 != 0)
return this.noksyms, nil
}
/**
* Set RTLD_NOOPEN for this object.
*/
func (this *Elf_DtFlag1Values) Noopen() (v bool, err error) {
if (this._f_noopen) {
return this.noopen, nil
}
this._f_noopen = true
this.noopen = bool(this.Value & 64 != 0)
return this.noopen, nil
}
func (this *Elf_DtFlag1Values) Noreloc() (v bool, err error) {
if (this._f_noreloc) {
return this.noreloc, nil
}
this._f_noreloc = true
this.noreloc = bool(this.Value & 4194304 != 0)
return this.noreloc, nil
}
/**
* Set RTLD_NOW for this object.
*/
func (this *Elf_DtFlag1Values) Now() (v bool, err error) {
if (this._f_now) {
return this.now, nil
}
this._f_now = true
this.now = bool(this.Value & 1 != 0)
return this.now, nil
}
/**
* $ORIGIN must be handled.
*/
func (this *Elf_DtFlag1Values) Origin() (v bool, err error) {
if (this._f_origin) {
return this.origin, nil
}
this._f_origin = true
this.origin = bool(this.Value & 128 != 0)
return this.origin, nil
}
func (this *Elf_DtFlag1Values) Pie() (v bool, err error) {
if (this._f_pie) {
return this.pie, nil
}
this._f_pie = true
this.pie = bool(this.Value & 134217728 != 0)
return this.pie, nil
}
/**
* Set RTLD_GLOBAL for this object.
*/
func (this *Elf_DtFlag1Values) RtldGlobal() (v bool, err error) {
if (this._f_rtldGlobal) {
return this.rtldGlobal, nil
}
this._f_rtldGlobal = true
this.rtldGlobal = bool(this.Value & 2 != 0)
return this.rtldGlobal, nil
}
/**
* Singleton symbols are used.
*/
func (this *Elf_DtFlag1Values) Singleton() (v bool, err error) {
if (this._f_singleton) {
return this.singleton, nil
}
this._f_singleton = true
this.singleton = bool(this.Value & 33554432 != 0)
return this.singleton, nil
}
func (this *Elf_DtFlag1Values) Stub() (v bool, err error) {
if (this._f_stub) {
return this.stub, nil
}
this._f_stub = true
this.stub = bool(this.Value & 67108864 != 0)
return this.stub, nil
}
/**
* Object has individual interposers.
*/
func (this *Elf_DtFlag1Values) Symintpose() (v bool, err error) {
if (this._f_symintpose) {
return this.symintpose, nil
}
this._f_symintpose = true
this.symintpose = bool(this.Value & 8388608 != 0)
return this.symintpose, nil
}
func (this *Elf_DtFlag1Values) Trans() (v bool, err error) {
if (this._f_trans) {
return this.trans, nil
}
this._f_trans = true
this.trans = bool(this.Value & 512 != 0)
return this.trans, nil
}
/**
* @see <a href="https://refspecs.linuxbase.org/elf/gabi4+/ch5.dynamic.html">Figure 5-11: DT_FLAGS values</a>
* @see <a href="https://github.com/golang/go/blob/48dfddbab3/src/debug/elf/elf.go#L1079-L1095">Source</a>
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/dynamic-section.html#GUID-4336A69A-D905-4FCE-A398-80375A9E6464__CHAPTER7-TBL-5">Source</a>
*/
type Elf_DtFlagValues struct {
Value uint32
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_DynamicSectionEntry
_f_bindNow bool
bindNow bool
_f_origin bool
origin bool
_f_staticTls bool
staticTls bool
_f_symbolic bool
symbolic bool
_f_textrel bool
textrel bool
}
func NewElf_DtFlagValues(value uint32) *Elf_DtFlagValues {
return &Elf_DtFlagValues{
Value: value,
}
}
func (this Elf_DtFlagValues) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_DtFlagValues) Read(io *kaitai.Stream, parent *Elf_EndianElf_DynamicSectionEntry, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
return err
}
/**
* all relocations for this object must be processed before returning
* control to the program
*/
func (this *Elf_DtFlagValues) BindNow() (v bool, err error) {
if (this._f_bindNow) {
return this.bindNow, nil
}
this._f_bindNow = true
this.bindNow = bool(this.Value & 8 != 0)
return this.bindNow, nil
}
/**
* object may reference the $ORIGIN substitution string
*/
func (this *Elf_DtFlagValues) Origin() (v bool, err error) {
if (this._f_origin) {
return this.origin, nil
}
this._f_origin = true
this.origin = bool(this.Value & 1 != 0)
return this.origin, nil
}
/**
* object uses static thread-local storage scheme
*/
func (this *Elf_DtFlagValues) StaticTls() (v bool, err error) {
if (this._f_staticTls) {
return this.staticTls, nil
}
this._f_staticTls = true
this.staticTls = bool(this.Value & 16 != 0)
return this.staticTls, nil
}
/**
* symbolic linking
*/
func (this *Elf_DtFlagValues) Symbolic() (v bool, err error) {
if (this._f_symbolic) {
return this.symbolic, nil
}
this._f_symbolic = true
this.symbolic = bool(this.Value & 2 != 0)
return this.symbolic, nil
}
/**
* relocation entries might request modifications to a non-writable segment
*/
func (this *Elf_DtFlagValues) Textrel() (v bool, err error) {
if (this._f_textrel) {
return this.textrel, nil
}
this._f_textrel = true
this.textrel = bool(this.Value & 4 != 0)
return this.textrel, nil
}
type Elf_EndianElf struct {
EType Elf_ObjType
Machine Elf_Machine
EVersion uint32
EntryPoint uint64
OfsProgramHeaders uint64
OfsSectionHeaders uint64
Flags []byte
EEhsize uint16
ProgramHeaderSize uint16
NumProgramHeaders uint16
SectionHeaderSize uint16
NumSectionHeaders uint16
SectionNamesIdx uint16
_io *kaitai.Stream
_root *Elf
_parent *Elf
_raw_programHeaders [][]byte
_raw_sectionHeaders [][]byte
_raw_sectionNames []byte
_f_programHeaders bool
programHeaders []*Elf_EndianElf_ProgramHeader
_f_sectionHeaders bool
sectionHeaders []*Elf_EndianElf_SectionHeader
_f_sectionNames bool
sectionNames *Elf_EndianElf_StringsStruct
_is_le int
}
func NewElf_EndianElf() *Elf_EndianElf {
return &Elf_EndianElf{
}
}
func (this Elf_EndianElf) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf) Read(io *kaitai.Stream, parent *Elf, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = -1
switch (this._root.Endian) {
case Elf_Endian__Le:
this._is_le = int(1)
case Elf_Endian__Be:
this._is_le = int(0)
}
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf) _read_le() (err error) {
tmp9, err := this._io.ReadU2le()
if err != nil {
return err
}
this.EType = Elf_ObjType(tmp9)
tmp10, err := this._io.ReadU2le()
if err != nil {
return err
}
this.Machine = Elf_Machine(tmp10)
tmp11, err := this._io.ReadU4le()
if err != nil {
return err
}
this.EVersion = uint32(tmp11)
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp12, err := this._io.ReadU4le()
if err != nil {
return err
}
this.EntryPoint = uint64(tmp12)
case Elf_Bits__B64:
tmp13, err := this._io.ReadU8le()
if err != nil {
return err
}
this.EntryPoint = uint64(tmp13)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp14, err := this._io.ReadU4le()
if err != nil {
return err
}
this.OfsProgramHeaders = uint64(tmp14)
case Elf_Bits__B64:
tmp15, err := this._io.ReadU8le()
if err != nil {
return err
}
this.OfsProgramHeaders = uint64(tmp15)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp16, err := this._io.ReadU4le()
if err != nil {
return err
}
this.OfsSectionHeaders = uint64(tmp16)
case Elf_Bits__B64:
tmp17, err := this._io.ReadU8le()
if err != nil {
return err
}
this.OfsSectionHeaders = uint64(tmp17)
}
tmp18, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp18 = tmp18
this.Flags = tmp18
tmp19, err := this._io.ReadU2le()
if err != nil {
return err
}
this.EEhsize = uint16(tmp19)
tmp20, err := this._io.ReadU2le()
if err != nil {
return err
}
this.ProgramHeaderSize = uint16(tmp20)
tmp21, err := this._io.ReadU2le()
if err != nil {
return err
}
this.NumProgramHeaders = uint16(tmp21)
tmp22, err := this._io.ReadU2le()
if err != nil {
return err
}
this.SectionHeaderSize = uint16(tmp22)
tmp23, err := this._io.ReadU2le()
if err != nil {
return err
}
this.NumSectionHeaders = uint16(tmp23)
tmp24, err := this._io.ReadU2le()
if err != nil {
return err
}
this.SectionNamesIdx = uint16(tmp24)
return err
}
func (this *Elf_EndianElf) _read_be() (err error) {
tmp25, err := this._io.ReadU2be()
if err != nil {
return err
}
this.EType = Elf_ObjType(tmp25)
tmp26, err := this._io.ReadU2be()
if err != nil {
return err
}
this.Machine = Elf_Machine(tmp26)
tmp27, err := this._io.ReadU4be()
if err != nil {
return err
}
this.EVersion = uint32(tmp27)
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp28, err := this._io.ReadU4be()
if err != nil {
return err
}
this.EntryPoint = uint64(tmp28)
case Elf_Bits__B64:
tmp29, err := this._io.ReadU8be()
if err != nil {
return err
}
this.EntryPoint = uint64(tmp29)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp30, err := this._io.ReadU4be()
if err != nil {
return err
}
this.OfsProgramHeaders = uint64(tmp30)
case Elf_Bits__B64:
tmp31, err := this._io.ReadU8be()
if err != nil {
return err
}
this.OfsProgramHeaders = uint64(tmp31)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp32, err := this._io.ReadU4be()
if err != nil {
return err
}
this.OfsSectionHeaders = uint64(tmp32)
case Elf_Bits__B64:
tmp33, err := this._io.ReadU8be()
if err != nil {
return err
}
this.OfsSectionHeaders = uint64(tmp33)
}
tmp34, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp34 = tmp34
this.Flags = tmp34
tmp35, err := this._io.ReadU2be()
if err != nil {
return err
}
this.EEhsize = uint16(tmp35)
tmp36, err := this._io.ReadU2be()
if err != nil {
return err
}
this.ProgramHeaderSize = uint16(tmp36)
tmp37, err := this._io.ReadU2be()
if err != nil {
return err
}
this.NumProgramHeaders = uint16(tmp37)
tmp38, err := this._io.ReadU2be()
if err != nil {
return err
}
this.SectionHeaderSize = uint16(tmp38)
tmp39, err := this._io.ReadU2be()
if err != nil {
return err
}
this.NumSectionHeaders = uint16(tmp39)
tmp40, err := this._io.ReadU2be()
if err != nil {
return err
}
this.SectionNamesIdx = uint16(tmp40)
return err
}
func (this *Elf_EndianElf) ProgramHeaders() (v []*Elf_EndianElf_ProgramHeader, err error) {
if (this._f_programHeaders) {
return this.programHeaders, nil
}
this._f_programHeaders = true
_pos, err := this._io.Pos()
if err != nil {
return nil, err
}
_, err = this._io.Seek(int64(this.OfsProgramHeaders), io.SeekStart)
if err != nil {
return nil, err
}
switch this._is_le {
case 0:
for i := 0; i < int(this.NumProgramHeaders); i++ {
_ = i
tmp41, err := this._io.ReadBytes(int(this.ProgramHeaderSize))
if err != nil {
return nil, err
}
tmp41 = tmp41
this._raw_programHeaders = append(this._raw_programHeaders, tmp41)
_io__raw_programHeaders := kaitai.NewStream(bytes.NewReader(this._raw_programHeaders[i]))
tmp42 := NewElf_EndianElf_ProgramHeader()
err = tmp42.Read(_io__raw_programHeaders, this, this._root)
if err != nil {
return nil, err
}
this.programHeaders = append(this.programHeaders, tmp42)
}
case 1:
for i := 0; i < int(this.NumProgramHeaders); i++ {
_ = i
tmp43, err := this._io.ReadBytes(int(this.ProgramHeaderSize))
if err != nil {
return nil, err
}
tmp43 = tmp43
this._raw_programHeaders = append(this._raw_programHeaders, tmp43)
_io__raw_programHeaders := kaitai.NewStream(bytes.NewReader(this._raw_programHeaders[i]))
tmp44 := NewElf_EndianElf_ProgramHeader()
err = tmp44.Read(_io__raw_programHeaders, this, this._root)
if err != nil {
return nil, err
}
this.programHeaders = append(this.programHeaders, tmp44)
}
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = this._io.Seek(_pos, io.SeekStart)
if err != nil {
return nil, err
}
return this.programHeaders, nil
}
func (this *Elf_EndianElf) SectionHeaders() (v []*Elf_EndianElf_SectionHeader, err error) {
if (this._f_sectionHeaders) {
return this.sectionHeaders, nil
}
this._f_sectionHeaders = true
_pos, err := this._io.Pos()
if err != nil {
return nil, err
}
_, err = this._io.Seek(int64(this.OfsSectionHeaders), io.SeekStart)
if err != nil {
return nil, err
}
switch this._is_le {
case 0:
for i := 0; i < int(this.NumSectionHeaders); i++ {
_ = i
tmp45, err := this._io.ReadBytes(int(this.SectionHeaderSize))
if err != nil {
return nil, err
}
tmp45 = tmp45
this._raw_sectionHeaders = append(this._raw_sectionHeaders, tmp45)
_io__raw_sectionHeaders := kaitai.NewStream(bytes.NewReader(this._raw_sectionHeaders[i]))
tmp46 := NewElf_EndianElf_SectionHeader()
err = tmp46.Read(_io__raw_sectionHeaders, this, this._root)
if err != nil {
return nil, err
}
this.sectionHeaders = append(this.sectionHeaders, tmp46)
}
case 1:
for i := 0; i < int(this.NumSectionHeaders); i++ {
_ = i
tmp47, err := this._io.ReadBytes(int(this.SectionHeaderSize))
if err != nil {
return nil, err
}
tmp47 = tmp47
this._raw_sectionHeaders = append(this._raw_sectionHeaders, tmp47)
_io__raw_sectionHeaders := kaitai.NewStream(bytes.NewReader(this._raw_sectionHeaders[i]))
tmp48 := NewElf_EndianElf_SectionHeader()
err = tmp48.Read(_io__raw_sectionHeaders, this, this._root)
if err != nil {
return nil, err
}
this.sectionHeaders = append(this.sectionHeaders, tmp48)
}
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = this._io.Seek(_pos, io.SeekStart)
if err != nil {
return nil, err
}
return this.sectionHeaders, nil
}
func (this *Elf_EndianElf) SectionNames() (v *Elf_EndianElf_StringsStruct, err error) {
if (this._f_sectionNames) {
return this.sectionNames, nil
}
this._f_sectionNames = true
if ( ((this.SectionNamesIdx != Elf_SectionHeaderIdxSpecial__Undefined) && (this.SectionNamesIdx < this._root.Header.NumSectionHeaders)) ) {
_pos, err := this._io.Pos()
if err != nil {
return nil, err
}
tmp49, err := this.SectionHeaders()
if err != nil {
return nil, err
}
_, err = this._io.Seek(int64(tmp49[this.SectionNamesIdx].OfsBody), io.SeekStart)
if err != nil {
return nil, err
}
switch this._is_le {
case 0:
tmp50, err := this.SectionHeaders()
if err != nil {
return nil, err
}
tmp51, err := this._io.ReadBytes(int(tmp50[this.SectionNamesIdx].LenBody))
if err != nil {
return nil, err
}
tmp51 = tmp51
this._raw_sectionNames = tmp51
_io__raw_sectionNames := kaitai.NewStream(bytes.NewReader(this._raw_sectionNames))
tmp52 := NewElf_EndianElf_StringsStruct()
err = tmp52.Read(_io__raw_sectionNames, this, this._root)
if err != nil {
return nil, err
}
this.sectionNames = tmp52
case 1:
tmp53, err := this.SectionHeaders()
if err != nil {
return nil, err
}
tmp54, err := this._io.ReadBytes(int(tmp53[this.SectionNamesIdx].LenBody))
if err != nil {
return nil, err
}
tmp54 = tmp54
this._raw_sectionNames = tmp54
_io__raw_sectionNames := kaitai.NewStream(bytes.NewReader(this._raw_sectionNames))
tmp55 := NewElf_EndianElf_StringsStruct()
err = tmp55.Read(_io__raw_sectionNames, this, this._root)
if err != nil {
return nil, err
}
this.sectionNames = tmp55
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = this._io.Seek(_pos, io.SeekStart)
if err != nil {
return nil, err
}
}
return this.sectionNames, nil
}
type Elf_EndianElf_DynamicSection struct {
Entries []*Elf_EndianElf_DynamicSectionEntry
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_SectionHeader
_f_isStringTableLinked bool
isStringTableLinked bool
_is_le int
}
func NewElf_EndianElf_DynamicSection() *Elf_EndianElf_DynamicSection {
return &Elf_EndianElf_DynamicSection{
}
}
func (this Elf_EndianElf_DynamicSection) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_DynamicSection) Read(io *kaitai.Stream, parent *Elf_EndianElf_SectionHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_DynamicSection) _read_le() (err error) {
for i := 0;; i++ {
tmp56, err := this._io.EOF()
if err != nil {
return err
}
if tmp56 {
break
}
tmp57 := NewElf_EndianElf_DynamicSectionEntry()
err = tmp57.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp57)
}
return err
}
func (this *Elf_EndianElf_DynamicSection) _read_be() (err error) {
for i := 0;; i++ {
tmp58, err := this._io.EOF()
if err != nil {
return err
}
if tmp58 {
break
}
tmp59 := NewElf_EndianElf_DynamicSectionEntry()
err = tmp59.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp59)
}
return err
}
func (this *Elf_EndianElf_DynamicSection) IsStringTableLinked() (v bool, err error) {
if (this._f_isStringTableLinked) {
return this.isStringTableLinked, nil
}
this._f_isStringTableLinked = true
tmp60, err := this._parent.LinkedSection()
if err != nil {
return false, err
}
this.isStringTableLinked = bool(tmp60.Type == Elf_ShType__Strtab)
return this.isStringTableLinked, nil
}
/**
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/dynamic-section.html">Source</a>
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/ch5.dynamic.html#dynamic_section">Source</a>
*/
type Elf_EndianElf_DynamicSectionEntry struct {
Tag uint64
ValueOrPtr uint64
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_DynamicSection
_f_flag1Values bool
flag1Values *Elf_DtFlag1Values
_f_flagValues bool
flagValues *Elf_DtFlagValues
_f_isValueStr bool
isValueStr bool
_f_tagEnum bool
tagEnum Elf_DynamicArrayTags
_f_valueStr bool
valueStr string
_is_le int
}
func NewElf_EndianElf_DynamicSectionEntry() *Elf_EndianElf_DynamicSectionEntry {
return &Elf_EndianElf_DynamicSectionEntry{
}
}
func (this Elf_EndianElf_DynamicSectionEntry) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_DynamicSectionEntry) Read(io *kaitai.Stream, parent *Elf_EndianElf_DynamicSection, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_DynamicSectionEntry) _read_le() (err error) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp61, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Tag = uint64(tmp61)
case Elf_Bits__B64:
tmp62, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Tag = uint64(tmp62)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp63, err := this._io.ReadU4le()
if err != nil {
return err
}
this.ValueOrPtr = uint64(tmp63)
case Elf_Bits__B64:
tmp64, err := this._io.ReadU8le()
if err != nil {
return err
}
this.ValueOrPtr = uint64(tmp64)
}
return err
}
func (this *Elf_EndianElf_DynamicSectionEntry) _read_be() (err error) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp65, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Tag = uint64(tmp65)
case Elf_Bits__B64:
tmp66, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Tag = uint64(tmp66)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp67, err := this._io.ReadU4be()
if err != nil {
return err
}
this.ValueOrPtr = uint64(tmp67)
case Elf_Bits__B64:
tmp68, err := this._io.ReadU8be()
if err != nil {
return err
}
this.ValueOrPtr = uint64(tmp68)
}
return err
}
func (this *Elf_EndianElf_DynamicSectionEntry) Flag1Values() (v *Elf_DtFlag1Values, err error) {
if (this._f_flag1Values) {
return this.flag1Values, nil
}
this._f_flag1Values = true
tmp69, err := this.TagEnum()
if err != nil {
return nil, err
}
if (tmp69 == Elf_DynamicArrayTags__Flags1) {
switch this._is_le {
case 0:
tmp70 := NewElf_DtFlag1Values(this.ValueOrPtr)
err = tmp70.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flag1Values = tmp70
case 1:
tmp71 := NewElf_DtFlag1Values(this.ValueOrPtr)
err = tmp71.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flag1Values = tmp71
default:
err = kaitai.UndecidedEndiannessError{}
}
}
return this.flag1Values, nil
}
func (this *Elf_EndianElf_DynamicSectionEntry) FlagValues() (v *Elf_DtFlagValues, err error) {
if (this._f_flagValues) {
return this.flagValues, nil
}
this._f_flagValues = true
tmp72, err := this.TagEnum()
if err != nil {
return nil, err
}
if (tmp72 == Elf_DynamicArrayTags__Flags) {
switch this._is_le {
case 0:
tmp73 := NewElf_DtFlagValues(this.ValueOrPtr)
err = tmp73.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagValues = tmp73
case 1:
tmp74 := NewElf_DtFlagValues(this.ValueOrPtr)
err = tmp74.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagValues = tmp74
default:
err = kaitai.UndecidedEndiannessError{}
}
}
return this.flagValues, nil
}
func (this *Elf_EndianElf_DynamicSectionEntry) IsValueStr() (v bool, err error) {
if (this._f_isValueStr) {
return this.isValueStr, nil
}
this._f_isValueStr = true
tmp75, err := this.TagEnum()
if err != nil {
return false, err
}
tmp76, err := this.TagEnum()
if err != nil {
return false, err
}
tmp77, err := this.TagEnum()
if err != nil {
return false, err
}
tmp78, err := this.TagEnum()
if err != nil {
return false, err
}
tmp79, err := this.TagEnum()
if err != nil {
return false, err
}
tmp80, err := this.TagEnum()
if err != nil {
return false, err
}
tmp81, err := this.TagEnum()
if err != nil {
return false, err
}
tmp82, err := this.TagEnum()
if err != nil {
return false, err
}
tmp83, err := this.TagEnum()
if err != nil {
return false, err
}
tmp84, err := this.TagEnum()
if err != nil {
return false, err
}
tmp85, err := this.TagEnum()
if err != nil {
return false, err
}
this.isValueStr = bool( ((this.ValueOrPtr != 0) && ( ((tmp75 == Elf_DynamicArrayTags__Needed) || (tmp76 == Elf_DynamicArrayTags__Soname) || (tmp77 == Elf_DynamicArrayTags__Rpath) || (tmp78 == Elf_DynamicArrayTags__Runpath) || (tmp79 == Elf_DynamicArrayTags__SunwAuxiliary) || (tmp80 == Elf_DynamicArrayTags__SunwFilter) || (tmp81 == Elf_DynamicArrayTags__Auxiliary) || (tmp82 == Elf_DynamicArrayTags__Filter) || (tmp83 == Elf_DynamicArrayTags__Config) || (tmp84 == Elf_DynamicArrayTags__Depaudit) || (tmp85 == Elf_DynamicArrayTags__Audit)) )) )
return this.isValueStr, nil
}
func (this *Elf_EndianElf_DynamicSectionEntry) TagEnum() (v Elf_DynamicArrayTags, err error) {
if (this._f_tagEnum) {
return this.tagEnum, nil
}
this._f_tagEnum = true
this.tagEnum = Elf_DynamicArrayTags(Elf_DynamicArrayTags(this.Tag))
return this.tagEnum, nil
}
func (this *Elf_EndianElf_DynamicSectionEntry) ValueStr() (v string, err error) {
if (this._f_valueStr) {
return this.valueStr, nil
}
this._f_valueStr = true
tmp86, err := this.IsValueStr()
if err != nil {
return "", err
}
tmp87, err := this._parent.IsStringTableLinked()
if err != nil {
return "", err
}
if ( ((tmp86) && (tmp87)) ) {
tmp88, err := this._parent._parent.LinkedSection()
if err != nil {
return "", err
}
tmp89, err := tmp88.Body()
if err != nil {
return "", err
}
thisIo := tmp89.(*Elf_EndianElf_StringsStruct)._io
_pos, err := thisIo.Pos()
if err != nil {
return "", err
}
_, err = thisIo.Seek(int64(this.ValueOrPtr), io.SeekStart)
if err != nil {
return "", err
}
switch this._is_le {
case 0:
tmp90, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.valueStr = string(tmp90)
case 1:
tmp91, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.valueStr = string(tmp91)
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = thisIo.Seek(_pos, io.SeekStart)
if err != nil {
return "", err
}
}
return this.valueStr, nil
}
type Elf_EndianElf_DynsymSection struct {
Entries []*Elf_EndianElf_DynsymSectionEntry
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_SectionHeader
_f_isStringTableLinked bool
isStringTableLinked bool
_is_le int
}
func NewElf_EndianElf_DynsymSection() *Elf_EndianElf_DynsymSection {
return &Elf_EndianElf_DynsymSection{
}
}
func (this Elf_EndianElf_DynsymSection) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_DynsymSection) Read(io *kaitai.Stream, parent *Elf_EndianElf_SectionHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_DynsymSection) _read_le() (err error) {
for i := 0;; i++ {
tmp92, err := this._io.EOF()
if err != nil {
return err
}
if tmp92 {
break
}
tmp93 := NewElf_EndianElf_DynsymSectionEntry()
err = tmp93.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp93)
}
return err
}
func (this *Elf_EndianElf_DynsymSection) _read_be() (err error) {
for i := 0;; i++ {
tmp94, err := this._io.EOF()
if err != nil {
return err
}
if tmp94 {
break
}
tmp95 := NewElf_EndianElf_DynsymSectionEntry()
err = tmp95.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp95)
}
return err
}
func (this *Elf_EndianElf_DynsymSection) IsStringTableLinked() (v bool, err error) {
if (this._f_isStringTableLinked) {
return this.isStringTableLinked, nil
}
this._f_isStringTableLinked = true
tmp96, err := this._parent.LinkedSection()
if err != nil {
return false, err
}
this.isStringTableLinked = bool(tmp96.Type == Elf_ShType__Strtab)
return this.isStringTableLinked, nil
}
/**
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/symbol-table-section.html">Source</a>
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.symtab.html">Source</a>
*/
type Elf_EndianElf_DynsymSectionEntry struct {
OfsName uint32
ValueB32 uint32
SizeB32 uint32
Bind Elf_SymbolBinding
Type Elf_SymbolType
Other uint8
ShIdx uint16
ValueB64 uint64
SizeB64 uint64
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_DynsymSection
_f_isShIdxOs bool
isShIdxOs bool
_f_isShIdxProc bool
isShIdxProc bool
_f_isShIdxReserved bool
isShIdxReserved bool
_f_name bool
name string
_f_shIdxSpecial bool
shIdxSpecial Elf_SectionHeaderIdxSpecial
_f_size bool
size uint64
_f_value bool
value uint64
_f_visibility bool
visibility Elf_SymbolVisibility
_is_le int
}
func NewElf_EndianElf_DynsymSectionEntry() *Elf_EndianElf_DynsymSectionEntry {
return &Elf_EndianElf_DynsymSectionEntry{
}
}
func (this Elf_EndianElf_DynsymSectionEntry) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_DynsymSectionEntry) Read(io *kaitai.Stream, parent *Elf_EndianElf_DynsymSection, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_DynsymSectionEntry) _read_le() (err error) {
tmp97, err := this._io.ReadU4le()
if err != nil {
return err
}
this.OfsName = uint32(tmp97)
if (this._root.Bits == Elf_Bits__B32) {
tmp98, err := this._io.ReadU4le()
if err != nil {
return err
}
this.ValueB32 = uint32(tmp98)
}
if (this._root.Bits == Elf_Bits__B32) {
tmp99, err := this._io.ReadU4le()
if err != nil {
return err
}
this.SizeB32 = uint32(tmp99)
}
tmp100, err := this._io.ReadBitsIntBe(4)
if err != nil {
return err
}
this.Bind = Elf_SymbolBinding(tmp100)
tmp101, err := this._io.ReadBitsIntBe(4)
if err != nil {
return err
}
this.Type = Elf_SymbolType(tmp101)
this._io.AlignToByte()
tmp102, err := this._io.ReadU1()
if err != nil {
return err
}
this.Other = tmp102
tmp103, err := this._io.ReadU2le()
if err != nil {
return err
}
this.ShIdx = uint16(tmp103)
if (this._root.Bits == Elf_Bits__B64) {
tmp104, err := this._io.ReadU8le()
if err != nil {
return err
}
this.ValueB64 = uint64(tmp104)
}
if (this._root.Bits == Elf_Bits__B64) {
tmp105, err := this._io.ReadU8le()
if err != nil {
return err
}
this.SizeB64 = uint64(tmp105)
}
return err
}
func (this *Elf_EndianElf_DynsymSectionEntry) _read_be() (err error) {
tmp106, err := this._io.ReadU4be()
if err != nil {
return err
}
this.OfsName = uint32(tmp106)
if (this._root.Bits == Elf_Bits__B32) {
tmp107, err := this._io.ReadU4be()
if err != nil {
return err
}
this.ValueB32 = uint32(tmp107)
}
if (this._root.Bits == Elf_Bits__B32) {
tmp108, err := this._io.ReadU4be()
if err != nil {
return err
}
this.SizeB32 = uint32(tmp108)
}
tmp109, err := this._io.ReadBitsIntBe(4)
if err != nil {
return err
}
this.Bind = Elf_SymbolBinding(tmp109)
tmp110, err := this._io.ReadBitsIntBe(4)
if err != nil {
return err
}
this.Type = Elf_SymbolType(tmp110)
this._io.AlignToByte()
tmp111, err := this._io.ReadU1()
if err != nil {
return err
}
this.Other = tmp111
tmp112, err := this._io.ReadU2be()
if err != nil {
return err
}
this.ShIdx = uint16(tmp112)
if (this._root.Bits == Elf_Bits__B64) {
tmp113, err := this._io.ReadU8be()
if err != nil {
return err
}
this.ValueB64 = uint64(tmp113)
}
if (this._root.Bits == Elf_Bits__B64) {
tmp114, err := this._io.ReadU8be()
if err != nil {
return err
}
this.SizeB64 = uint64(tmp114)
}
return err
}
func (this *Elf_EndianElf_DynsymSectionEntry) IsShIdxOs() (v bool, err error) {
if (this._f_isShIdxOs) {
return this.isShIdxOs, nil
}
this._f_isShIdxOs = true
tmp115, err := this._root.ShIdxLoOs()
if err != nil {
return false, err
}
tmp116, err := this._root.ShIdxHiOs()
if err != nil {
return false, err
}
this.isShIdxOs = bool( ((this.ShIdx >= tmp115) && (this.ShIdx <= tmp116)) )
return this.isShIdxOs, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) IsShIdxProc() (v bool, err error) {
if (this._f_isShIdxProc) {
return this.isShIdxProc, nil
}
this._f_isShIdxProc = true
tmp117, err := this._root.ShIdxLoProc()
if err != nil {
return false, err
}
tmp118, err := this._root.ShIdxHiProc()
if err != nil {
return false, err
}
this.isShIdxProc = bool( ((this.ShIdx >= tmp117) && (this.ShIdx <= tmp118)) )
return this.isShIdxProc, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) IsShIdxReserved() (v bool, err error) {
if (this._f_isShIdxReserved) {
return this.isShIdxReserved, nil
}
this._f_isShIdxReserved = true
tmp119, err := this._root.ShIdxLoReserved()
if err != nil {
return false, err
}
tmp120, err := this._root.ShIdxHiReserved()
if err != nil {
return false, err
}
this.isShIdxReserved = bool( ((this.ShIdx >= tmp119) && (this.ShIdx <= tmp120)) )
return this.isShIdxReserved, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) Name() (v string, err error) {
if (this._f_name) {
return this.name, nil
}
this._f_name = true
tmp121, err := this._parent.IsStringTableLinked()
if err != nil {
return "", err
}
if ( ((this.OfsName != 0) && (tmp121)) ) {
tmp122, err := this._parent._parent.LinkedSection()
if err != nil {
return "", err
}
tmp123, err := tmp122.Body()
if err != nil {
return "", err
}
thisIo := tmp123.(*Elf_EndianElf_StringsStruct)._io
_pos, err := thisIo.Pos()
if err != nil {
return "", err
}
_, err = thisIo.Seek(int64(this.OfsName), io.SeekStart)
if err != nil {
return "", err
}
switch this._is_le {
case 0:
tmp124, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.name = string(tmp124)
case 1:
tmp125, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.name = string(tmp125)
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = thisIo.Seek(_pos, io.SeekStart)
if err != nil {
return "", err
}
}
return this.name, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) ShIdxSpecial() (v Elf_SectionHeaderIdxSpecial, err error) {
if (this._f_shIdxSpecial) {
return this.shIdxSpecial, nil
}
this._f_shIdxSpecial = true
this.shIdxSpecial = Elf_SectionHeaderIdxSpecial(Elf_SectionHeaderIdxSpecial(this.ShIdx))
return this.shIdxSpecial, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) Size() (v uint64, err error) {
if (this._f_size) {
return this.size, nil
}
this._f_size = true
var tmp126 uint32;
if (this._root.Bits == Elf_Bits__B32) {
tmp126 = this.SizeB32
} else {
var tmp127 uint64;
if (this._root.Bits == Elf_Bits__B64) {
tmp127 = this.SizeB64
} else {
tmp127 = 0
}
tmp126 = tmp127
}
this.size = uint64(tmp126)
return this.size, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) Value() (v uint64, err error) {
if (this._f_value) {
return this.value, nil
}
this._f_value = true
var tmp128 uint32;
if (this._root.Bits == Elf_Bits__B32) {
tmp128 = this.ValueB32
} else {
var tmp129 uint64;
if (this._root.Bits == Elf_Bits__B64) {
tmp129 = this.ValueB64
} else {
tmp129 = 0
}
tmp128 = tmp129
}
this.value = uint64(tmp128)
return this.value, nil
}
func (this *Elf_EndianElf_DynsymSectionEntry) Visibility() (v Elf_SymbolVisibility, err error) {
if (this._f_visibility) {
return this.visibility, nil
}
this._f_visibility = true
this.visibility = Elf_SymbolVisibility(Elf_SymbolVisibility(this.Other & 3))
return this.visibility, nil
}
/**
* don't read this field, access `visibility` instead
*/
/**
* section header index
*/
type Elf_EndianElf_NoteSection struct {
Entries []*Elf_EndianElf_NoteSectionEntry
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_SectionHeader
_is_le int
}
func NewElf_EndianElf_NoteSection() *Elf_EndianElf_NoteSection {
return &Elf_EndianElf_NoteSection{
}
}
func (this Elf_EndianElf_NoteSection) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_NoteSection) Read(io *kaitai.Stream, parent *Elf_EndianElf_SectionHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_NoteSection) _read_le() (err error) {
for i := 0;; i++ {
tmp130, err := this._io.EOF()
if err != nil {
return err
}
if tmp130 {
break
}
tmp131 := NewElf_EndianElf_NoteSectionEntry()
err = tmp131.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp131)
}
return err
}
func (this *Elf_EndianElf_NoteSection) _read_be() (err error) {
for i := 0;; i++ {
tmp132, err := this._io.EOF()
if err != nil {
return err
}
if tmp132 {
break
}
tmp133 := NewElf_EndianElf_NoteSectionEntry()
err = tmp133.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp133)
}
return err
}
/**
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/note-section.html">Source</a>
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/ch5.pheader.html#note_section">Source</a>
*/
type Elf_EndianElf_NoteSectionEntry struct {
LenName uint32
LenDescriptor uint32
Type uint32
Name []byte
NamePadding []byte
Descriptor []byte
DescriptorPadding []byte
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_NoteSection
_is_le int
}
func NewElf_EndianElf_NoteSectionEntry() *Elf_EndianElf_NoteSectionEntry {
return &Elf_EndianElf_NoteSectionEntry{
}
}
func (this Elf_EndianElf_NoteSectionEntry) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_NoteSectionEntry) Read(io *kaitai.Stream, parent *Elf_EndianElf_NoteSection, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_NoteSectionEntry) _read_le() (err error) {
tmp134, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LenName = uint32(tmp134)
tmp135, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LenDescriptor = uint32(tmp135)
tmp136, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Type = uint32(tmp136)
tmp137, err := this._io.ReadBytes(int(this.LenName))
if err != nil {
return err
}
tmp137 = kaitai.BytesTerminate(tmp137, 0, false)
this.Name = tmp137
tmp138 := -(this.LenName) % 4
if tmp138 < 0 {
tmp138 += 4
}
tmp139, err := this._io.ReadBytes(int(tmp138))
if err != nil {
return err
}
tmp139 = tmp139
this.NamePadding = tmp139
tmp140, err := this._io.ReadBytes(int(this.LenDescriptor))
if err != nil {
return err
}
tmp140 = tmp140
this.Descriptor = tmp140
tmp141 := -(this.LenDescriptor) % 4
if tmp141 < 0 {
tmp141 += 4
}
tmp142, err := this._io.ReadBytes(int(tmp141))
if err != nil {
return err
}
tmp142 = tmp142
this.DescriptorPadding = tmp142
return err
}
func (this *Elf_EndianElf_NoteSectionEntry) _read_be() (err error) {
tmp143, err := this._io.ReadU4be()
if err != nil {
return err
}
this.LenName = uint32(tmp143)
tmp144, err := this._io.ReadU4be()
if err != nil {
return err
}
this.LenDescriptor = uint32(tmp144)
tmp145, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Type = uint32(tmp145)
tmp146, err := this._io.ReadBytes(int(this.LenName))
if err != nil {
return err
}
tmp146 = kaitai.BytesTerminate(tmp146, 0, false)
this.Name = tmp146
tmp147 := -(this.LenName) % 4
if tmp147 < 0 {
tmp147 += 4
}
tmp148, err := this._io.ReadBytes(int(tmp147))
if err != nil {
return err
}
tmp148 = tmp148
this.NamePadding = tmp148
tmp149, err := this._io.ReadBytes(int(this.LenDescriptor))
if err != nil {
return err
}
tmp149 = tmp149
this.Descriptor = tmp149
tmp150 := -(this.LenDescriptor) % 4
if tmp150 < 0 {
tmp150 += 4
}
tmp151, err := this._io.ReadBytes(int(tmp150))
if err != nil {
return err
}
tmp151 = tmp151
this.DescriptorPadding = tmp151
return err
}
/**
* Although the ELF specification seems to hint that the `note_name` field
* is ASCII this isn't the case for Linux binaries that have a
* `.gnu.build.attributes` section.
* @see <a href="https://fedoraproject.org/wiki/Toolchain/Watermark#Proposed_Specification_for_non-loaded_notes">Source</a>
*/
type Elf_EndianElf_ProgramHeader struct {
Type Elf_PhType
Flags64 uint32
Offset uint64
Vaddr uint64
Paddr uint64
Filesz uint64
Memsz uint64
Flags32 uint32
Align uint64
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf
_f_flagsObj bool
flagsObj *Elf_PhdrTypeFlags
_is_le int
}
func NewElf_EndianElf_ProgramHeader() *Elf_EndianElf_ProgramHeader {
return &Elf_EndianElf_ProgramHeader{
}
}
func (this Elf_EndianElf_ProgramHeader) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_ProgramHeader) Read(io *kaitai.Stream, parent *Elf_EndianElf, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_ProgramHeader) _read_le() (err error) {
tmp152, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Type = Elf_PhType(tmp152)
if (this._root.Bits == Elf_Bits__B64) {
tmp153, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Flags64 = uint32(tmp153)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp154, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Offset = uint64(tmp154)
case Elf_Bits__B64:
tmp155, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Offset = uint64(tmp155)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp156, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Vaddr = uint64(tmp156)
case Elf_Bits__B64:
tmp157, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Vaddr = uint64(tmp157)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp158, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Paddr = uint64(tmp158)
case Elf_Bits__B64:
tmp159, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Paddr = uint64(tmp159)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp160, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Filesz = uint64(tmp160)
case Elf_Bits__B64:
tmp161, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Filesz = uint64(tmp161)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp162, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Memsz = uint64(tmp162)
case Elf_Bits__B64:
tmp163, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Memsz = uint64(tmp163)
}
if (this._root.Bits == Elf_Bits__B32) {
tmp164, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Flags32 = uint32(tmp164)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp165, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Align = uint64(tmp165)
case Elf_Bits__B64:
tmp166, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Align = uint64(tmp166)
}
return err
}
func (this *Elf_EndianElf_ProgramHeader) _read_be() (err error) {
tmp167, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Type = Elf_PhType(tmp167)
if (this._root.Bits == Elf_Bits__B64) {
tmp168, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Flags64 = uint32(tmp168)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp169, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Offset = uint64(tmp169)
case Elf_Bits__B64:
tmp170, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Offset = uint64(tmp170)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp171, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Vaddr = uint64(tmp171)
case Elf_Bits__B64:
tmp172, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Vaddr = uint64(tmp172)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp173, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Paddr = uint64(tmp173)
case Elf_Bits__B64:
tmp174, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Paddr = uint64(tmp174)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp175, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Filesz = uint64(tmp175)
case Elf_Bits__B64:
tmp176, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Filesz = uint64(tmp176)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp177, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Memsz = uint64(tmp177)
case Elf_Bits__B64:
tmp178, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Memsz = uint64(tmp178)
}
if (this._root.Bits == Elf_Bits__B32) {
tmp179, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Flags32 = uint32(tmp179)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp180, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Align = uint64(tmp180)
case Elf_Bits__B64:
tmp181, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Align = uint64(tmp181)
}
return err
}
func (this *Elf_EndianElf_ProgramHeader) FlagsObj() (v *Elf_PhdrTypeFlags, err error) {
if (this._f_flagsObj) {
return this.flagsObj, nil
}
this._f_flagsObj = true
switch this._is_le {
case 0:
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp182 := NewElf_PhdrTypeFlags(this.Flags32)
err = tmp182.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp182
case Elf_Bits__B64:
tmp183 := NewElf_PhdrTypeFlags(this.Flags64)
err = tmp183.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp183
}
case 1:
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp184 := NewElf_PhdrTypeFlags(this.Flags32)
err = tmp184.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp184
case Elf_Bits__B64:
tmp185 := NewElf_PhdrTypeFlags(this.Flags64)
err = tmp185.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp185
}
default:
err = kaitai.UndecidedEndiannessError{}
}
return this.flagsObj, nil
}
/**
* @see <a href="https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/linkers-libraries/relocation-sections.html">Source</a>
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.reloc.html">Source</a>
*/
type Elf_EndianElf_RelocationSection struct {
Entries []*Elf_EndianElf_RelocationSectionEntry
HasAddend bool
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_SectionHeader
_is_le int
}
func NewElf_EndianElf_RelocationSection(hasAddend bool) *Elf_EndianElf_RelocationSection {
return &Elf_EndianElf_RelocationSection{
HasAddend: hasAddend,
}
}
func (this Elf_EndianElf_RelocationSection) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_RelocationSection) Read(io *kaitai.Stream, parent *Elf_EndianElf_SectionHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_RelocationSection) _read_le() (err error) {
for i := 0;; i++ {
tmp186, err := this._io.EOF()
if err != nil {
return err
}
if tmp186 {
break
}
tmp187 := NewElf_EndianElf_RelocationSectionEntry()
err = tmp187.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp187)
}
return err
}
func (this *Elf_EndianElf_RelocationSection) _read_be() (err error) {
for i := 0;; i++ {
tmp188, err := this._io.EOF()
if err != nil {
return err
}
if tmp188 {
break
}
tmp189 := NewElf_EndianElf_RelocationSectionEntry()
err = tmp189.Read(this._io, this, this._root)
if err != nil {
return err
}
this.Entries = append(this.Entries, tmp189)
}
return err
}
type Elf_EndianElf_RelocationSectionEntry struct {
Offset uint64
Info uint64
Addend int64
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_RelocationSection
_is_le int
}
func NewElf_EndianElf_RelocationSectionEntry() *Elf_EndianElf_RelocationSectionEntry {
return &Elf_EndianElf_RelocationSectionEntry{
}
}
func (this Elf_EndianElf_RelocationSectionEntry) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_RelocationSectionEntry) Read(io *kaitai.Stream, parent *Elf_EndianElf_RelocationSection, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_RelocationSectionEntry) _read_le() (err error) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp190, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Offset = uint64(tmp190)
case Elf_Bits__B64:
tmp191, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Offset = uint64(tmp191)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp192, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Info = uint64(tmp192)
case Elf_Bits__B64:
tmp193, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Info = uint64(tmp193)
}
if (this._parent.HasAddend) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp194, err := this._io.ReadS4le()
if err != nil {
return err
}
this.Addend = int64(tmp194)
case Elf_Bits__B64:
tmp195, err := this._io.ReadS8le()
if err != nil {
return err
}
this.Addend = int64(tmp195)
}
}
return err
}
func (this *Elf_EndianElf_RelocationSectionEntry) _read_be() (err error) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp196, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Offset = uint64(tmp196)
case Elf_Bits__B64:
tmp197, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Offset = uint64(tmp197)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp198, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Info = uint64(tmp198)
case Elf_Bits__B64:
tmp199, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Info = uint64(tmp199)
}
if (this._parent.HasAddend) {
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp200, err := this._io.ReadS4be()
if err != nil {
return err
}
this.Addend = int64(tmp200)
case Elf_Bits__B64:
tmp201, err := this._io.ReadS8be()
if err != nil {
return err
}
this.Addend = int64(tmp201)
}
}
return err
}
type Elf_EndianElf_SectionHeader struct {
OfsName uint32
Type Elf_ShType
Flags uint64
Addr uint64
OfsBody uint64
LenBody uint64
LinkedSectionIdx uint32
Info []byte
Align uint64
EntrySize uint64
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf
_raw_body []byte
_f_body bool
body interface{}
_f_flagsObj bool
flagsObj *Elf_SectionHeaderFlags
_f_linkedSection bool
linkedSection *Elf_EndianElf_SectionHeader
_f_name bool
name string
_is_le int
}
func NewElf_EndianElf_SectionHeader() *Elf_EndianElf_SectionHeader {
return &Elf_EndianElf_SectionHeader{
}
}
func (this Elf_EndianElf_SectionHeader) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_SectionHeader) Read(io *kaitai.Stream, parent *Elf_EndianElf, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_SectionHeader) _read_le() (err error) {
tmp202, err := this._io.ReadU4le()
if err != nil {
return err
}
this.OfsName = uint32(tmp202)
tmp203, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Type = Elf_ShType(tmp203)
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp204, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Flags = uint64(tmp204)
case Elf_Bits__B64:
tmp205, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Flags = uint64(tmp205)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp206, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Addr = uint64(tmp206)
case Elf_Bits__B64:
tmp207, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Addr = uint64(tmp207)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp208, err := this._io.ReadU4le()
if err != nil {
return err
}
this.OfsBody = uint64(tmp208)
case Elf_Bits__B64:
tmp209, err := this._io.ReadU8le()
if err != nil {
return err
}
this.OfsBody = uint64(tmp209)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp210, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LenBody = uint64(tmp210)
case Elf_Bits__B64:
tmp211, err := this._io.ReadU8le()
if err != nil {
return err
}
this.LenBody = uint64(tmp211)
}
tmp212, err := this._io.ReadU4le()
if err != nil {
return err
}
this.LinkedSectionIdx = uint32(tmp212)
tmp213, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp213 = tmp213
this.Info = tmp213
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp214, err := this._io.ReadU4le()
if err != nil {
return err
}
this.Align = uint64(tmp214)
case Elf_Bits__B64:
tmp215, err := this._io.ReadU8le()
if err != nil {
return err
}
this.Align = uint64(tmp215)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp216, err := this._io.ReadU4le()
if err != nil {
return err
}
this.EntrySize = uint64(tmp216)
case Elf_Bits__B64:
tmp217, err := this._io.ReadU8le()
if err != nil {
return err
}
this.EntrySize = uint64(tmp217)
}
return err
}
func (this *Elf_EndianElf_SectionHeader) _read_be() (err error) {
tmp218, err := this._io.ReadU4be()
if err != nil {
return err
}
this.OfsName = uint32(tmp218)
tmp219, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Type = Elf_ShType(tmp219)
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp220, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Flags = uint64(tmp220)
case Elf_Bits__B64:
tmp221, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Flags = uint64(tmp221)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp222, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Addr = uint64(tmp222)
case Elf_Bits__B64:
tmp223, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Addr = uint64(tmp223)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp224, err := this._io.ReadU4be()
if err != nil {
return err
}
this.OfsBody = uint64(tmp224)
case Elf_Bits__B64:
tmp225, err := this._io.ReadU8be()
if err != nil {
return err
}
this.OfsBody = uint64(tmp225)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp226, err := this._io.ReadU4be()
if err != nil {
return err
}
this.LenBody = uint64(tmp226)
case Elf_Bits__B64:
tmp227, err := this._io.ReadU8be()
if err != nil {
return err
}
this.LenBody = uint64(tmp227)
}
tmp228, err := this._io.ReadU4be()
if err != nil {
return err
}
this.LinkedSectionIdx = uint32(tmp228)
tmp229, err := this._io.ReadBytes(int(4))
if err != nil {
return err
}
tmp229 = tmp229
this.Info = tmp229
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp230, err := this._io.ReadU4be()
if err != nil {
return err
}
this.Align = uint64(tmp230)
case Elf_Bits__B64:
tmp231, err := this._io.ReadU8be()
if err != nil {
return err
}
this.Align = uint64(tmp231)
}
switch (this._root.Bits) {
case Elf_Bits__B32:
tmp232, err := this._io.ReadU4be()
if err != nil {
return err
}
this.EntrySize = uint64(tmp232)
case Elf_Bits__B64:
tmp233, err := this._io.ReadU8be()
if err != nil {
return err
}
this.EntrySize = uint64(tmp233)
}
return err
}
func (this *Elf_EndianElf_SectionHeader) Body() (v interface{}, err error) {
if (this._f_body) {
return this.body, nil
}
this._f_body = true
if (this.Type != Elf_ShType__Nobits) {
thisIo := this._root._io
_pos, err := thisIo.Pos()
if err != nil {
return nil, err
}
_, err = thisIo.Seek(int64(this.OfsBody), io.SeekStart)
if err != nil {
return nil, err
}
switch this._is_le {
case 0:
switch (this.Type) {
case Elf_ShType__Dynamic:
tmp234, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp234 = tmp234
this._raw_body = tmp234
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp235 := NewElf_EndianElf_DynamicSection()
err = tmp235.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp235
case Elf_ShType__Dynsym:
tmp236, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp236 = tmp236
this._raw_body = tmp236
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp237 := NewElf_EndianElf_DynsymSection()
err = tmp237.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp237
case Elf_ShType__Note:
tmp238, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp238 = tmp238
this._raw_body = tmp238
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp239 := NewElf_EndianElf_NoteSection()
err = tmp239.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp239
case Elf_ShType__Rel:
tmp240, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp240 = tmp240
this._raw_body = tmp240
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp241 := NewElf_EndianElf_RelocationSection(false)
err = tmp241.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp241
case Elf_ShType__Rela:
tmp242, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp242 = tmp242
this._raw_body = tmp242
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp243 := NewElf_EndianElf_RelocationSection(true)
err = tmp243.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp243
case Elf_ShType__Strtab:
tmp244, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp244 = tmp244
this._raw_body = tmp244
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp245 := NewElf_EndianElf_StringsStruct()
err = tmp245.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp245
case Elf_ShType__Symtab:
tmp246, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp246 = tmp246
this._raw_body = tmp246
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp247 := NewElf_EndianElf_DynsymSection()
err = tmp247.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp247
default:
tmp248, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp248 = tmp248
this._raw_body = tmp248
}
case 1:
switch (this.Type) {
case Elf_ShType__Dynamic:
tmp249, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp249 = tmp249
this._raw_body = tmp249
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp250 := NewElf_EndianElf_DynamicSection()
err = tmp250.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp250
case Elf_ShType__Dynsym:
tmp251, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp251 = tmp251
this._raw_body = tmp251
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp252 := NewElf_EndianElf_DynsymSection()
err = tmp252.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp252
case Elf_ShType__Note:
tmp253, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp253 = tmp253
this._raw_body = tmp253
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp254 := NewElf_EndianElf_NoteSection()
err = tmp254.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp254
case Elf_ShType__Rel:
tmp255, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp255 = tmp255
this._raw_body = tmp255
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp256 := NewElf_EndianElf_RelocationSection(false)
err = tmp256.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp256
case Elf_ShType__Rela:
tmp257, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp257 = tmp257
this._raw_body = tmp257
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp258 := NewElf_EndianElf_RelocationSection(true)
err = tmp258.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp258
case Elf_ShType__Strtab:
tmp259, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp259 = tmp259
this._raw_body = tmp259
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp260 := NewElf_EndianElf_StringsStruct()
err = tmp260.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp260
case Elf_ShType__Symtab:
tmp261, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp261 = tmp261
this._raw_body = tmp261
_io__raw_body := kaitai.NewStream(bytes.NewReader(this._raw_body))
tmp262 := NewElf_EndianElf_DynsymSection()
err = tmp262.Read(_io__raw_body, this, this._root)
if err != nil {
return nil, err
}
this.body = tmp262
default:
tmp263, err := thisIo.ReadBytes(int(this.LenBody))
if err != nil {
return nil, err
}
tmp263 = tmp263
this._raw_body = tmp263
}
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = thisIo.Seek(_pos, io.SeekStart)
if err != nil {
return nil, err
}
}
return this.body, nil
}
func (this *Elf_EndianElf_SectionHeader) FlagsObj() (v *Elf_SectionHeaderFlags, err error) {
if (this._f_flagsObj) {
return this.flagsObj, nil
}
this._f_flagsObj = true
switch this._is_le {
case 0:
tmp264 := NewElf_SectionHeaderFlags(this.Flags)
err = tmp264.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp264
case 1:
tmp265 := NewElf_SectionHeaderFlags(this.Flags)
err = tmp265.Read(this._io, this, this._root)
if err != nil {
return nil, err
}
this.flagsObj = tmp265
default:
err = kaitai.UndecidedEndiannessError{}
}
return this.flagsObj, nil
}
/**
* may reference a later section header, so don't try to access too early (use only lazy `instances`)
* @see <a href="https://refspecs.linuxfoundation.org/elf/gabi4+/ch4.sheader.html#sh_link">Source</a>
*/
func (this *Elf_EndianElf_SectionHeader) LinkedSection() (v *Elf_EndianElf_SectionHeader, err error) {
if (this._f_linkedSection) {
return this.linkedSection, nil
}
this._f_linkedSection = true
if ( ((this.LinkedSectionIdx != Elf_SectionHeaderIdxSpecial__Undefined) && (this.LinkedSectionIdx < this._root.Header.NumSectionHeaders)) ) {
tmp266, err := this._root.Header.SectionHeaders()
if err != nil {
return nil, err
}
this.linkedSection = tmp266[this.LinkedSectionIdx]
}
return this.linkedSection, nil
}
func (this *Elf_EndianElf_SectionHeader) Name() (v string, err error) {
if (this._f_name) {
return this.name, nil
}
this._f_name = true
tmp267, err := this._root.Header.SectionNames()
if err != nil {
return "", err
}
thisIo := tmp267._io
_pos, err := thisIo.Pos()
if err != nil {
return "", err
}
_, err = thisIo.Seek(int64(this.OfsName), io.SeekStart)
if err != nil {
return "", err
}
switch this._is_le {
case 0:
tmp268, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.name = string(tmp268)
case 1:
tmp269, err := thisIo.ReadBytesTerm(0, false, true, true)
if err != nil {
return "", err
}
this.name = string(tmp269)
default:
err = kaitai.UndecidedEndiannessError{}
}
_, err = thisIo.Seek(_pos, io.SeekStart)
if err != nil {
return "", err
}
return this.name, nil
}
type Elf_EndianElf_StringsStruct struct {
Entries []string
_io *kaitai.Stream
_root *Elf
_parent kaitai.Struct
_is_le int
}
func NewElf_EndianElf_StringsStruct() *Elf_EndianElf_StringsStruct {
return &Elf_EndianElf_StringsStruct{
}
}
func (this Elf_EndianElf_StringsStruct) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_EndianElf_StringsStruct) Read(io *kaitai.Stream, parent kaitai.Struct, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
this._is_le = this._parent._is_le
switch this._is_le {
case 0:
err = this._read_be()
case 1:
err = this._read_le()
default:
err = kaitai.UndecidedEndiannessError{}
}
return err
}
func (this *Elf_EndianElf_StringsStruct) _read_le() (err error) {
for i := 0;; i++ {
tmp270, err := this._io.EOF()
if err != nil {
return err
}
if tmp270 {
break
}
tmp271, err := this._io.ReadBytesTerm(0, false, true, true)
if err != nil {
return err
}
this.Entries = append(this.Entries, string(tmp271))
}
return err
}
func (this *Elf_EndianElf_StringsStruct) _read_be() (err error) {
for i := 0;; i++ {
tmp272, err := this._io.EOF()
if err != nil {
return err
}
if tmp272 {
break
}
tmp273, err := this._io.ReadBytesTerm(0, false, true, true)
if err != nil {
return err
}
this.Entries = append(this.Entries, string(tmp273))
}
return err
}
type Elf_PhdrTypeFlags struct {
Value uint32
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_ProgramHeader
_f_execute bool
execute bool
_f_maskProc bool
maskProc bool
_f_read bool
read bool
_f_write bool
write bool
}
func NewElf_PhdrTypeFlags(value uint32) *Elf_PhdrTypeFlags {
return &Elf_PhdrTypeFlags{
Value: value,
}
}
func (this Elf_PhdrTypeFlags) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_PhdrTypeFlags) Read(io *kaitai.Stream, parent *Elf_EndianElf_ProgramHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
return err
}
func (this *Elf_PhdrTypeFlags) Execute() (v bool, err error) {
if (this._f_execute) {
return this.execute, nil
}
this._f_execute = true
this.execute = bool(this.Value & 1 != 0)
return this.execute, nil
}
func (this *Elf_PhdrTypeFlags) MaskProc() (v bool, err error) {
if (this._f_maskProc) {
return this.maskProc, nil
}
this._f_maskProc = true
this.maskProc = bool(this.Value & uint32(4026531840) != 0)
return this.maskProc, nil
}
func (this *Elf_PhdrTypeFlags) Read() (v bool, err error) {
if (this._f_read) {
return this.read, nil
}
this._f_read = true
this.read = bool(this.Value & 4 != 0)
return this.read, nil
}
func (this *Elf_PhdrTypeFlags) Write() (v bool, err error) {
if (this._f_write) {
return this.write, nil
}
this._f_write = true
this.write = bool(this.Value & 2 != 0)
return this.write, nil
}
type Elf_SectionHeaderFlags struct {
Value uint32
_io *kaitai.Stream
_root *Elf
_parent *Elf_EndianElf_SectionHeader
_f_alloc bool
alloc bool
_f_exclude bool
exclude bool
_f_execInstr bool
execInstr bool
_f_group bool
group bool
_f_infoLink bool
infoLink bool
_f_linkOrder bool
linkOrder bool
_f_maskOs bool
maskOs bool
_f_maskProc bool
maskProc bool
_f_merge bool
merge bool
_f_ordered bool
ordered bool
_f_osNonConforming bool
osNonConforming bool
_f_strings bool
strings bool
_f_tls bool
tls bool
_f_write bool
write bool
}
func NewElf_SectionHeaderFlags(value uint32) *Elf_SectionHeaderFlags {
return &Elf_SectionHeaderFlags{
Value: value,
}
}
func (this Elf_SectionHeaderFlags) IO_() *kaitai.Stream {
return this._io
}
func (this *Elf_SectionHeaderFlags) Read(io *kaitai.Stream, parent *Elf_EndianElf_SectionHeader, root *Elf) (err error) {
this._io = io
this._parent = parent
this._root = root
return err
}
/**
* occupies memory during execution
*/
func (this *Elf_SectionHeaderFlags) Alloc() (v bool, err error) {
if (this._f_alloc) {
return this.alloc, nil
}
this._f_alloc = true
this.alloc = bool(this.Value & 2 != 0)
return this.alloc, nil
}
/**
* section is excluded unless referenced or allocated (Solaris)
*/
func (this *Elf_SectionHeaderFlags) Exclude() (v bool, err error) {
if (this._f_exclude) {
return this.exclude, nil
}
this._f_exclude = true
this.exclude = bool(this.Value & 134217728 != 0)
return this.exclude, nil
}
/**
* executable
*/
func (this *Elf_SectionHeaderFlags) ExecInstr() (v bool, err error) {
if (this._f_execInstr) {
return this.execInstr, nil
}
this._f_execInstr = true
this.execInstr = bool(this.Value & 4 != 0)
return this.execInstr, nil
}
/**
* section is member of a group
*/
func (this *Elf_SectionHeaderFlags) Group() (v bool, err error) {
if (this._f_group) {
return this.group, nil
}
this._f_group = true
this.group = bool(this.Value & 512 != 0)
return this.group, nil
}
/**
* 'sh_info' contains SHT index
*/
func (this *Elf_SectionHeaderFlags) InfoLink() (v bool, err error) {
if (this._f_infoLink) {
return this.infoLink, nil
}
this._f_infoLink = true
this.infoLink = bool(this.Value & 64 != 0)
return this.infoLink, nil
}
/**
* preserve order after combining
*/
func (this *Elf_SectionHeaderFlags) LinkOrder() (v bool, err error) {
if (this._f_linkOrder) {
return this.linkOrder, nil
}
this._f_linkOrder = true
this.linkOrder = bool(this.Value & 128 != 0)
return this.linkOrder, nil
}
/**
* OS-specific
*/
func (this *Elf_SectionHeaderFlags) MaskOs() (v bool, err error) {
if (this._f_maskOs) {
return this.maskOs, nil
}
this._f_maskOs = true
this.maskOs = bool(this.Value & 267386880 != 0)
return this.maskOs, nil
}
/**
* Processor-specific
*/
func (this *Elf_SectionHeaderFlags) MaskProc() (v bool, err error) {
if (this._f_maskProc) {
return this.maskProc, nil
}
this._f_maskProc = true
this.maskProc = bool(this.Value & uint32(4026531840) != 0)
return this.maskProc, nil
}
/**
* might be merged
*/
func (this *Elf_SectionHeaderFlags) Merge() (v bool, err error) {
if (this._f_merge) {
return this.merge, nil
}
this._f_merge = true
this.merge = bool(this.Value & 16 != 0)
return this.merge, nil
}
/**
* special ordering requirement (Solaris)
*/
func (this *Elf_SectionHeaderFlags) Ordered() (v bool, err error) {
if (this._f_ordered) {
return this.ordered, nil
}
this._f_ordered = true
this.ordered = bool(this.Value & 67108864 != 0)
return this.ordered, nil
}
/**
* non-standard OS specific handling required
*/
func (this *Elf_SectionHeaderFlags) OsNonConforming() (v bool, err error) {
if (this._f_osNonConforming) {
return this.osNonConforming, nil
}
this._f_osNonConforming = true
this.osNonConforming = bool(this.Value & 256 != 0)
return this.osNonConforming, nil
}
/**
* contains nul-terminated strings
*/
func (this *Elf_SectionHeaderFlags) Strings() (v bool, err error) {
if (this._f_strings) {
return this.strings, nil
}
this._f_strings = true
this.strings = bool(this.Value & 32 != 0)
return this.strings, nil
}
/**
* section hold thread-local data
*/
func (this *Elf_SectionHeaderFlags) Tls() (v bool, err error) {
if (this._f_tls) {
return this.tls, nil
}
this._f_tls = true
this.tls = bool(this.Value & 1024 != 0)
return this.tls, nil
}
/**
* writable
*/
func (this *Elf_SectionHeaderFlags) Write() (v bool, err error) {
if (this._f_write) {
return this.write, nil
}
this._f_write = true
this.write = bool(this.Value & 1 != 0)
return this.write, nil
}