elftools 1.3.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +111 -7
  3. data/lib/elftools/constants/machine.rb +248 -0
  4. data/lib/elftools/constants/machine_names.rb +246 -0
  5. data/lib/elftools/constants/relocation/aarch64.rb +213 -0
  6. data/lib/elftools/constants/relocation/alpha.rb +47 -0
  7. data/lib/elftools/constants/relocation/amdgpu.rb +28 -0
  8. data/lib/elftools/constants/relocation/arm.rb +150 -0
  9. data/lib/elftools/constants/relocation/avr.rb +51 -0
  10. data/lib/elftools/constants/relocation/bfin.rb +72 -0
  11. data/lib/elftools/constants/relocation/bpf.rb +21 -0
  12. data/lib/elftools/constants/relocation/cr16.rb +46 -0
  13. data/lib/elftools/constants/relocation/cris.rb +46 -0
  14. data/lib/elftools/constants/relocation/crx.rb +35 -0
  15. data/lib/elftools/constants/relocation/csky.rb +79 -0
  16. data/lib/elftools/constants/relocation/d10v.rb +23 -0
  17. data/lib/elftools/constants/relocation/d30v.rb +27 -0
  18. data/lib/elftools/constants/relocation/dlx.rb +24 -0
  19. data/lib/elftools/constants/relocation/epiphany.rb +28 -0
  20. data/lib/elftools/constants/relocation/fr30.rb +27 -0
  21. data/lib/elftools/constants/relocation/frv.rb +57 -0
  22. data/lib/elftools/constants/relocation/ft32.rb +27 -0
  23. data/lib/elftools/constants/relocation/h8.rb +69 -0
  24. data/lib/elftools/constants/relocation/hppa.rb +135 -0
  25. data/lib/elftools/constants/relocation/i370.rb +26 -0
  26. data/lib/elftools/constants/relocation/i386.rb +59 -0
  27. data/lib/elftools/constants/relocation/i860.rb +48 -0
  28. data/lib/elftools/constants/relocation/i960.rb +22 -0
  29. data/lib/elftools/constants/relocation/ia64.rb +117 -0
  30. data/lib/elftools/constants/relocation/ip2k.rb +29 -0
  31. data/lib/elftools/constants/relocation/iq2000.rb +27 -0
  32. data/lib/elftools/constants/relocation/kvx.rb +97 -0
  33. data/lib/elftools/constants/relocation/lm32.rb +32 -0
  34. data/lib/elftools/constants/relocation/loongarch.rb +144 -0
  35. data/lib/elftools/constants/relocation/m32c.rb +27 -0
  36. data/lib/elftools/constants/relocation/m32r.rb +57 -0
  37. data/lib/elftools/constants/relocation/m68hc11.rb +35 -0
  38. data/lib/elftools/constants/relocation/m68k.rb +57 -0
  39. data/lib/elftools/constants/relocation/mcore.rb +27 -0
  40. data/lib/elftools/constants/relocation/mep.rb +36 -0
  41. data/lib/elftools/constants/relocation/metag.rb +63 -0
  42. data/lib/elftools/constants/relocation/microblaze.rb +48 -0
  43. data/lib/elftools/constants/relocation/mips.rb +125 -0
  44. data/lib/elftools/constants/relocation/mmix.rb +51 -0
  45. data/lib/elftools/constants/relocation/mn10200.rb +22 -0
  46. data/lib/elftools/constants/relocation/mn10300.rb +49 -0
  47. data/lib/elftools/constants/relocation/moxie.rb +17 -0
  48. data/lib/elftools/constants/relocation/msp430.rb +27 -0
  49. data/lib/elftools/constants/relocation/msp430x.rb +37 -0
  50. data/lib/elftools/constants/relocation/mt.rb +21 -0
  51. data/lib/elftools/constants/relocation/nds32.rb +167 -0
  52. data/lib/elftools/constants/relocation/nfp.rb +41 -0
  53. data/lib/elftools/constants/relocation/nfp3200.rb +46 -0
  54. data/lib/elftools/constants/relocation/nios2.rb +74 -0
  55. data/lib/elftools/constants/relocation/or1k.rb +69 -0
  56. data/lib/elftools/constants/relocation/pj.rb +24 -0
  57. data/lib/elftools/constants/relocation/ppc.rb +131 -0
  58. data/lib/elftools/constants/relocation/ppc64.rb +177 -0
  59. data/lib/elftools/constants/relocation/pru.rb +31 -0
  60. data/lib/elftools/constants/relocation/riscv.rb +74 -0
  61. data/lib/elftools/constants/relocation/rl78.rb +70 -0
  62. data/lib/elftools/constants/relocation/rx.rb +81 -0
  63. data/lib/elftools/constants/relocation/s12z.rb +22 -0
  64. data/lib/elftools/constants/relocation/s390.rb +82 -0
  65. data/lib/elftools/constants/relocation/score.rb +36 -0
  66. data/lib/elftools/constants/relocation/sh.rb +124 -0
  67. data/lib/elftools/constants/relocation/sparc.rb +108 -0
  68. data/lib/elftools/constants/relocation/spu.rb +32 -0
  69. data/lib/elftools/constants/relocation/tic6x.rb +48 -0
  70. data/lib/elftools/constants/relocation/tilegx.rb +134 -0
  71. data/lib/elftools/constants/relocation/tilepro.rb +105 -0
  72. data/lib/elftools/constants/relocation/v800.rb +101 -0
  73. data/lib/elftools/constants/relocation/v850.rb +66 -0
  74. data/lib/elftools/constants/relocation/vax.rb +29 -0
  75. data/lib/elftools/constants/relocation/visium.rb +30 -0
  76. data/lib/elftools/constants/relocation/wasm32.rb +16 -0
  77. data/lib/elftools/constants/relocation/x86_64.rb +68 -0
  78. data/lib/elftools/constants/relocation/xgate.rb +34 -0
  79. data/lib/elftools/constants/relocation/xstormy16.rb +29 -0
  80. data/lib/elftools/constants/relocation/xtensa.rb +75 -0
  81. data/lib/elftools/constants/relocation/z80.rb +28 -0
  82. data/lib/elftools/constants/relocation.rb +181 -0
  83. data/lib/elftools/constants.rb +124 -231
  84. data/lib/elftools/dynamic/hash_table.rb +216 -0
  85. data/lib/elftools/dynamic/string_table.rb +30 -0
  86. data/lib/elftools/dynamic/symbols.rb +146 -0
  87. data/lib/elftools/dynamic/tag.rb +66 -0
  88. data/lib/elftools/dynamic.rb +102 -62
  89. data/lib/elftools/elf_file.rb +73 -22
  90. data/lib/elftools/lazy_array.rb +42 -4
  91. data/lib/elftools/note.rb +6 -3
  92. data/lib/elftools/relocation.rb +94 -0
  93. data/lib/elftools/sections/dynamic_section.rb +13 -0
  94. data/lib/elftools/sections/relocation_section.rb +24 -43
  95. data/lib/elftools/sections/section.rb +4 -4
  96. data/lib/elftools/sections/sym_tab_section.rb +14 -34
  97. data/lib/elftools/sections/symbol.rb +112 -0
  98. data/lib/elftools/segments/dynamic_segment.rb +1 -0
  99. data/lib/elftools/segments/load_segment.rb +33 -5
  100. data/lib/elftools/segments/segment.rb +8 -4
  101. data/lib/elftools/structs.rb +24 -3
  102. data/lib/elftools/util.rb +1 -1
  103. data/lib/elftools/version.rb +1 -1
  104. metadata +101 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baf5180fcccc876442fd65581828e91f8a362657f788a64c36ea7e2fbcd20c5a
4
- data.tar.gz: 4372260ec8fc5ca97b96e14f6413ca5126c79f716446f804974f946ee06bd09f
3
+ metadata.gz: 4ec85f62d56b2fe312d1e3aa73093f7f2ddee77da2fc3479ce6656d2df2d06c6
4
+ data.tar.gz: 6e8d33b1c9d0b7e9f2de9684b764a33fc90164333bd9a0d2b07a647bb79895a6
5
5
  SHA512:
6
- metadata.gz: 1c5ab262e05127590f9cf1e28cc787e63db35a8fce1a9be86a55ce2e1ec813a6044a0f68d26149ad222a1cc67ef763afdf3df219b9bf8de28095f5ac4b7e9500
7
- data.tar.gz: fea4f806def364feca723f04490f80541466d39ef7ac24fa6eb491a463baa90839d2b0bc6e1234027959abe3ec7ef6ac6874afbe8cda915570ddf6f5527e2f70
6
+ metadata.gz: 37fff29d3b9cd9ca69a6a6b50289636dd8e20e54e051c42ecee1a889aca94b7cbd8b16b40a1ca8a64279c395f8d992c8cb7e501d81d10cd66c7658ecd6649727
7
+ data.tar.gz: 279fb63197a5e4a5100739734e6cba39f294eebb09fb643461fe65f55e00bcb51e6fac5d11d383fd54018f4da3e8a8e663b59614d6f6dc44f0741c64f4693855
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
+ [![Downloads](https://img.shields.io/gem/dt/elftools)](https://rubygems.org/gems/elftools)
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/elftools.svg)](https://badge.fury.io/rb/elftools)
1
4
  [![Build Status](https://github.com/david942j/rbelftools/workflows/build/badge.svg)](https://github.com/david942j/rbelftools/actions)
2
- [![Code Climate](https://codeclimate.com/github/david942j/rbelftools/badges/gpa.svg)](https://codeclimate.com/github/david942j/rbelftools)
3
- [![Issue Count](https://codeclimate.com/github/david942j/rbelftools/badges/issue_count.svg)](https://codeclimate.com/github/david942j/rbelftools)
4
- [![Test Coverage](https://codeclimate.com/github/david942j/rbelftools/badges/coverage.svg)](https://codeclimate.com/github/david942j/rbelftools/coverage)
5
- [![Inline docs](https://inch-ci.org/github/david942j/rbelftools.svg?branch=master)](https://inch-ci.org/github/david942j/rbelftools)
6
- [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/github/david942j/rbelftools/)
5
+ [![Maintainability](https://qlty.sh/gh/david942j/projects/rbelftools/maintainability.svg)](https://qlty.sh/gh/david942j/projects/rbelftools)
6
+ [![Code Coverage](https://qlty.sh/gh/david942j/projects/rbelftools/coverage.svg)](https://qlty.sh/gh/david942j/projects/rbelftools)
7
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](https://www.rubydoc.info/github/david942j/rbelftools/master)
7
8
  [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](http://choosealicense.com/licenses/mit/)
8
9
 
9
10
  # rbelftools
@@ -44,7 +45,7 @@ elf = ELFTools::ELFFile.new(File.open('spec/files/amd64.elf'))
44
45
  #=> #<ELFTools::ELFFile:0x00560b147f8328 @elf_class=64, @endian=:little, @stream=#<File:spec/files/amd64>>
45
46
 
46
47
  elf.machine
47
- #=> 'Advanced Micro Devices X86-64'
48
+ #=> 'Advanced Micro Devices X86-64 processor'
48
49
 
49
50
  elf.build_id
50
51
  #=> '73ab62cb7bc9959ce053c2b711322158708cdc07'
@@ -96,6 +97,68 @@ symbols.map(&:name).reject(&:empty?).first(5).join(' ')
96
97
  #=> "crtstuff.c __JCR_LIST__ deregister_tm_clones register_tm_clones __do_global_dtors_aux"
97
98
  ```
98
99
 
100
+ What a symbol refers to and how it is linked are recorded in `st_info` and `st_other`,
101
+ values are defined in `ELFTools::Constants::STT`, `STB`, and `STV` respectively.
102
+ ```ruby
103
+ main = symtab_section.symbol_by_name('main')
104
+ main.type == ELFTools::Constants::STT_FUNC
105
+ #=> true
106
+ main.bind == ELFTools::Constants::STB_GLOBAL
107
+ #=> true
108
+ main.visibility == ELFTools::Constants::STV_DEFAULT
109
+ #=> true
110
+
111
+ # Symbols to be resolved at runtime are not defined in any section.
112
+ symtab_section.symbol_by_name('puts@@GLIBC_2.2.5').section_index == ELFTools::Constants::SHN_UNDEF
113
+ #=> true
114
+ ```
115
+
116
+ Each of those has a name. Several constants may define one value, so naming it takes
117
+ the machine of the file, which names some of them for itself.
118
+ ```ruby
119
+ [main.type_name, main.bind_name, main.visibility_name]
120
+ #=> ["STT_FUNC", "STB_GLOBAL", "STV_DEFAULT"]
121
+
122
+ # 13 is a symbol type ARM and SPARC each define, and no one else names.
123
+ ELFTools::Constants::STT.mapping(ELFTools::Constants::EM_ARM, 13)
124
+ #=> "STT_ARM_TFUNC"
125
+ ELFTools::Constants::STT.mapping(ELFTools::Constants::EM_X86_64, 13)
126
+ #=> "<unknown>: 0xd"
127
+ ```
128
+
129
+ The symbols a file is loaded by are recorded twice, and the tags are the copy the loader
130
+ reads, so they answer even when the sections have been stripped away. Naming the symbol a
131
+ relocation points at takes nothing but the tags.
132
+ ```ruby
133
+ dynamic = elf.dynamic
134
+ dynamic.symbols.map(&:name).reject(&:empty?).first(4).join(' ')
135
+ #=> "puts __stack_chk_fail printf __libc_start_main"
136
+ dynamic.symbol_by_name('printf').type_name
137
+ #=> "STT_FUNC"
138
+ dynamic.relocations.map { |rel| dynamic.symbol_at(rel.symbol_index).name }.first(3)
139
+ #=> ["__gmon_start__", "stdin", "puts"]
140
+ ```
141
+
142
+ Nothing a file is loaded by records how large its symbol table is, because the loader
143
+ looks a name up through a hash table and jumps straight to an index rather than ever
144
+ enumerating it. `num_symbols` is therefore how far the hash table and the relocations
145
+ reach between them, which is a lower bound, while `symbol_at` is exact for any index.
146
+ ```ruby
147
+ dynamic.num_symbols
148
+ #=> 9
149
+ ```
150
+
151
+ Looking a name up is what the loader does through a hash table, rather than searching the
152
+ symbol table for it, and `symbol_by_name` does the same wherever the file records one. A
153
+ table only indexes the names a file exports, so a name it does not lead to, and a file
154
+ that records no table at all, are searched for instead.
155
+ ```ruby
156
+ libc = ELFTools::ELFFile.new(File.open('spec/files/libc.so.6'))
157
+ # Reached through DT_HASH, without reading any of the other 2244 symbols.
158
+ libc.dynamic.symbol_by_name('malloc').type_name
159
+ #=> "STT_FUNC"
160
+ ```
161
+
99
162
  ## Segments
100
163
 
101
164
  ```ruby
@@ -131,6 +194,40 @@ relocations.map { |r| symtab.symbol_at(r.symbol_index).name }
131
194
  #=> ["puts", "__stack_chk_fail", "printf", "__libc_start_main", "fgets", "scanf"]
132
195
  ```
133
196
 
197
+ Each architecture numbers relocation types on its own, so a type is named after the
198
+ machine of the file it was read from.
199
+ ```ruby
200
+ relocations.map(&:type).uniq
201
+ #=> [7]
202
+ relocations.map(&:type_name).uniq
203
+ #=> ["R_X86_64_JUMP_SLOT"]
204
+
205
+ # The very same number means something else elsewhere.
206
+ ELFTools::Constants::R::ARM::R_ARM_THM_ABS5
207
+ #=> 7
208
+ ```
209
+
210
+ A machine may also lay `r_info` out its own way. Knowing the machine is what tells
211
+ those layouts apart, so such a file reads like any other.
212
+ ```ruby
213
+ mips = ELFTools::ELFFile.new(File.open('spec/files/mips64.o'))
214
+ relocation = mips.sections_by_type(:rela).first.relocations.first
215
+ # The 64-bit MIPS ABI packs three types and a second symbol index in there.
216
+ '%x' % relocation.header.r_info
217
+ #=> "800051807"
218
+ [relocation.symbol_index, relocation.type_name]
219
+ #=> [8, "R_MIPS_GPREL16"]
220
+ ```
221
+
222
+ A relocation is recorded twice in a file that is loaded, and the tags are the copy the
223
+ loader reads, so they answer even when the sections have been stripped away.
224
+ ```ruby
225
+ elf.dynamic.relocations.size
226
+ #=> 8
227
+ elf.dynamic.relocations.map(&:type_name).uniq
228
+ #=> ["R_X86_64_GLOB_DAT", "R_X86_64_COPY", "R_X86_64_JUMP_SLOT"]
229
+ ```
230
+
134
231
  ## Patch
135
232
 
136
233
  Patch ELF is so easy!
@@ -142,7 +239,7 @@ Invoke `elf.save(filename)` to save the patched ELF into `filename`.
142
239
  ```ruby
143
240
  elf = ELFTools::ELFFile.new(File.open('spec/files/amd64.elf'))
144
241
  elf.machine
145
- #=> "Advanced Micro Devices X86-64"
242
+ #=> "Advanced Micro Devices X86-64 processor"
146
243
  elf.header.e_machine = 40
147
244
  elf.machine
148
245
  #=> "ARM"
@@ -191,6 +288,13 @@ cd rbelftools
191
288
  bundle
192
289
  bundle exec rake
193
290
  ```
291
+
292
+ Constant tables are generated from [binutils](https://sourceware.org/cgit/binutils-gdb/tree/include/elf/common.h),
293
+ regenerate them against the latest revision by
294
+ ```bash
295
+ bundle exec rake gen:constants
296
+ ```
297
+
194
298
  Any comments or suggestions are welcome!
195
299
 
196
300
  # Cross Platform
@@ -0,0 +1,248 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is generated by `bundle exec rake gen:constants`, do not edit it.
4
+ # Source: https://sourceware.org/cgit/binutils-gdb/tree/include/elf
5
+
6
+ module ELFTools
7
+ module Constants
8
+ # Machine architectures, records in +e_machine+.
9
+ module EM
10
+ EM_NONE = 0 # No machine
11
+ EM_M32 = 1 # AT&T WE 32100
12
+ EM_SPARC = 2 # SUN SPARC
13
+ EM_386 = 3 # Intel 80386
14
+ EM_68K = 4 # Motorola m68k family
15
+ EM_88K = 5 # Motorola m88k family
16
+ EM_IAMCU = 6 # Intel MCU
17
+ EM_860 = 7 # Intel 80860
18
+ EM_MIPS = 8 # MIPS R3000
19
+ EM_S370 = 9 # IBM System/370
20
+ EM_MIPS_RS3_LE = 10 # MIPS R3000 little-endian (Oct 4 1999 Draft). Deprecated
21
+ EM_PARISC = 15 # HPPA
22
+ EM_PPC_OLD = 17 # Old version of PowerPC. Deprecated
23
+ EM_VPP550 = 17 # Fujitsu VPP500
24
+ EM_SPARC32PLUS = 18 # Sun's "v8plus"
25
+ EM_960 = 19 # Intel 80960
26
+ EM_PPC = 20 # PowerPC
27
+ EM_PPC64 = 21 # 64-bit PowerPC
28
+ EM_S390 = 22 # IBM S/390
29
+ EM_SPU = 23 # Sony/Toshiba/IBM SPU
30
+ EM_V800 = 36 # NEC V800 series
31
+ EM_FR20 = 37 # Fujitsu FR20
32
+ EM_RH32 = 38 # TRW RH32
33
+ EM_MCORE = 39 # Motorola M*Core
34
+ EM_RCE = 39 # Old name for MCore
35
+ EM_ARM = 40 # ARM
36
+ EM_OLD_ALPHA = 41 # Digital Alpha
37
+ EM_SH = 42 # Renesas (formerly Hitachi) / SuperH SH
38
+ EM_SPARCV9 = 43 # SPARC v9 64-bit
39
+ EM_TRICORE = 44 # Siemens Tricore embedded processor
40
+ EM_ARC = 45 # ARC Cores
41
+ EM_H8_300 = 46 # Renesas (formerly Hitachi) H8/300
42
+ EM_H8_300H = 47 # Renesas (formerly Hitachi) H8/300H
43
+ EM_H8S = 48 # Renesas (formerly Hitachi) H8S
44
+ EM_H8_500 = 49 # Renesas (formerly Hitachi) H8/500
45
+ EM_IA_64 = 50 # Intel IA-64 Processor
46
+ EM_MIPS_X = 51 # Stanford MIPS-X
47
+ EM_COLDFIRE = 52 # Motorola Coldfire
48
+ EM_68HC12 = 53 # Motorola M68HC12
49
+ EM_MMA = 54 # Fujitsu Multimedia Accelerator
50
+ EM_PCP = 55 # Siemens PCP
51
+ EM_NCPU = 56 # Sony nCPU embedded RISC processor
52
+ EM_NDR1 = 57 # Denso NDR1 microprocessor
53
+ EM_STARCORE = 58 # Motorola Star*Core processor
54
+ EM_ME16 = 59 # Toyota ME16 processor
55
+ EM_ST100 = 60 # STMicroelectronics ST100 processor
56
+ EM_TINYJ = 61 # Advanced Logic Corp. TinyJ embedded processor
57
+ EM_X86_64 = 62 # Advanced Micro Devices X86-64 processor
58
+ EM_PDSP = 63 # Sony DSP Processor
59
+ EM_PDP10 = 64 # Digital Equipment Corp. PDP-10
60
+ EM_PDP11 = 65 # Digital Equipment Corp. PDP-11
61
+ EM_FX66 = 66 # Siemens FX66 microcontroller
62
+ EM_ST9PLUS = 67 # STMicroelectronics ST9+ 8/16 bit microcontroller
63
+ EM_ST7 = 68 # STMicroelectronics ST7 8-bit microcontroller
64
+ EM_68HC16 = 69 # Motorola MC68HC16 Microcontroller
65
+ EM_68HC11 = 70 # Motorola MC68HC11 Microcontroller
66
+ EM_68HC08 = 71 # Motorola MC68HC08 Microcontroller
67
+ EM_68HC05 = 72 # Motorola MC68HC05 Microcontroller
68
+ EM_SVX = 73 # Silicon Graphics SVx
69
+ EM_ST19 = 74 # STMicroelectronics ST19 8-bit cpu
70
+ EM_VAX = 75 # Digital VAX
71
+ EM_CRIS = 76 # Axis Communications 32-bit embedded processor
72
+ EM_JAVELIN = 77 # Infineon Technologies 32-bit embedded cpu
73
+ EM_FIREPATH = 78 # Element 14 64-bit DSP processor
74
+ EM_ZSP = 79 # LSI Logic's 16-bit DSP processor
75
+ EM_MMIX = 80 # Donald Knuth's educational 64-bit processor
76
+ EM_HUANY = 81 # Harvard's machine-independent format
77
+ EM_PRISM = 82 # SiTera Prism
78
+ EM_AVR = 83 # Atmel AVR 8-bit microcontroller
79
+ EM_FR30 = 84 # Fujitsu FR30
80
+ EM_D10V = 85 # Mitsubishi D10V
81
+ EM_D30V = 86 # Mitsubishi D30V
82
+ EM_V850 = 87 # Renesas V850 (formerly NEC V850)
83
+ EM_M32R = 88 # Renesas M32R (formerly Mitsubishi M32R)
84
+ EM_MN10300 = 89 # Matsushita MN10300
85
+ EM_MN10200 = 90 # Matsushita MN10200
86
+ EM_PJ = 91 # picoJava
87
+ EM_OR1K = 92 # OpenRISC 1000 32-bit embedded processor
88
+ EM_ARC_COMPACT = 93 # ARC International ARCompact processor
89
+ EM_XTENSA = 94 # Tensilica Xtensa Architecture
90
+ EM_SCORE_OLD = 95 # Old Sunplus S+core7 backend magic number. Written in the absence of an ABI
91
+ EM_VIDEOCORE = 95 # Alphamosaic VideoCore processor
92
+ EM_TMM_GPP = 96 # Thompson Multimedia General Purpose Processor
93
+ EM_NS32K = 97 # National Semiconductor 32000 series
94
+ EM_TPC = 98 # Tenor Network TPC processor
95
+ EM_PJ_OLD = 99 # Old value for picoJava. Deprecated
96
+ EM_SNP1K = 99 # Trebia SNP 1000 processor
97
+ EM_ST200 = 100 # STMicroelectronics ST200 microcontroller
98
+ EM_IP2K = 101 # Ubicom IP2022 micro controller
99
+ EM_MAX = 102 # MAX Processor
100
+ EM_CR = 103 # National Semiconductor CompactRISC
101
+ EM_F2MC16 = 104 # Fujitsu F2MC16
102
+ EM_MSP430 = 105 # TI msp430 micro controller
103
+ EM_BLACKFIN = 106 # ADI Blackfin
104
+ EM_SE_C33 = 107 # S1C33 Family of Seiko Epson processors
105
+ EM_SEP = 108 # Sharp embedded microprocessor
106
+ EM_ARCA = 109 # Arca RISC Microprocessor
107
+ EM_UNICORE = 110 # Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University
108
+ EM_EXCESS = 111 # eXcess: 16/32/64-bit configurable embedded CPU
109
+ EM_DXP = 112 # Icera Semiconductor Inc. Deep Execution Processor
110
+ EM_ALTERA_NIOS2 = 113 # Altera Nios II soft-core processor
111
+ EM_CRX = 114 # National Semiconductor CRX
112
+ EM_CR16_OLD = 115 # Old, value for National Semiconductor CompactRISC. Deprecated
113
+ EM_XGATE = 115 # Motorola XGATE embedded processor
114
+ EM_C166 = 116 # Infineon C16x/XC16x processor
115
+ EM_M16C = 117 # Renesas M16C series microprocessors
116
+ EM_DSPIC30F = 118 # Microchip Technology dsPIC30F Digital Signal Controller
117
+ EM_CE = 119 # Freescale Communication Engine RISC core
118
+ EM_M32C = 120 # Renesas M32C series microprocessors
119
+ EM_TSK3000 = 131 # Altium TSK3000 core
120
+ EM_RS08 = 132 # Freescale RS08 embedded processor
121
+ EM_ECOG2 = 134 # Cyan Technology eCOG2 microprocessor
122
+ EM_SCORE = 135 # Sunplus Score
123
+ EM_SCORE7 = 135 # Sunplus S+core7 RISC processor
124
+ EM_DSP24 = 136 # New Japan Radio (NJR) 24-bit DSP Processor
125
+ EM_VIDEOCORE3 = 137 # Broadcom VideoCore III processor
126
+ EM_LATTICEMICO32 = 138 # RISC processor for Lattice FPGA architecture
127
+ EM_SE_C17 = 139 # Seiko Epson C17 family
128
+ EM_TI_C6000 = 140 # Texas Instruments TMS320C6000 DSP family
129
+ EM_TI_C2000 = 141 # Texas Instruments TMS320C2000 DSP family
130
+ EM_TI_C5500 = 142 # Texas Instruments TMS320C55x DSP family
131
+ EM_TI_PRU = 144 # Texas Instruments Programmable Realtime Unit
132
+ EM_MMDSP_PLUS = 160 # STMicroelectronics 64bit VLIW Data Signal Processor
133
+ EM_CYPRESS_M8C = 161 # Cypress M8C microprocessor
134
+ EM_R32C = 162 # Renesas R32C series microprocessors
135
+ EM_TRIMEDIA = 163 # NXP Semiconductors TriMedia architecture family
136
+ EM_QDSP6 = 164 # QUALCOMM DSP6 Processor
137
+ EM_8051 = 165 # Intel 8051 and variants
138
+ EM_STXP7X = 166 # STMicroelectronics STxP7x family
139
+ EM_NDS32 = 167 # Andes Technology compact code size embedded RISC processor family
140
+ EM_ECOG1 = 168 # Cyan Technology eCOG1X family
141
+ EM_ECOG1X = 168 # Cyan Technology eCOG1X family
142
+ EM_MAXQ30 = 169 # Dallas Semiconductor MAXQ30 Core Micro-controllers
143
+ EM_XIMO16 = 170 # New Japan Radio (NJR) 16-bit DSP Processor
144
+ EM_MANIK = 171 # M2000 Reconfigurable RISC Microprocessor
145
+ EM_CRAYNV2 = 172 # Cray Inc. NV2 vector architecture
146
+ EM_RX = 173 # Renesas RX family
147
+ EM_METAG = 174 # Imagination Technologies Meta processor architecture
148
+ EM_MCST_ELBRUS = 175 # MCST Elbrus general purpose hardware architecture
149
+ EM_ECOG16 = 176 # Cyan Technology eCOG16 family
150
+ EM_CR16 = 177 # National Semiconductor CompactRISC 16-bit processor
151
+ EM_ETPU = 178 # Freescale Extended Time Processing Unit
152
+ EM_SLE9X = 179 # Infineon Technologies SLE9X core
153
+ EM_L1OM = 180 # Intel L1OM
154
+ EM_K1OM = 181 # Intel K1OM
155
+ EM_INTEL182 = 182 # Reserved by Intel
156
+ EM_AARCH64 = 183 # ARM 64-bit architecture
157
+ EM_ARM184 = 184 # Reserved by ARM
158
+ EM_AVR32 = 185 # Atmel Corporation 32-bit microprocessor family
159
+ EM_STM8 = 186 # STMicroeletronics STM8 8-bit microcontroller
160
+ EM_TILE64 = 187 # Tilera TILE64 multicore architecture family
161
+ EM_TILEPRO = 188 # Tilera TILEPro multicore architecture family
162
+ EM_MICROBLAZE = 189 # Xilinx MicroBlaze 32-bit RISC soft processor core
163
+ EM_CUDA = 190 # NVIDIA CUDA architecture
164
+ EM_TILEGX = 191 # Tilera TILE-Gx multicore architecture family
165
+ EM_CLOUDSHIELD = 192 # CloudShield architecture family
166
+ EM_COREA_1ST = 193 # KIPO-KAIST Core-A 1st generation processor family
167
+ EM_COREA_2ND = 194 # KIPO-KAIST Core-A 2nd generation processor family
168
+ EM_ARC_COMPACT2 = 195 # Synopsys ARCompact V2
169
+ EM_OPEN8 = 196 # Open8 8-bit RISC soft processor core
170
+ EM_RL78 = 197 # Renesas RL78 family
171
+ EM_VIDEOCORE5 = 198 # Broadcom VideoCore V processor
172
+ EM_78K0R = 199 # Renesas 78K0R
173
+ EM_56800EX = 200 # Freescale 56800EX Digital Signal Controller (DSC)
174
+ EM_BA1 = 201 # Beyond BA1 CPU architecture
175
+ EM_BA2 = 202 # Beyond BA2 CPU architecture
176
+ EM_XCORE = 203 # XMOS xCORE processor family
177
+ EM_MCHP_PIC = 204 # Microchip 8-bit PIC(r) family
178
+ EM_INTELGT = 205 # Intel Graphics Technology
179
+ EM_INTEL206 = 206 # Reserved by Intel
180
+ EM_INTEL207 = 207 # Reserved by Intel
181
+ EM_INTEL208 = 208 # Reserved by Intel
182
+ EM_INTEL209 = 209 # Reserved by Intel
183
+ EM_KM32 = 210 # KM211 KM32 32-bit processor
184
+ EM_KMX32 = 211 # KM211 KMX32 32-bit processor
185
+ EM_KMX16 = 212 # KM211 KMX16 16-bit processor
186
+ EM_KMX8 = 213 # KM211 KMX8 8-bit processor
187
+ EM_KVARC = 214 # KM211 KVARC processor
188
+ EM_CDP = 215 # Paneve CDP architecture family
189
+ EM_COGE = 216 # Cognitive Smart Memory Processor
190
+ EM_COOL = 217 # Bluechip Systems CoolEngine
191
+ EM_NORC = 218 # Nanoradio Optimized RISC
192
+ EM_CSR_KALIMBA = 219 # CSR Kalimba architecture family
193
+ EM_Z80 = 220 # Zilog Z80
194
+ EM_VISIUM = 221 # Controls and Data Services VISIUMcore processor
195
+ EM_FT32 = 222 # FTDI Chip FT32 high performance 32-bit RISC architecture
196
+ EM_MOXIE = 223 # Moxie processor family
197
+ EM_AMDGPU = 224 # AMD GPU architecture
198
+ EM_RISCV = 243 # RISC-V
199
+ EM_LANAI = 244 # Lanai 32-bit processor
200
+ EM_CEVA = 245 # CEVA Processor Architecture Family
201
+ EM_CEVA_X2 = 246 # CEVA X2 Processor Family
202
+ EM_BPF = 247 # Linux BPF - in-kernel virtual machine
203
+ EM_GRAPHCORE_IPU = 248 # Graphcore Intelligent Processing Unit
204
+ EM_IMG1 = 249 # Imagination Technologies
205
+ EM_NFP = 250 # Netronome Flow Processor
206
+ EM_VE = 251 # NEC Vector Engine
207
+ EM_CSKY = 252 # C-SKY processor family
208
+ EM_ARC_COMPACT3_64 = 253 # Synopsys ARCv2.3 64-bit
209
+ EM_MCS6502 = 254 # MOS Technology MCS 6502 processor
210
+ EM_ARC_COMPACT3 = 255 # Synopsys ARCv2.3 32-bit
211
+ EM_KVX = 256 # Kalray VLIW core of the MPPA processor family
212
+ EM_65816 = 257 # WDC 65816/65C816
213
+ EM_LOONGARCH = 258 # LoongArch
214
+ EM_KF32 = 259 # ChipON KungFu32
215
+ EM_U16_U8CORE = 260 # LAPIS nX-U16/U8
216
+ EM_TACHYUM = 261 # Tachyum
217
+ EM_56800EF = 262 # NXP 56800EF Digital Signal Controller (DSC)
218
+ EM_AVR_OLD = 4183 # AVR magic number. Written in the absense of an ABI
219
+ EM_MSP430_OLD = 4185 # MSP430 magic number. Written in the absense of everything
220
+ EM_ADAPTEVA_EPIPHANY = 4643 # Adapteva's Epiphany architecture
221
+ EM_MT = 9520 # Morpho MT. Written in the absense of an ABI
222
+ EM_CYGNUS_FR30 = 13_104 # FR30 magic number - no EABI available
223
+ EM_WEBASSEMBLY = 16_727 # Unofficial value for Web Assembly binaries, as used by LLVM
224
+ EM_XC16X = 18_056 # Infineon Technologies 16-bit microcontroller with C166-V2 core
225
+ EM_S12Z = 19_951 # Freescale S12Z. The Freescale toolchain generates elf files with this value
226
+ EM_CYGNUS_FRV = 21_569 # FRV magic number - no EABI available??
227
+ EM_DLX = 23_205 # DLX magic number. Written in the absense of an ABI
228
+ EM_CYGNUS_D10V = 30_288 # D10V backend magic number. Written in the absence of an ABI
229
+ EM_CYGNUS_D30V = 30_326 # D30V backend magic number. Written in the absence of an ABI
230
+ EM_IP2K_OLD = 33_303 # Ubicom IP2xxx; Written in the absense of an ABI
231
+ EM_CYGNUS_POWERPC = 36_901 # Cygnus PowerPC ELF backend. Written in the absence of an ABI
232
+ EM_ALPHA = 36_902 # Alpha backend magic number. Written in the absence of an ABI
233
+ EM_CYGNUS_M32R = 36_929 # Cygnus M32R ELF backend. Written in the absence of an ABI
234
+ EM_CYGNUS_V850 = 36_992 # V850 backend magic number. Written in the absense of an ABI
235
+ EM_S390_OLD = 41_872 # old S/390 backend magic number. Written in the absence of an ABI
236
+ EM_XTENSA_OLD = 43_975 # Old, unofficial value for Xtensa
237
+ EM_XSTORMY16 = 44_357 # Sanyo XStormy16 CPU core
238
+ EM_MICROBLAZE_OLD = 47_787 # Old MicroBlaze
239
+ EM_CYGNUS_MN10300 = 48_879 # mn10200 and mn10300 backend magic numbers. Written in the absense of an ABI
240
+ EM_CYGNUS_MN10200 = 57_005 # mn10200 and mn10300 backend magic numbers. Written in the absense of an ABI
241
+ EM_CYGNUS_MEP = 61_453 # Toshiba MeP
242
+ EM_M32C_OLD = 65_200 # Renesas M32C and M16C
243
+ EM_IQ2000 = 65_210 # Vitesse IQ2000
244
+ EM_NIOS32 = 65_211 # NIOS magic number - no EABI available
245
+ EM_MOXIE_OLD = 65_261 # Old, unofficial value for Moxie
246
+ end
247
+ end
248
+ end