-
Notifications
You must be signed in to change notification settings - Fork 4
/
elf.py
executable file
·2403 lines (2249 loc) · 90.6 KB
/
elf.py
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
31
32
33
34
35
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/python
import json
import optparse
import StringIO
import sys
# Local imports
import dict_utils
import dwarf
import file_extract
# e_ident size and indices.
EI_MAG0 = 0 # File identification index.
EI_MAG1 = 1 # File identification index.
EI_MAG2 = 2 # File identification index.
EI_MAG3 = 3 # File identification index.
EI_CLASS = 4 # File class.
EI_DATA = 5 # Data encoding.
EI_VERSION = 6 # File version.
EI_OSABI = 7 # OS/ABI identification.
EI_ABIVERSION = 8 # ABI version.
EI_PAD = 9 # Start of padding bytes.
EI_NIDENT = 16 # Number of bytes in e_ident.
# File types
ET_NONE = 0
ET_REL = 1
ET_EXEC = 2
ET_DYN = 3
ET_CORE = 4
ET_LOPROC = 0xff00
ET_HIPROC = 0xffff
# Versioning
EV_NONE = 0
EV_CURRENT = 1
# Machine architectures
EM_NONE = 0 # No machine
EM_M32 = 1 # AT&T WE 32100
EM_SPARC = 2 # SPARC
EM_386 = 3 # Intel 386
EM_68K = 4 # Motorola 68000
EM_88K = 5 # Motorola 88000
EM_IAMCU = 6 # Intel MCU
EM_860 = 7 # Intel 80860
EM_MIPS = 8 # MIPS R3000
EM_S370 = 9 # IBM System/370
EM_MIPS_RS3_LE = 10 # MIPS RS3000 Little-endian
EM_PARISC = 15 # Hewlett-Packard PA-RISC
EM_VPP500 = 17 # Fujitsu VPP500
EM_SPARC32PLUS = 18 # Enhanced instruction set SPARC
EM_960 = 19 # Intel 80960
EM_PPC = 20 # PowerPC
EM_PPC64 = 21 # PowerPC64
EM_S390 = 22 # IBM System/390
EM_SPU = 23 # IBM SPU/SPC
EM_V800 = 36 # NEC V800
EM_FR20 = 37 # Fujitsu FR20
EM_RH32 = 38 # TRW RH-32
EM_RCE = 39 # Motorola RCE
EM_ARM = 40 # ARM
EM_ALPHA = 41 # DEC Alpha
EM_SH = 42 # Hitachi SH
EM_SPARCV9 = 43 # SPARC V9
EM_TRICORE = 44 # Siemens TriCore
EM_ARC = 45 # Argonaut RISC Core
EM_H8_300 = 46 # Hitachi H8/300
EM_H8_300H = 47 # Hitachi H8/300H
EM_H8S = 48 # Hitachi H8S
EM_H8_500 = 49 # Hitachi H8/500
EM_IA_64 = 50 # Intel IA-64 processor architecture
EM_MIPS_X = 51 # Stanford MIPS-X
EM_COLDFIRE = 52 # Motorola ColdFire
EM_68HC12 = 53 # Motorola M68HC12
EM_MMA = 54 # Fujitsu MMA Multimedia Accelerator
EM_PCP = 55 # Siemens PCP
EM_NCPU = 56 # Sony nCPU embedded RISC processor
EM_NDR1 = 57 # Denso NDR1 microprocessor
EM_STARCORE = 58 # Motorola Star*Core processor
EM_ME16 = 59 # Toyota ME16 processor
EM_ST100 = 60 # STMicroelectronics ST100 processor
EM_TINYJ = 61 # Advanced Logic Corp. TinyJ embedded processor family
EM_X86_64 = 62 # AMD x86-64 architecture
EM_PDSP = 63 # Sony DSP Processor
EM_PDP10 = 64 # Digital Equipment Corp. PDP-10
EM_PDP11 = 65 # Digital Equipment Corp. PDP-11
EM_FX66 = 66 # Siemens FX66 microcontroller
EM_ST9PLUS = 67 # STMicroelectronics ST9+ 8/16 bit microcontroller
EM_ST7 = 68 # STMicroelectronics ST7 8-bit microcontroller
EM_68HC16 = 69 # Motorola MC68HC16 Microcontroller
EM_68HC11 = 70 # Motorola MC68HC11 Microcontroller
EM_68HC08 = 71 # Motorola MC68HC08 Microcontroller
EM_68HC05 = 72 # Motorola MC68HC05 Microcontroller
EM_SVX = 73 # Silicon Graphics SVx
EM_ST19 = 74 # STMicroelectronics ST19 8-bit microcontroller
EM_VAX = 75 # Digital VAX
EM_CRIS = 76 # Axis Communications 32-bit embedded processor
EM_JAVELIN = 77 # Infineon Technologies 32-bit embedded processor
EM_FIREPATH = 78 # Element 14 64-bit DSP Processor
EM_ZSP = 79 # LSI Logic 16-bit DSP Processor
EM_MMIX = 80 # Donald Knuth's educational 64-bit processor
EM_HUANY = 81 # Harvard University machine-independent object files
EM_PRISM = 82 # SiTera Prism
EM_AVR = 83 # Atmel AVR 8-bit microcontroller
EM_FR30 = 84 # Fujitsu FR30
EM_D10V = 85 # Mitsubishi D10V
EM_D30V = 86 # Mitsubishi D30V
EM_V850 = 87 # NEC v850
EM_M32R = 88 # Mitsubishi M32R
EM_MN10300 = 89 # Matsushita MN10300
EM_MN10200 = 90 # Matsushita MN10200
EM_PJ = 91 # picoJava
EM_OPENRISC = 92 # OpenRISC 32-bit embedded processor
EM_ARC_COMPACT = 93 # ARC International ARCompact processor
EM_XTENSA = 94 # Tensilica Xtensa Architecture
EM_VIDEOCORE = 95 # Alphamosaic VideoCore processor
EM_TMM_GPP = 96 # Thompson Multimedia General Purpose Processor
EM_NS32K = 97 # National Semiconductor 32000 series
EM_TPC = 98 # Tenor Network TPC processor
EM_SNP1K = 99 # Trebia SNP 1000 processor
EM_ST200 = 100 # STMicroelectronics (www.st.com) ST200
EM_IP2K = 101 # Ubicom IP2xxx microcontroller family
EM_MAX = 102 # MAX Processor
EM_CR = 103 # National Semiconductor CompactRISC microprocessor
EM_F2MC16 = 104 # Fujitsu F2MC16
EM_MSP430 = 105 # Texas Instruments embedded microcontroller msp430
EM_BLACKFIN = 106 # Analog Devices Blackfin (DSP) processor
EM_SE_C33 = 107 # S1C33 Family of Seiko Epson processors
EM_SEP = 108 # Sharp embedded microprocessor
EM_ARCA = 109 # Arca RISC Microprocessor
EM_UNICORE = 110 # Microprocessor series from PKU-Unity Ltd.
EM_EXCESS = 111 # eXcess: 16/32/64-bit configurable embedded CPU
EM_DXP = 112 # Icera Semiconductor Inc. Deep Execution Processor
EM_ALTERA_NIOS2 = 113 # Altera Nios II soft-core processor
EM_CRX = 114 # National Semiconductor CompactRISC CRX
EM_XGATE = 115 # Motorola XGATE embedded processor
EM_C166 = 116 # Infineon C16x/XC16x processor
EM_M16C = 117 # Renesas M16C series microprocessors
EM_DSPIC30F = 118 # Microchip Technology dsPIC30F Digital Signal Controller
EM_CE = 119 # Freescale Communication Engine RISC core
EM_M32C = 120 # Renesas M32C series microprocessors
EM_TSK3000 = 131 # Altium TSK3000 core
EM_RS08 = 132 # Freescale RS08 embedded processor
EM_SHARC = 133 # Analog Devices SHARC family of 32-bit DSP processors
EM_ECOG2 = 134 # Cyan Technology eCOG2 microprocessor
EM_SCORE7 = 135 # Sunplus S+core7 RISC processor
EM_DSP24 = 136 # New Japan Radio (NJR) 24-bit DSP Processor
EM_VIDEOCORE3 = 137 # Broadcom VideoCore III processor
EM_LATTICEMICO32 = 138 # RISC processor for Lattice FPGA architecture
EM_SE_C17 = 139 # Seiko Epson C17 family
EM_TI_C6000 = 140 # The Texas Instruments TMS320C6000 DSP family
EM_TI_C2000 = 141 # The Texas Instruments TMS320C2000 DSP family
EM_TI_C5500 = 142 # The Texas Instruments TMS320C55x DSP family
EM_MMDSP_PLUS = 160 # STMicroelectronics 64bit VLIW Data Signal Processor
EM_CYPRESS_M8C = 161 # Cypress M8C microprocessor
EM_R32C = 162 # Renesas R32C series microprocessors
EM_TRIMEDIA = 163 # NXP Semiconductors TriMedia architecture family
EM_HEXAGON = 164 # Qualcomm Hexagon processor
EM_8051 = 165 # Intel 8051 and variants
EM_STXP7X = 166 # STMicroelectronics STxP7x RISC processors
EM_NDS32 = 167 # Andes Technology compact code size embedded RISC
EM_ECOG1 = 168 # Cyan Technology eCOG1X family
EM_ECOG1X = 168 # Cyan Technology eCOG1X family
EM_MAXQ30 = 169 # Dallas Semiconductor MAXQ30 Core Micro-controllers
EM_XIMO16 = 170 # New Japan Radio (NJR) 16-bit DSP Processor
EM_MANIK = 171 # M2000 Reconfigurable RISC Microprocessor
EM_CRAYNV2 = 172 # Cray Inc. NV2 vector architecture
EM_RX = 173 # Renesas RX family
EM_METAG = 174 # Imagination Technologies META processor architecture
EM_MCST_ELBRUS = 175 # MCST Elbrus general purpose hardware architecture
EM_ECOG16 = 176 # Cyan Technology eCOG16 family
EM_CR16 = 177 # National Semiconductor CompactRISC CR16 16-bit microprocessor
EM_ETPU = 178 # Freescale Extended Time Processing Unit
EM_SLE9X = 179 # Infineon Technologies SLE9X core
EM_L10M = 180 # Intel L10M
EM_K10M = 181 # Intel K10M
EM_AARCH64 = 183 # ARM AArch64
EM_AVR32 = 185 # Atmel Corporation 32-bit microprocessor family
EM_STM8 = 186 # STMicroeletronics STM8 8-bit microcontroller
EM_TILE64 = 187 # Tilera TILE64 multicore architecture family
EM_TILEPRO = 188 # Tilera TILEPro multicore architecture family
EM_CUDA = 190 # NVIDIA CUDA architecture
EM_TILEGX = 191 # Tilera TILE-Gx multicore architecture family
EM_CLOUDSHIELD = 192 # CloudShield architecture family
EM_COREA_1ST = 193 # KIPO-KAIST Core-A 1st generation processor family
EM_COREA_2ND = 194 # KIPO-KAIST Core-A 2nd generation processor family
EM_ARC_COMPACT2 = 195 # Synopsys ARCompact V2
EM_OPEN8 = 196 # Open8 8-bit RISC soft processor core
EM_RL78 = 197 # Renesas RL78 family
EM_VIDEOCORE5 = 198 # Broadcom VideoCore V processor
EM_78KOR = 199 # Renesas 78KOR family
EM_56800EX = 200 # Freescale 56800EX Digital Signal Controller (DSC)
EM_BA1 = 201 # Beyond BA1 CPU architecture
EM_BA2 = 202 # Beyond BA2 CPU architecture
EM_XCORE = 203 # XMOS xCORE processor family
EM_MCHP_PIC = 204 # Microchip 8-bit PIC(r) family
EM_INTEL205 = 205 # Reserved by Intel
EM_INTEL206 = 206 # Reserved by Intel
EM_INTEL207 = 207 # Reserved by Intel
EM_INTEL208 = 208 # Reserved by Intel
EM_INTEL209 = 209 # Reserved by Intel
EM_KM32 = 210 # KM211 KM32 32-bit processor
EM_KMX32 = 211 # KM211 KMX32 32-bit processor
EM_KMX16 = 212 # KM211 KMX16 16-bit processor
EM_KMX8 = 213 # KM211 KMX8 8-bit processor
EM_KVARC = 214 # KM211 KVARC processor
EM_CDP = 215 # Paneve CDP architecture family
EM_COGE = 216 # Cognitive Smart Memory Processor
EM_COOL = 217 # iCelero CoolEngine
EM_NORC = 218 # Nanoradio Optimized RISC
EM_CSR_KALIMBA = 219 # CSR Kalimba architecture family
EM_AMDGPU = 224 # AMD GPU architecture
# EI_CLASS - Object file classes.
ELFCLASSNONE = 0
ELFCLASS32 = 1 # 32-bit object file
ELFCLASS64 = 2 # 64-bit object file
# EI_DATA - Object file byte orderings.
ELFDATANONE = 0 # Invalid data encoding.
ELFDATA2LSB = 1 # Little-endian object file
ELFDATA2MSB = 2 # Big-endian object file
# OS ABI identification.
ELFOSABI_NONE = 0 # UNIX System V ABI
ELFOSABI_HPUX = 1 # HP-UX operating system
ELFOSABI_NETBSD = 2 # NetBSD
ELFOSABI_GNU = 3 # GNU/Linux
ELFOSABI_LINUX = 3 # Historical alias for ELFOSABI_GNU.
ELFOSABI_HURD = 4 # GNU/Hurd
ELFOSABI_SOLARIS = 6 # Solaris
ELFOSABI_AIX = 7 # AIX
ELFOSABI_IRIX = 8 # IRIX
ELFOSABI_FREEBSD = 9 # FreeBSD
ELFOSABI_TRU64 = 10 # TRU64 UNIX
ELFOSABI_MODESTO = 11 # Novell Modesto
ELFOSABI_OPENBSD = 12 # OpenBSD
ELFOSABI_OPENVMS = 13 # OpenVMS
ELFOSABI_NSK = 14 # Hewlett-Packard Non-Stop Kernel
ELFOSABI_AROS = 15 # AROS
ELFOSABI_FENIXOS = 16 # FenixOS
ELFOSABI_CLOUDABI = 17 # Nuxi CloudABI
ELFOSABI_C6000_ELFABI = 64 # Bare-metal TMS320C6000
ELFOSABI_AMDGPU_HSA = 64 # AMD HSA runtime
ELFOSABI_C6000_LINUX = 65 # Linux TMS320C6000
ELFOSABI_ARM = 97 # ARM
ELFOSABI_STANDALONE = 255 # Standalone (embedded) application
# Section header types
SHT_NULL = 0 # No associated section (inactive entry).
SHT_PROGBITS = 1 # Program-defined contents.
SHT_SYMTAB = 2 # Symbol table.
SHT_STRTAB = 3 # String table.
SHT_RELA = 4 # Relocation entries; explicit addends.
SHT_HASH = 5 # Symbol hash table.
SHT_DYNAMIC = 6 # Information for dynamic linking.
SHT_NOTE = 7 # Information about the file.
SHT_NOBITS = 8 # Data occupies no space in the file.
SHT_REL = 9 # Relocation entries; no explicit addends.
SHT_SHLIB = 10 # Reserved.
SHT_DYNSYM = 11 # Symbol table.
SHT_INIT_ARRAY = 14 # Pointers to initialization functions.
SHT_FINI_ARRAY = 15 # Pointers to termination functions.
SHT_PREINIT_ARRAY = 16 # Pointers to pre-init functions.
SHT_GROUP = 17 # Section group.
SHT_SYMTAB_SHNDX = 18 # Indices for SHN_XINDEX entries.
SHT_LOOS = 0x60000000
SHT_HIOS = 0x6fffffff
SHT_LOPROC = 0x70000000
SHT_HIPROC = 0x7fffffff
SHT_LOUSER = 0x80000000
SHT_HIUSER = 0xffffffff
SHT_GNU_ATTRIBUTES = 0x6ffffff5
SHT_GNU_HASH = 0x6ffffff6
SHT_GNU_verdef = 0x6ffffffd
SHT_GNU_verneed = 0x6ffffffe
SHT_GNU_versym = 0x6fffffff
SHT_ARM_EXIDX = 0x70000001
SHT_ARM_PREEMPTMAP = 0x70000002
SHT_ARM_ATTRIBUTES = 0x70000003
SHT_ARM_DEBUGOVERLAY = 0x70000004
SHT_ARM_OVERLAYSECTION = 0x70000005
SHT_HEX_ORDERED = 0x70000000
SHT_X86_64_UNWIND = 0x70000001
SHT_MIPS_REGINFO = 0x70000006
SHT_MIPS_OPTIONS = 0x7000000d
SHT_MIPS_ABIFLAGS = 0x7000002a
# Special Section Indexes
SHN_UNDEF = 0
SHN_LORESERVE = 0xff00
SHN_LOPROC = 0xff00
SHN_HIPROC = 0xff1f
SHN_ABS = 0xfff1
SHN_COMMON = 0xfff2
SHN_HIRESERVE = 0xffff
# The size (in bytes) of symbol table entries.
SYMENTRY_SIZE32 = 16 # 32-bit symbol entry size
SYMENTRY_SIZE64 = 24 # 64-bit symbol entry size.
# Symbol bindings.
STB_LOCAL = 0 # Local symbol, not visible outside obj file containing def
STB_GLOBAL = 1 # Global symbol, visible to all object files being combined
STB_WEAK = 2 # Weak symbol, like global but lower-precedence
STB_GNU_UNIQUE = 10
STB_LOOS = 10 # Lowest operating system-specific binding type
STB_HIOS = 12 # Highest operating system-specific binding type
STB_LOPROC = 13 # Lowest processor-specific binding type
STB_HIPROC = 15 # Highest processor-specific binding type
# Symbol types.
STT_NOTYPE = 0 # Symbol's type is not specified
STT_OBJECT = 1 # Symbol is a data object (variable, array, etc.)
STT_FUNC = 2 # Symbol is executable code (function, etc.)
STT_SECTION = 3 # Symbol refers to a section
STT_FILE = 4 # Local, absolute symbol that refers to a file
STT_COMMON = 5 # An uninitialized common block
STT_TLS = 6 # Thread local data object
STT_GNU_IFUNC = 10 # GNU indirect function
STT_LOOS = 10 # Lowest operating system-specific symbol type
STT_HIOS = 12 # Highest operating system-specific symbol type
STT_LOPROC = 13 # Lowest processor-specific symbol type
STT_HIPROC = 15 # Highest processor-specific symbol type
STV_DEFAULT = 0 # Visibility is specified by binding type
STV_INTERNAL = 1 # Defined by processor supplements
STV_HIDDEN = 2 # Not visible to other components
STV_PROTECTED = 3 # Visible in other components but not preemptable
# Symbol number.
STN_UNDEF = 0
PT_NULL = 0 # Unused segment.
PT_LOAD = 1 # Loadable segment.
PT_DYNAMIC = 2 # Dynamic linking information.
PT_INTERP = 3 # Interpreter pathname.
PT_NOTE = 4 # Auxiliary information.
PT_SHLIB = 5 # Reserved.
PT_PHDR = 6 # The program header table itself.
PT_TLS = 7 # The thread-local storage template.
PT_LOOS = 0x60000000 # Lowest operating system-specific pt entry type.
PT_HIOS = 0x6fffffff # Highest operating system-specific pt entry type.
PT_LOPROC = 0x70000000 # Lowest processor-specific program hdr entry type.
PT_HIPROC = 0x7fffffff # Highest processor-specific program hdr entry type.
PT_GNU_EH_FRAME = 0x6474e550
PT_SUNW_EH_FRAME = 0x6474e550
PT_SUNW_UNWIND = 0x6464e550
PT_GNU_STACK = 0x6474e551
PT_GNU_RELRO = 0x6474e552
# Segment flag bits.
PF_X = 1 # Execute
PF_W = 2 # Write
PF_R = 4 # Read
PF_MASKOS = 0x0ff00000 # Bits for operating system-specific semantics.
PF_MASKPROC = 0xf0000000 # Bits for processor-specific semantics.
# Note types
NT_PRSTATUS = 1
NT_PRFPREG = 2
NT_PRPSINFO = 3
NT_TASKSTRUCT = 4
NT_AUXV = 6
NT_SIGINFO = 0x53494749
NT_FILE = 0x46494c45
NT_PRXFPREG = 0x46e62b7f
NT_PPC_VMX = 0x100
NT_PPC_SPE = 0x101
NT_PPC_VSX = 0x102
NT_386_TLS = 0x200
NT_386_IOPERM = 0x201
NT_X86_XSTATE = 0x202
NT_S390_HIGH_GPRS = 0x300
NT_S390_TIMER = 0x301
NT_S390_TODCMP = 0x302
NT_S390_TODPREG = 0x303
NT_S390_CTRS = 0x304
NT_S390_PREFIX = 0x305
NT_S390_LAST_BREAK = 0x306
NT_S390_SYSTEM_CALL = 0x307
NT_S390_TDB = 0x308
NT_S390_VXRS_LOW = 0x309
NT_S390_VXRS_HIGH = 0x30a
NT_ARM_VFP = 0x400
NT_ARM_TLS = 0x401
NT_ARM_HW_BREAK = 0x402
NT_ARM_HW_WATCH = 0x403
NT_ARM_SYSTEM_CALL = 0x404
NT_METAG_CBUF = 0x500
NT_METAG_RPIPE = 0x501
NT_METAG_TLS = 0x502
# NT_AUXV defines
AT_NULL = 0 # End of auxv.
AT_IGNORE = 1 # Ignore entry.
AT_EXECFD = 2 # File descriptor of program.
AT_PHDR = 3 # Program headers.
AT_PHENT = 4 # Size of program header.
AT_PHNUM = 5 # Number of program headers.
AT_PAGESZ = 6 # Page size.
AT_BASE = 7 # Interpreter base address.
AT_FLAGS = 8 # Flags.
AT_ENTRY = 9 # Program entry point.
AT_NOTELF = 10 # Set if program is not an ELF.
AT_UID = 11 # UID.
AT_EUID = 12 # Effective UID.
AT_GID = 13 # GID.
AT_EGID = 14 # Effective GID.
AT_CLKTCK = 17 # Clock frequency (e.g. times(2)).
AT_PLATFORM = 15 # String identifying platform.
AT_HWCAP = 16 # Machine dependent hints about processor capabilities.
AT_FPUCW = 18 # Used FPU control word.
AT_DCACHEBSIZE = 19 # Data cache block size.
AT_ICACHEBSIZE = 20 # Instruction cache block size.
AT_UCACHEBSIZE = 21 # Unified cache block size.
AT_IGNOREPPC = 22 # Entry should be ignored.
AT_SECURE = 23 # Boolean, was exec setuid-like?
AT_BASE_PLATFORM = 24 # String identifying real platforms.
AT_RANDOM = 25 # Address of 16 random bytes.
AT_EXECFN = 31 # Filename of executable.
AT_SYSINFO = 32 # Pointer to the global system page used for sys calls
AT_SYSINFO_EHDR = 33
AT_L1I_CACHESHAPE = 34 # Shapes of the caches.
AT_L1D_CACHESHAPE = 35
AT_L2_CACHESHAPE = 36
AT_L3_CACHESHAPE = 37
DT_NULL = 0 # Marks end of dynamic array.
DT_NEEDED = 1 # String table offset of needed library.
DT_PLTRELSZ = 2 # Size of relocation entries in PLT.
DT_PLTGOT = 3 # Address associated with linkage table.
DT_HASH = 4 # Address of symbolic hash table.
DT_STRTAB = 5 # Address of dynamic string table.
DT_SYMTAB = 6 # Address of dynamic symbol table.
DT_RELA = 7 # Address of relocation table (Rela entries).
DT_RELASZ = 8 # Size of Rela relocation table.
DT_RELAENT = 9 # Size of a Rela relocation entry.
DT_STRSZ = 10 # Total size of the string table.
DT_SYMENT = 11 # Size of a symbol table entry.
DT_INIT = 12 # Address of initialization function.
DT_FINI = 13 # Address of termination function.
DT_SONAME = 14 # String table offset of a shared objects name.
DT_RPATH = 15 # String table offset of library search path.
DT_SYMBOLIC = 16 # Changes symbol resolution algorithm.
DT_REL = 17 # Address of relocation table (Rel entries).
DT_RELSZ = 18 # Size of Rel relocation table.
DT_RELENT = 19 # Size of a Rel relocation entry.
DT_PLTREL = 20 # Type of relocation entry used for linking.
DT_DEBUG = 21 # Reserved for debugger.
DT_TEXTREL = 22 # Relocations exist for non-writable segments.
DT_JMPREL = 23 # Address of relocations associated with PLT.
DT_BIND_NOW = 24 # Process all relocations before execution.
DT_INIT_ARRAY = 25 # Pointer to array of initialization functions.
DT_FINI_ARRAY = 26 # Pointer to array of termination functions.
DT_INIT_ARRAYSZ = 27 # Size of DT_INIT_ARRAY.
DT_FINI_ARRAYSZ = 28 # Size of DT_FINI_ARRAY.
DT_RUNPATH = 29 # String table offset of lib search path.
DT_FLAGS = 30 # Flags.
DT_PREINIT_ARRAY = 32
DT_PREINIT_ARRAYSZ = 33
DT_MAXPOSTAGS = 34
DT_GNU_HASH = 0x6FFFFEF5
DT_TLSDESC_PLT = 0x6FFFFEF6 # Location of PLT entry for TLS resolver calls.
DT_TLSDESC_GOT = 0x6FFFFEF7 # Location of GOT entry.
DT_RELACOUNT = 0x6FFFFFF9 # ELF32_Rela count.
DT_RELCOUNT = 0x6FFFFFFA # ELF32_Rel count.
DT_FLAGS_1 = 0X6FFFFFFB # Flags_1.
DT_VERSYM = 0x6FFFFFF0 # The address of .gnu.version section.
DT_VERDEF = 0X6FFFFFFC # The address of the version definition table.
DT_VERDEFNUM = 0X6FFFFFFD # The number of entries in DT_VERDEF.
DT_VERNEED = 0X6FFFFFFE # The address of the version Dependency table.
DT_VERNEEDNUM = 0X6FFFFFFF # The number of entries in DT_VERNEED.
class DynamicTags(dict_utils.Enum):
enum = {
'DT_NULL': DT_NULL,
'DT_NEEDED': DT_NEEDED,
'DT_PLTRELSZ': DT_PLTRELSZ,
'DT_PLTGOT': DT_PLTGOT,
'DT_HASH': DT_HASH,
'DT_STRTAB': DT_STRTAB,
'DT_SYMTAB': DT_SYMTAB,
'DT_RELA': DT_RELA,
'DT_RELASZ': DT_RELASZ,
'DT_RELAENT': DT_RELAENT,
'DT_STRSZ': DT_STRSZ,
'DT_SYMENT': DT_SYMENT,
'DT_INIT': DT_INIT,
'DT_FINI': DT_FINI,
'DT_SONAME': DT_SONAME,
'DT_RPATH': DT_RPATH,
'DT_SYMBOLIC': DT_SYMBOLIC,
'DT_REL': DT_REL,
'DT_RELSZ': DT_RELSZ,
'DT_RELENT': DT_RELENT,
'DT_PLTREL': DT_PLTREL,
'DT_DEBUG': DT_DEBUG,
'DT_TEXTREL': DT_TEXTREL,
'DT_JMPREL': DT_JMPREL,
'DT_BIND_NOW': DT_BIND_NOW,
'DT_INIT_ARRAY': DT_INIT_ARRAY,
'DT_FINI_ARRAY': DT_FINI_ARRAY,
'DT_INIT_ARRAYSZ': DT_INIT_ARRAYSZ,
'DT_FINI_ARRAYSZ': DT_FINI_ARRAYSZ,
'DT_RUNPATH': DT_RUNPATH,
'DT_FLAGS': DT_FLAGS,
'DT_PREINIT_ARRAY': DT_PREINIT_ARRAY,
'DT_PREINIT_ARRAYSZ': DT_PREINIT_ARRAYSZ,
'DT_GNU_HASH': DT_GNU_HASH,
'DT_TLSDESC_PLT': DT_TLSDESC_PLT,
'DT_TLSDESC_GOT': DT_TLSDESC_GOT,
'DT_RELACOUNT': DT_RELACOUNT,
'DT_RELCOUNT': DT_RELCOUNT,
'DT_FLAGS_1': DT_FLAGS_1,
'DT_VERSYM': DT_VERSYM,
'DT_VERDEF': DT_VERDEF,
'DT_VERDEFNUM': DT_VERDEFNUM,
'DT_VERNEED': DT_VERNEED,
'DT_VERNEEDNUM': DT_VERNEEDNUM,
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
# DT_FLAGS bits
DW_FLAGS_BITS = [
('DF_ORIGIN', 0x1),
('DF_SYMBOLIC', 0x2),
('DF_TEXTREL', 0x4),
('DF_BIND', 0x8),
('DF_STATIC', 0x10)]
# DT_FLAGS_1 bits
DW_FLAGS_1_BITS = [
('DF_1_NOW', 0x1),
('DF_1_GLOBAL', 0x2),
('DF_1_GROUP', 0x4),
('DF_1_NODELETE', 0x8),
('DF_1_LOADFLTR', 0x10),
('DF_1_INITFIRST', 0x20),
('DF_1_NOOPEN', 0x40),
('DF_1_ORIGIN', 0x80),
('DF_1_DIRECT', 0x100),
('DF_1_INTERPOSE', 0x400),
('DF_1_NODEFLIB', 0x800),
('DF_1_NODUMP', 0x1000),
('DF_1_CONFALT', 0x2000),
('DF_1_ENDFILTEE', 0x4000),
('DF_1_DISPRELDNE', 0x8000),
('DF_1_DISPRELPND', 0x10000),
('DF_1_NODIRECT', 0x20000),
('DF_1_IGNMULDEF', 0x40000),
('DF_1_NOKSYMS', 0x80000),
('DF_1_NOHDR', 0x100000),
('DF_1_EDITED', 0x200000),
('DF_1_NORELOC', 0x400000),
('DF_1_SYMINTPOSE', 0x800000),
('DF_1_GLOBAUDIT', 0x1000000),
('DF_1_SINGLETON', 0x2000000)]
class AuxvType(dict_utils.Enum):
enum = {
'AT_NULL': AT_NULL,
'AT_IGNORE': AT_IGNORE,
'AT_EXECFD': AT_EXECFD,
'AT_PHDR': AT_PHDR,
'AT_PHENT': AT_PHENT,
'AT_PHNUM': AT_PHNUM,
'AT_PAGESZ': AT_PAGESZ,
'AT_BASE': AT_BASE,
'AT_FLAGS': AT_FLAGS,
'AT_ENTRY': AT_ENTRY,
'AT_NOTELF': AT_NOTELF,
'AT_UID': AT_UID,
'AT_EUID': AT_EUID,
'AT_GID': AT_GID,
'AT_EGID': AT_EGID,
'AT_CLKTCK': AT_CLKTCK,
'AT_PLATFORM': AT_PLATFORM,
'AT_HWCAP': AT_HWCAP,
'AT_FPUCW': AT_FPUCW,
'AT_DCACHEBSIZE': AT_DCACHEBSIZE,
'AT_ICACHEBSIZE': AT_ICACHEBSIZE,
'AT_UCACHEBSIZE': AT_UCACHEBSIZE,
'AT_IGNOREPPC': AT_IGNOREPPC,
'AT_SECURE': AT_SECURE,
'AT_BASE_PLATFORM': AT_BASE_PLATFORM,
'AT_RANDOM': AT_RANDOM,
'AT_EXECFN': AT_EXECFN,
'AT_SYSINFO': AT_SYSINFO,
'AT_SYSINFO_EHDR': AT_SYSINFO_EHDR,
'AT_L1I_CACHESHAPE': AT_L1I_CACHESHAPE,
'AT_L1D_CACHESHAPE': AT_L1D_CACHESHAPE,
'AT_L2_CACHESHAPE': AT_L2_CACHESHAPE,
'AT_L3_CACHESHAPE': AT_L3_CACHESHAPE
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class CoreNoteType(dict_utils.Enum):
enum = {
'NT_PRSTATUS': NT_PRSTATUS,
'NT_PRFPREG': NT_PRFPREG,
'NT_PRPSINFO': NT_PRPSINFO,
'NT_TASKSTRUCT': NT_TASKSTRUCT,
'NT_AUXV': NT_AUXV,
'NT_SIGINFO': NT_SIGINFO,
'NT_FILE': NT_FILE,
'NT_PRXFPREG': NT_PRXFPREG,
'NT_PPC_VMX': NT_PPC_VMX,
'NT_PPC_SPE': NT_PPC_SPE,
'NT_PPC_VSX': NT_PPC_VSX,
'NT_386_TLS': NT_386_TLS,
'NT_386_IOPERM': NT_386_IOPERM,
'NT_X86_XSTATE': NT_X86_XSTATE,
'NT_S390_HIGH_GPRS': NT_S390_HIGH_GPRS,
'NT_S390_TIMER': NT_S390_TIMER,
'NT_S390_TODCMP': NT_S390_TODCMP,
'NT_S390_TODPREG': NT_S390_TODPREG,
'NT_S390_CTRS': NT_S390_CTRS,
'NT_S390_PREFIX': NT_S390_PREFIX,
'NT_S390_LAST_BREAK': NT_S390_LAST_BREAK,
'NT_S390_SYSTEM_CALL': NT_S390_SYSTEM_CALL,
'NT_S390_TDB': NT_S390_TDB,
'NT_S390_VXRS_LOW': NT_S390_VXRS_LOW,
'NT_S390_VXRS_HIGH': NT_S390_VXRS_HIGH,
'NT_ARM_VFP': NT_ARM_VFP,
'NT_ARM_TLS': NT_ARM_TLS,
'NT_ARM_HW_BREAK': NT_ARM_HW_BREAK,
'NT_ARM_HW_WATCH': NT_ARM_HW_WATCH,
'NT_ARM_SYSTEM_CALL': NT_ARM_SYSTEM_CALL,
'NT_METAG_CBUF': NT_METAG_CBUF,
'NT_METAG_RPIPE': NT_METAG_RPIPE,
'NT_METAG_TLS': NT_METAG_TLS
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class ProgramHeaderType(dict_utils.Enum):
enum = {
'PT_NULL': PT_NULL,
'PT_LOAD': PT_LOAD,
'PT_DYNAMIC': PT_DYNAMIC,
'PT_INTERP': PT_INTERP,
'PT_NOTE': PT_NOTE,
'PT_SHLIB': PT_SHLIB,
'PT_PHDR': PT_PHDR,
'PT_TLS': PT_TLS,
'PT_LOOS': PT_LOOS,
'PT_HIOS': PT_HIOS,
'PT_LOPROC': PT_LOPROC,
'PT_HIPROC': PT_HIPROC,
'PT_GNU_EH_FRAME': PT_GNU_EH_FRAME,
'PT_SUNW_EH_FRAME': PT_SUNW_EH_FRAME,
'PT_SUNW_UNWIND': PT_SUNW_UNWIND,
'PT_GNU_STACK': PT_GNU_STACK,
'PT_GNU_RELRO': PT_GNU_RELRO
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class Identification(dict_utils.Enum):
enum = {
'EI_MAG0': EI_MAG0,
'EI_MAG1': EI_MAG1,
'EI_MAG2': EI_MAG2,
'EI_MAG3': EI_MAG3,
'EI_CLASS': EI_CLASS,
'EI_DATA': EI_DATA,
'EI_VERSION': EI_VERSION,
'EI_OSABI': EI_OSABI,
'EI_ABIVERSION': EI_ABIVERSION,
'EI_PAD': EI_PAD
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class ElfClass(dict_utils.Enum):
enum = {
'ELFCLASSNONE': ELFCLASSNONE,
'ELFCLASS32': ELFCLASS32,
'ELFCLASS64': ELFCLASS64
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class ElfData(dict_utils.Enum):
enum = {
'ELFDATANONE': ELFDATANONE,
'ELFDATA2LSB': ELFDATA2LSB,
'ELFDATA2MSB': ELFDATA2MSB
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class FileType(dict_utils.Enum):
enum = {
'ET_NONE': ET_NONE,
'ET_REL': ET_REL,
'ET_EXEC': ET_EXEC,
'ET_DYN': ET_DYN,
'ET_CORE': ET_CORE
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class ElfOSABI(dict_utils.Enum):
enum = {
'ELFOSABI_NONE': ELFOSABI_NONE,
'ELFOSABI_HPUX': ELFOSABI_HPUX,
'ELFOSABI_NETBSD': ELFOSABI_NETBSD,
'ELFOSABI_GNU': ELFOSABI_GNU,
'ELFOSABI_LINUX': ELFOSABI_LINUX,
'ELFOSABI_HURD': ELFOSABI_HURD,
'ELFOSABI_SOLARIS': ELFOSABI_SOLARIS,
'ELFOSABI_AIX': ELFOSABI_AIX,
'ELFOSABI_IRIX': ELFOSABI_IRIX,
'ELFOSABI_FREEBSD': ELFOSABI_FREEBSD,
'ELFOSABI_TRU64': ELFOSABI_TRU64,
'ELFOSABI_MODESTO': ELFOSABI_MODESTO,
'ELFOSABI_OPENBSD': ELFOSABI_OPENBSD,
'ELFOSABI_OPENVMS': ELFOSABI_OPENVMS,
'ELFOSABI_NSK': ELFOSABI_NSK,
'ELFOSABI_AROS': ELFOSABI_AROS,
'ELFOSABI_FENIXOS': ELFOSABI_FENIXOS,
'ELFOSABI_CLOUDABI': ELFOSABI_CLOUDABI,
'ELFOSABI_C6000_ELFABI': ELFOSABI_C6000_ELFABI,
'ELFOSABI_AMDGPU_HSA': ELFOSABI_AMDGPU_HSA,
'ELFOSABI_C6000_LINUX': ELFOSABI_C6000_LINUX,
'ELFOSABI_ARM': ELFOSABI_ARM,
'ELFOSABI_STANDALONE': ELFOSABI_STANDALONE
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class Machine(dict_utils.Enum):
enum = {
'EM_NONE': EM_NONE,
'EM_M32': EM_M32,
'EM_SPARC': EM_SPARC,
'EM_386': EM_386,
'EM_68K': EM_68K,
'EM_88K': EM_88K,
'EM_IAMCU': EM_IAMCU,
'EM_860': EM_860,
'EM_MIPS': EM_MIPS,
'EM_S370': EM_S370,
'EM_MIPS_RS3_LE': EM_MIPS_RS3_LE,
'EM_PARISC': EM_PARISC,
'EM_VPP500': EM_VPP500,
'EM_SPARC32PLUS': EM_SPARC32PLUS,
'EM_960': EM_960,
'EM_PPC': EM_PPC,
'EM_PPC64': EM_PPC64,
'EM_S390': EM_S390,
'EM_SPU': EM_SPU,
'EM_V800': EM_V800,
'EM_FR20': EM_FR20,
'EM_RH32': EM_RH32,
'EM_RCE': EM_RCE,
'EM_ARM': EM_ARM,
'EM_ALPHA': EM_ALPHA,
'EM_SH': EM_SH,
'EM_SPARCV9': EM_SPARCV9,
'EM_TRICORE': EM_TRICORE,
'EM_ARC': EM_ARC,
'EM_H8_300': EM_H8_300,
'EM_H8_300H': EM_H8_300H,
'EM_H8S': EM_H8S,
'EM_H8_500': EM_H8_500,
'EM_IA_64': EM_IA_64,
'EM_MIPS_X': EM_MIPS_X,
'EM_COLDFIRE': EM_COLDFIRE,
'EM_68HC12': EM_68HC12,
'EM_MMA': EM_MMA,
'EM_PCP': EM_PCP,
'EM_NCPU': EM_NCPU,
'EM_NDR1': EM_NDR1,
'EM_STARCORE': EM_STARCORE,
'EM_ME16': EM_ME16,
'EM_ST100': EM_ST100,
'EM_TINYJ': EM_TINYJ,
'EM_X86_64': EM_X86_64,
'EM_PDSP': EM_PDSP,
'EM_PDP10': EM_PDP10,
'EM_PDP11': EM_PDP11,
'EM_FX66': EM_FX66,
'EM_ST9PLUS': EM_ST9PLUS,
'EM_ST7': EM_ST7,
'EM_68HC16': EM_68HC16,
'EM_68HC11': EM_68HC11,
'EM_68HC08': EM_68HC08,
'EM_68HC05': EM_68HC05,
'EM_SVX': EM_SVX,
'EM_ST19': EM_ST19,
'EM_VAX': EM_VAX,
'EM_CRIS': EM_CRIS,
'EM_JAVELIN': EM_JAVELIN,
'EM_FIREPATH': EM_FIREPATH,
'EM_ZSP': EM_ZSP,
'EM_MMIX': EM_MMIX,
'EM_HUANY': EM_HUANY,
'EM_PRISM': EM_PRISM,
'EM_AVR': EM_AVR,
'EM_FR30': EM_FR30,
'EM_D10V': EM_D10V,
'EM_D30V': EM_D30V,
'EM_V850': EM_V850,
'EM_M32R': EM_M32R,
'EM_MN10300': EM_MN10300,
'EM_MN10200': EM_MN10200,
'EM_PJ': EM_PJ,
'EM_OPENRISC': EM_OPENRISC,
'EM_ARC_COMPACT': EM_ARC_COMPACT,
'EM_XTENSA': EM_XTENSA,
'EM_VIDEOCORE': EM_VIDEOCORE,
'EM_TMM_GPP': EM_TMM_GPP,
'EM_NS32K': EM_NS32K,
'EM_TPC': EM_TPC,
'EM_SNP1K': EM_SNP1K,
'EM_ST200': EM_ST200,
'EM_IP2K': EM_IP2K,
'EM_MAX': EM_MAX,
'EM_CR': EM_CR,
'EM_F2MC16': EM_F2MC16,
'EM_MSP430': EM_MSP430,
'EM_BLACKFIN': EM_BLACKFIN,
'EM_SE_C33': EM_SE_C33,
'EM_SEP': EM_SEP,
'EM_ARCA': EM_ARCA,
'EM_UNICORE': EM_UNICORE,
'EM_EXCESS': EM_EXCESS,
'EM_DXP': EM_DXP,
'EM_ALTERA_NIOS2': EM_ALTERA_NIOS2,
'EM_CRX': EM_CRX,
'EM_XGATE': EM_XGATE,
'EM_C166': EM_C166,
'EM_M16C': EM_M16C,
'EM_DSPIC30F': EM_DSPIC30F,
'EM_CE': EM_CE,
'EM_M32C': EM_M32C,
'EM_TSK3000': EM_TSK3000,
'EM_RS08': EM_RS08,
'EM_SHARC': EM_SHARC,
'EM_ECOG2': EM_ECOG2,
'EM_SCORE7': EM_SCORE7,
'EM_DSP24': EM_DSP24,
'EM_VIDEOCORE3': EM_VIDEOCORE3,
'EM_LATTICEMICO32': EM_LATTICEMICO32,
'EM_SE_C17': EM_SE_C17,
'EM_TI_C6000': EM_TI_C6000,
'EM_TI_C2000': EM_TI_C2000,
'EM_TI_C5500': EM_TI_C5500,
'EM_MMDSP_PLUS': EM_MMDSP_PLUS,
'EM_CYPRESS_M8C': EM_CYPRESS_M8C,
'EM_R32C': EM_R32C,
'EM_TRIMEDIA': EM_TRIMEDIA,
'EM_HEXAGON': EM_HEXAGON,
'EM_8051': EM_8051,
'EM_STXP7X': EM_STXP7X,
'EM_NDS32': EM_NDS32,
'EM_ECOG1': EM_ECOG1,
'EM_ECOG1X': EM_ECOG1X,
'EM_MAXQ30': EM_MAXQ30,
'EM_XIMO16': EM_XIMO16,
'EM_MANIK': EM_MANIK,
'EM_CRAYNV2': EM_CRAYNV2,
'EM_RX': EM_RX,
'EM_METAG': EM_METAG,
'EM_MCST_ELBRUS': EM_MCST_ELBRUS,
'EM_ECOG16': EM_ECOG16,
'EM_CR16': EM_CR16,
'EM_ETPU': EM_ETPU,
'EM_SLE9X': EM_SLE9X,
'EM_L10M': EM_L10M,
'EM_K10M': EM_K10M,
'EM_AARCH64': EM_AARCH64,
'EM_AVR32': EM_AVR32,
'EM_STM8': EM_STM8,
'EM_TILE64': EM_TILE64,
'EM_TILEPRO': EM_TILEPRO,
'EM_CUDA': EM_CUDA,
'EM_TILEGX': EM_TILEGX,
'EM_CLOUDSHIELD': EM_CLOUDSHIELD,
'EM_COREA_1ST': EM_COREA_1ST,
'EM_COREA_2ND': EM_COREA_2ND,
'EM_ARC_COMPACT2': EM_ARC_COMPACT2,
'EM_OPEN8': EM_OPEN8,
'EM_RL78': EM_RL78,
'EM_VIDEOCORE5': EM_VIDEOCORE5,
'EM_78KOR': EM_78KOR,
'EM_56800EX': EM_56800EX,
'EM_BA1': EM_BA1,
'EM_BA2': EM_BA2,
'EM_XCORE': EM_XCORE,
'EM_MCHP_PIC': EM_MCHP_PIC,
'EM_INTEL205': EM_INTEL205,
'EM_INTEL206': EM_INTEL206,
'EM_INTEL207': EM_INTEL207,
'EM_INTEL208': EM_INTEL208,
'EM_INTEL209': EM_INTEL209,
'EM_KM32': EM_KM32,
'EM_KMX32': EM_KMX32,
'EM_KMX16': EM_KMX16,
'EM_KMX8': EM_KMX8,
'EM_KVARC': EM_KVARC,
'EM_CDP': EM_CDP,
'EM_COGE': EM_COGE,
'EM_COOL': EM_COOL,
'EM_NORC': EM_NORC,
'EM_CSR_KALIMBA': EM_CSR_KALIMBA,
'EM_AMDGPU': EM_AMDGPU
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class SectionType(dict_utils.Enum):
enum = {
'SHT_NULL': SHT_NULL,
'SHT_PROGBITS': SHT_PROGBITS,
'SHT_SYMTAB': SHT_SYMTAB,
'SHT_STRTAB': SHT_STRTAB,
'SHT_RELA': SHT_RELA,
'SHT_HASH': SHT_HASH,
'SHT_DYNAMIC': SHT_DYNAMIC,
'SHT_NOTE': SHT_NOTE,
'SHT_NOBITS': SHT_NOBITS,
'SHT_REL': SHT_REL,
'SHT_SHLIB': SHT_SHLIB,
'SHT_DYNSYM': SHT_DYNSYM,
'SHT_INIT_ARRAY': SHT_INIT_ARRAY,
'SHT_FINI_ARRAY': SHT_FINI_ARRAY,
'SHT_PREINIT_ARRAY': SHT_PREINIT_ARRAY,
'SHT_GROUP': SHT_GROUP,
'SHT_SYMTAB_SHNDX': SHT_SYMTAB_SHNDX,
'SHT_GNU_ATTRIBUTES': SHT_GNU_ATTRIBUTES,
'SHT_GNU_HASH': SHT_GNU_HASH,
'SHT_GNU_verdef': SHT_GNU_verdef,
'SHT_GNU_verneed': SHT_GNU_verneed,
'SHT_GNU_versym': SHT_GNU_versym,
'SHT_ARM_EXIDX': SHT_ARM_EXIDX,
'SHT_ARM_PREEMPTMAP': SHT_ARM_PREEMPTMAP,
'SHT_ARM_ATTRIBUTES': SHT_ARM_ATTRIBUTES,
'SHT_ARM_DEBUGOVERLAY': SHT_ARM_DEBUGOVERLAY,
'SHT_ARM_OVERLAYSECTION': SHT_ARM_OVERLAYSECTION,
'SHT_HEX_ORDERED': SHT_HEX_ORDERED,
'SHT_X86_64_UNWIND': SHT_X86_64_UNWIND,
'SHT_MIPS_REGINFO': SHT_MIPS_REGINFO,
'SHT_MIPS_OPTIONS': SHT_MIPS_OPTIONS,
'SHT_MIPS_ABIFLAGS': SHT_MIPS_ABIFLAGS
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class SymbolBinding(dict_utils.Enum):
enum = {
'STB_LOCAL': STB_LOCAL,
'STB_GLOBAL': STB_GLOBAL,
'STB_WEAK': STB_WEAK,
'STB_GNU_UNIQUE': STB_GNU_UNIQUE
}
def __init__(self, t=0):
dict_utils.Enum.__init__(self, t, self.enum)
class SymbolType(dict_utils.Enum):
enum = {
'STT_NOTYPE': STT_NOTYPE,
'STT_OBJECT': STT_OBJECT,
'STT_FUNC': STT_FUNC,
'STT_SECTION': STT_SECTION,
'STT_FILE': STT_FILE,
'STT_COMMON': STT_COMMON,
'STT_TLS': STT_TLS,