ruby-elf 1.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.
- data/COPYING +339 -0
- data/DONATING +42 -0
- data/bin/cowstats +264 -0
- data/bin/elfgrep +185 -0
- data/bin/missingstatic +112 -0
- data/bin/rbelf-size +123 -0
- data/bin/verify-lfs +120 -0
- data/extras/README.extras +5 -0
- data/extras/bindings-parsers.rb +157 -0
- data/lib/bytestream-reader.rb +271 -0
- data/lib/elf.rb +248 -0
- data/lib/elf/dynamic.rb +392 -0
- data/lib/elf/file.rb +366 -0
- data/lib/elf/gnu.rb +174 -0
- data/lib/elf/section.rb +321 -0
- data/lib/elf/stringtable.rb +49 -0
- data/lib/elf/sunw.rb +158 -0
- data/lib/elf/symbol.rb +368 -0
- data/lib/elf/symbol/demangler_gcc3.rb +1952 -0
- data/lib/elf/symboltable.rb +90 -0
- data/lib/elf/tools.rb +228 -0
- data/lib/elf/utils/loader.rb +112 -0
- data/lib/elf/utils/pool.rb +37 -0
- data/lib/elf/value.rb +128 -0
- data/manpages/cowstats.1 +180 -0
- data/manpages/elfgrep.1 +188 -0
- data/manpages/missingstatic.1 +176 -0
- data/manpages/rbelf-size.1 +186 -0
- data/manpages/verify-lfs.1 +95 -0
- data/tools/assess_duplicate_save.rb +105 -0
- data/tools/link-collisions/analyse.rb +57 -0
- data/tools/link-collisions/harvest.rb +367 -0
- data/tools/link-collisions/known-broken +165 -0
- data/tools/link-collisions/multimplementations +125 -0
- data/tools/link-collisions/suppress.rb +84 -0
- data/tools/link-collisions/suppressions +279 -0
- data/tools/nm.rb +78 -0
- data/tools/rbelf-lddtree.rb +49 -0
- data/tools/readelf-d.rb +76 -0
- metadata +114 -0
@@ -0,0 +1,157 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
# Copyright © 2006-2008, Diego E. "Flameeyes" Pettenò <flameeyes@gmail.com>
|
4
|
+
#
|
5
|
+
# This program is free software; you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation; either version 2 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this generator; if not, write to the Free Software
|
17
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
18
|
+
|
19
|
+
# == Synopsis
|
20
|
+
#
|
21
|
+
# bindings-parser: parses the LD_DEBUG=bindings output
|
22
|
+
#
|
23
|
+
# == Usage
|
24
|
+
#
|
25
|
+
# bindings-parser [-S] [-b] [-l library] [-f file]
|
26
|
+
#
|
27
|
+
# -h, --help:
|
28
|
+
# show help
|
29
|
+
#
|
30
|
+
# -S, --sort
|
31
|
+
# Sort the statistics by amount of entries.
|
32
|
+
#
|
33
|
+
# -b, --basename-only
|
34
|
+
# Report only the basename of libraries (shorter).
|
35
|
+
#
|
36
|
+
# -l <basename>, --library <basename>
|
37
|
+
# Report only the statistics for the given library.
|
38
|
+
#
|
39
|
+
# -f <inputfile>, --file <inputfile>
|
40
|
+
# Reads the output to parse from file rather than standard input.
|
41
|
+
#
|
42
|
+
# Feed the standard input (or the file) with the outptu created by
|
43
|
+
# LD_DEBUG=bindings somecommand
|
44
|
+
# You can use LD_DEBUG_OUTPUT to write the output to a file rather than
|
45
|
+
# stderr.
|
46
|
+
|
47
|
+
pid = nil
|
48
|
+
|
49
|
+
require 'getoptlong'
|
50
|
+
require 'rdoc/usage'
|
51
|
+
|
52
|
+
opts = GetoptLong.new(
|
53
|
+
["--help", "-h", GetoptLong::NO_ARGUMENT],
|
54
|
+
["--sort", "-S", GetoptLong::NO_ARGUMENT],
|
55
|
+
["--basename-only", "-b", GetoptLong::NO_ARGUMENT],
|
56
|
+
["--library", "-l", GetoptLong::REQUIRED_ARGUMENT],
|
57
|
+
["--file", "-f", GetoptLong::REQUIRED_ARGUMENT]
|
58
|
+
)
|
59
|
+
|
60
|
+
sort = false
|
61
|
+
basename = false
|
62
|
+
library = nil
|
63
|
+
input = $stdin
|
64
|
+
|
65
|
+
opts.each do |opt, arg|
|
66
|
+
case opt
|
67
|
+
when "--help"
|
68
|
+
RDoc::usage
|
69
|
+
when "--sort"
|
70
|
+
sort = true
|
71
|
+
when "--basename-only"
|
72
|
+
basename = true
|
73
|
+
when "--library"
|
74
|
+
library = arg
|
75
|
+
when "--file"
|
76
|
+
input = File.new(arg, "r")
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
bindings = []
|
81
|
+
|
82
|
+
input.each_line { |line|
|
83
|
+
if line =~ /\s+(\d+):\s+binding file ([^\s]+) \[0\] to ([^\s]+) \[0\]: (\w+) symbol .*/
|
84
|
+
|
85
|
+
pid = $1.to_i unless pid
|
86
|
+
|
87
|
+
if basename or library
|
88
|
+
bindings << { :origin => File.basename($2), :destination => File.basename($3), :type => $4 }
|
89
|
+
else
|
90
|
+
bindings << { :origin => $2, :destination => $3, :type => $4 }
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
}
|
95
|
+
|
96
|
+
maxlen = 0
|
97
|
+
|
98
|
+
bindings.each { |b| maxlen = [maxlen, b[:origin].size, b[:destination].size, b[:type].size].max }
|
99
|
+
|
100
|
+
maxlen += 4
|
101
|
+
|
102
|
+
origins = bindings.collect { |b| b[:origin] }.uniq.sort
|
103
|
+
destinations = bindings.collect { |b| b[:destination] }.uniq.sort
|
104
|
+
bindtypes = bindings.collect { |b| b[:type] }.uniq.sort
|
105
|
+
|
106
|
+
origcount = origins.collect { |key| [ key, bindings.clone.delete_if { |e| e[:origin] != key }.size ] }
|
107
|
+
destcount = destinations.collect { |key| [ key, bindings.clone.delete_if { |e| e[:destination] != key }.size ] }
|
108
|
+
typescount = bindtypes.collect { |key| [ key, bindings.clone.delete_if { |e| e[:type] != key }.size ] }
|
109
|
+
selfcount = origins.collect { |key| [ key, bindings.clone.delete_if { |e| e[:origin] != key or e[:destination] != key }.size ] }
|
110
|
+
|
111
|
+
if sort
|
112
|
+
[origcount, destcount, typescount, selfcount].each { |countarray|
|
113
|
+
countarray.sort! { |k1, k2| k2[1] <=> k1[1] } # [1] is the count
|
114
|
+
}
|
115
|
+
else
|
116
|
+
[origcount, destcount, typescount, selfcount].each { |countarray|
|
117
|
+
countarray.sort! { |k1, k2| k2[0] <=> k1[0] } # [0] is the name
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
if not library
|
122
|
+
puts "Statistics"
|
123
|
+
|
124
|
+
puts " Origins"
|
125
|
+
origcount.each { |key, count|
|
126
|
+
print " #{key}"
|
127
|
+
(maxlen-key.size).times { print " " }
|
128
|
+
puts "#{count}"
|
129
|
+
}
|
130
|
+
|
131
|
+
puts " Destinations"
|
132
|
+
destcount.each { |key, count|
|
133
|
+
print " #{key}"
|
134
|
+
(maxlen-key.size).times { print " " }
|
135
|
+
puts "#{count}"
|
136
|
+
}
|
137
|
+
|
138
|
+
puts " Bindtypes"
|
139
|
+
typescount.each { |key, count|
|
140
|
+
print " #{key}"
|
141
|
+
(maxlen-key.size).times { print " " }
|
142
|
+
puts "#{count}"
|
143
|
+
}
|
144
|
+
|
145
|
+
puts " Self-loops (candidate for protected visibility)"
|
146
|
+
selfcount.each { |key, count|
|
147
|
+
next if count == 0
|
148
|
+
print " #{key}"
|
149
|
+
(maxlen-key.size).times { print " " }
|
150
|
+
puts "#{count}"
|
151
|
+
}
|
152
|
+
else
|
153
|
+
puts "Statistics for #{library}"
|
154
|
+
puts " Origin: #{origcount.assoc(library)[1].to_s.rjust(8)}" if origcount.assoc(library)
|
155
|
+
puts " Destination: #{destcount.assoc(library)[1].to_s.rjust(8)}" if destcount.assoc(library)
|
156
|
+
puts " Self-loops: #{selfcount.assoc(library)[1].to_s.rjust(8)}" if selfcount.assoc(library)
|
157
|
+
end
|
@@ -0,0 +1,271 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Simple bytestream reader.
|
3
|
+
# This class is a simple File derivative from which you can read
|
4
|
+
# integers of different sizes, in any endianness.
|
5
|
+
#
|
6
|
+
# Copyright © 2007-2010 Diego E. "Flameeyes" Pettenò <flameeyes@gmail.com>
|
7
|
+
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person
|
9
|
+
# obtaining a copy of this software and associated documentation files
|
10
|
+
# (the "Software"), to deal in the Software without restriction,
|
11
|
+
# including without limitation the rights to use, copy, modify, merge,
|
12
|
+
# publish, distribute, sublicense, and/or sell copies of the Software,
|
13
|
+
# and to permit persons to whom the Software is furnished to do so,
|
14
|
+
# subject to the following conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be
|
17
|
+
# included in all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
20
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
21
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
22
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
23
|
+
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
24
|
+
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
25
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
+
# SOFTWARE.
|
27
|
+
#
|
28
|
+
|
29
|
+
begin
|
30
|
+
require 'readbytes'
|
31
|
+
rescue LoadError
|
32
|
+
end
|
33
|
+
|
34
|
+
module BytestreamReader
|
35
|
+
# This exists in the documentation but not in implementation (?!)
|
36
|
+
|
37
|
+
class UndefinedEndianness < Exception
|
38
|
+
def initialize
|
39
|
+
super("Requested default-endianness reads but no endianness defined")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
unless IO.instance_methods.include? "readbytes"
|
44
|
+
def readexactly(length)
|
45
|
+
ret = readpartial(length)
|
46
|
+
|
47
|
+
# Not strictly correct on Ruby 1.8 but we don't care since we
|
48
|
+
# only use this piece of compatibility code on 1.9.
|
49
|
+
raise EOFError if ret.size != length
|
50
|
+
|
51
|
+
return ret
|
52
|
+
end
|
53
|
+
else
|
54
|
+
def readexactly(length)
|
55
|
+
begin
|
56
|
+
return readbytes(length)
|
57
|
+
rescue TruncatedDataError
|
58
|
+
raise EOFError
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def read_array_u8(size)
|
64
|
+
readexactly(1*size).unpack("C*")
|
65
|
+
end
|
66
|
+
|
67
|
+
def read_array_u16_be(size)
|
68
|
+
readexactly(2*size).unpack("n*")
|
69
|
+
end
|
70
|
+
|
71
|
+
def read_array_u16_le(size)
|
72
|
+
readexactly(2*size).unpack("v*")
|
73
|
+
end
|
74
|
+
|
75
|
+
def read_array_u32_be(size)
|
76
|
+
readexactly(4*size).unpack("N*")
|
77
|
+
end
|
78
|
+
|
79
|
+
def read_array_u32_le(size)
|
80
|
+
readexactly(4*size).unpack("V*")
|
81
|
+
end
|
82
|
+
|
83
|
+
def read_array_u64_be(size)
|
84
|
+
buf = readexactly(8*size).unpack("N*")
|
85
|
+
val = []
|
86
|
+
size.times do |i|
|
87
|
+
val[i] = buf[i*2] << 32 | buf[i*2+1];
|
88
|
+
end
|
89
|
+
return val
|
90
|
+
end
|
91
|
+
|
92
|
+
def read_array_u64_le(size)
|
93
|
+
buf = readexactly(8*size).unpack("V*")
|
94
|
+
val = []
|
95
|
+
size.times do |i|
|
96
|
+
val[i] = buf[i*2+1] << 32 | buf[i*2];
|
97
|
+
end
|
98
|
+
return val
|
99
|
+
end
|
100
|
+
|
101
|
+
def read_u8
|
102
|
+
read_array_u8(1)[0]
|
103
|
+
end
|
104
|
+
|
105
|
+
def read_u16_be
|
106
|
+
read_array_u16_be(1)[0]
|
107
|
+
end
|
108
|
+
|
109
|
+
def read_u16_le
|
110
|
+
read_array_u16_le(1)[0]
|
111
|
+
end
|
112
|
+
|
113
|
+
def read_u32_be
|
114
|
+
read_array_u32_be(1)[0]
|
115
|
+
end
|
116
|
+
|
117
|
+
def read_u32_le
|
118
|
+
read_array_u32_le(1)[0]
|
119
|
+
end
|
120
|
+
|
121
|
+
def read_u64_be
|
122
|
+
# As there is no direct unpack method for 64-bit words, the one-value
|
123
|
+
# function is considered a special case.
|
124
|
+
buf = readexactly(8).unpack("N*")
|
125
|
+
return buf[0] << 32 | buf[1]
|
126
|
+
end
|
127
|
+
|
128
|
+
def read_u64_le
|
129
|
+
# As there is no direct unpack method for 64-bit words, the one-value
|
130
|
+
# function is considered a special case.
|
131
|
+
buf = readexactly(8).unpack("V*")
|
132
|
+
return buf[1] << 32 | buf[0]
|
133
|
+
end
|
134
|
+
|
135
|
+
def read_array_s8(size)
|
136
|
+
readexactly(1*size).unpack("c*")
|
137
|
+
end
|
138
|
+
|
139
|
+
def read_array_s16_be(size)
|
140
|
+
tmp = read_array_u16_be(size)
|
141
|
+
tmp.collect { |val| (val & ~(1 << 15)) - (val & (1 << 15)) }
|
142
|
+
end
|
143
|
+
|
144
|
+
def read_array_s16_le(size)
|
145
|
+
tmp = read_array_u16_le(size)
|
146
|
+
tmp.collect { |val| (val & ~(1 << 15)) - (val & (1 << 15)) }
|
147
|
+
end
|
148
|
+
|
149
|
+
def read_array_s32_be(size)
|
150
|
+
tmp = read_array_u32_be(size)
|
151
|
+
tmp.collect { |val| (val & ~(1 << 31)) - (val & (1 << 31)) }
|
152
|
+
end
|
153
|
+
|
154
|
+
def read_array_s32_le(size)
|
155
|
+
tmp = read_array_u32_le(size)
|
156
|
+
tmp.collect { |val| (val & ~(1 << 31)) - (val & (1 << 31)) }
|
157
|
+
end
|
158
|
+
|
159
|
+
def read_array_s64_be(size)
|
160
|
+
tmp = read_array_u64_be(size)
|
161
|
+
tmp.collect { |val| (val & ~(1 << 63)) - (val & (1 << 63)) }
|
162
|
+
end
|
163
|
+
|
164
|
+
def read_array_s64_le(size)
|
165
|
+
tmp = read_array_u64_le(size)
|
166
|
+
tmp.collect { |val| (val & ~(1 << 63)) - (val & (1 << 63)) }
|
167
|
+
end
|
168
|
+
|
169
|
+
def read_s8
|
170
|
+
tmp = read_u8
|
171
|
+
return (tmp & ~(1 << 7)) - (tmp & (1 << 7))
|
172
|
+
end
|
173
|
+
|
174
|
+
def read_s16_be
|
175
|
+
tmp = read_u16_be
|
176
|
+
return (tmp & ~(1 << 15)) - (tmp & (1 << 15))
|
177
|
+
end
|
178
|
+
|
179
|
+
def read_s16_le
|
180
|
+
tmp = read_u16_le
|
181
|
+
return (tmp & ~(1 << 15)) - (tmp & (1 << 15))
|
182
|
+
end
|
183
|
+
|
184
|
+
def read_s32_be
|
185
|
+
tmp = read_u32_be
|
186
|
+
return (tmp & ~(1 << 31)) - (tmp & (1 << 31))
|
187
|
+
end
|
188
|
+
|
189
|
+
def read_s32_le
|
190
|
+
tmp = read_u32_le
|
191
|
+
return (tmp & ~(1 << 31)) - (tmp & (1 << 31))
|
192
|
+
end
|
193
|
+
|
194
|
+
def read_s64_be
|
195
|
+
tmp = read_u64_be
|
196
|
+
return (tmp & ~(1 << 63)) - (tmp & (1 << 63))
|
197
|
+
end
|
198
|
+
|
199
|
+
def read_s64_le
|
200
|
+
tmp = read_u64_le
|
201
|
+
return (tmp & ~(1 << 63)) - (tmp & (1 << 63))
|
202
|
+
end
|
203
|
+
|
204
|
+
BigEndian = :BigEndian
|
205
|
+
LittleEndian = :LittleEndian
|
206
|
+
|
207
|
+
def read_s16
|
208
|
+
case @endian
|
209
|
+
when BigEndian then read_s16_be
|
210
|
+
when LittleEndian then read_s16_le
|
211
|
+
else raise UndefinedEndianness.new
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
def read_s32
|
216
|
+
case @endian
|
217
|
+
when BigEndian then read_s32_be
|
218
|
+
when LittleEndian then read_s32_le
|
219
|
+
else raise UndefinedEndianness.new
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def read_s64
|
224
|
+
case @endian
|
225
|
+
when BigEndian then read_s64_be
|
226
|
+
when LittleEndian then read_s64_le
|
227
|
+
else raise UndefinedEndianness.new
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
def read_u16
|
232
|
+
case @endian
|
233
|
+
when BigEndian then read_u16_be
|
234
|
+
when LittleEndian then read_u16_le
|
235
|
+
else raise UndefinedEndianness.new
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
def read_u32
|
240
|
+
case @endian
|
241
|
+
when BigEndian then read_u32_be
|
242
|
+
when LittleEndian then read_u32_le
|
243
|
+
else raise UndefinedEndianness.new
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
def read_u64
|
248
|
+
case @endian
|
249
|
+
when BigEndian then read_u64_be
|
250
|
+
when LittleEndian then read_u64_le
|
251
|
+
else raise UndefinedEndianness.new
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def set_endian(endian)
|
256
|
+
case endian
|
257
|
+
when BigEndian, LittleEndian
|
258
|
+
@endian = endian
|
259
|
+
else
|
260
|
+
raise ArgumentError.new
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
# This is a commodity class of File that is simply extended with the
|
265
|
+
# BytestreamReader.
|
266
|
+
#
|
267
|
+
# Right now it's only used for testing
|
268
|
+
class File < ::File
|
269
|
+
include BytestreamReader
|
270
|
+
end
|
271
|
+
end
|
data/lib/elf.rb
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# Simple ELF parser for Ruby
|
3
|
+
#
|
4
|
+
# Copyright © 2007-2010 Diego E. "Flameeyes" Pettenò <flameeyes@gmail.com>
|
5
|
+
# Portions inspired by elf.py
|
6
|
+
# Copyright © 2002 Netgraft Corporation
|
7
|
+
# Portions inspired by glibc's elf.h
|
8
|
+
# Copyright © 1995-2006 Free Software Foundation, Inc.
|
9
|
+
# Portions inspired by GNU Binutils's elf/common.h
|
10
|
+
# Copyright © 1991-2009 Free Software Foundation, Inc.
|
11
|
+
#
|
12
|
+
# This program is free software; you can redistribute it and/or modify
|
13
|
+
# it under the terms of the GNU General Public License as published by
|
14
|
+
# the Free Software Foundation; either version 2 of the License, or
|
15
|
+
# (at your option) any later version.
|
16
|
+
#
|
17
|
+
# This program is distributed in the hope that it will be useful,
|
18
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20
|
+
# GNU General Public License for more details.
|
21
|
+
#
|
22
|
+
# You should have received a copy of the GNU General Public License
|
23
|
+
# along with this generator; if not, write to the Free Software
|
24
|
+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
25
|
+
|
26
|
+
require 'elf/value'
|
27
|
+
require 'elf/symbol'
|
28
|
+
require 'elf/file'
|
29
|
+
require 'elf/section'
|
30
|
+
|
31
|
+
# We need this quite e lot
|
32
|
+
class Integer
|
33
|
+
def hex
|
34
|
+
sprintf "%x", self
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module Elf
|
39
|
+
VERSION = "1.0.0"
|
40
|
+
|
41
|
+
MagicString = "\177ELF"
|
42
|
+
|
43
|
+
class Indexes < Value
|
44
|
+
fill(
|
45
|
+
4 => [ :Class, 'File class' ],
|
46
|
+
5 => [ :DataEncoding, 'Data encoding' ],
|
47
|
+
6 => [ :Version, 'File version' ],
|
48
|
+
7 => [ :OsAbi, 'OS ABI identification' ],
|
49
|
+
8 => [ :AbiVersion, 'ABI version' ]
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
class Class < Value
|
54
|
+
fill(
|
55
|
+
1 => [ :Elf32, '32-bit' ],
|
56
|
+
2 => [ :Elf64, '64-bit' ]
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
class DataEncoding < Value
|
61
|
+
fill(
|
62
|
+
1 => [ :Lsb, 'Little-endian' ],
|
63
|
+
2 => [ :Msb, 'Big-endian' ]
|
64
|
+
)
|
65
|
+
|
66
|
+
BytestreamMapping = {
|
67
|
+
Lsb => BytestreamReader::LittleEndian,
|
68
|
+
Msb => BytestreamReader::BigEndian
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
72
|
+
class OsAbi < Value
|
73
|
+
fill(
|
74
|
+
0 => [ :SysV, 'UNIX System V ABI' ],
|
75
|
+
1 => [ :HPUX, 'HP-UX' ],
|
76
|
+
2 => [ :NetBSD, 'NetBSD' ],
|
77
|
+
3 => [ :Linux, 'Linux' ],
|
78
|
+
4 => [ :Hurd, 'Hurd' ],
|
79
|
+
6 => [ :Solaris, 'Solaris' ],
|
80
|
+
7 => [ :Aix, 'IBM AIX' ],
|
81
|
+
8 => [ :Irix, 'SGI Irix' ],
|
82
|
+
9 => [ :FreeBSD, 'FreeBSD' ],
|
83
|
+
10 => [ :Tru64, 'Compaq TRU64 UNIX' ],
|
84
|
+
11 => [ :Modesto, 'Novell Modesto' ],
|
85
|
+
12 => [ :OpenBSD, 'OpenBSD' ],
|
86
|
+
13 => [ :OpenVMS, 'OpenVMS' ],
|
87
|
+
14 => [ :NSK, 'Hewlett-Packard Non-Stop Kernel' ],
|
88
|
+
15 => [ :AROS, 'AROS' ],
|
89
|
+
16 => [ :FenixOS, 'FenixOS' ],
|
90
|
+
97 => [ :ARM, 'ARM' ],
|
91
|
+
255 => [ :Standalone, 'Standalone (embedded) application' ]
|
92
|
+
)
|
93
|
+
end
|
94
|
+
|
95
|
+
class Machine < Value
|
96
|
+
fill(
|
97
|
+
0 => [ :None, 'No machine' ],
|
98
|
+
1 => [ :M32, 'AT&T WE 32100' ],
|
99
|
+
2 => [ :Sparc, 'SUN SPARC' ],
|
100
|
+
3 => [ :I386, 'Intel 80386' ],
|
101
|
+
4 => [ :M68k, 'Motorola m68k family' ],
|
102
|
+
5 => [ :M88k, 'Motorola m88k family' ],
|
103
|
+
6 => [ :I486, 'Intel 80486 (reserved)' ],
|
104
|
+
7 => [ :I860, 'Intel 80860' ],
|
105
|
+
8 => [ :Mips, 'MIPS R3000 big-endian' ],
|
106
|
+
9 => [ :S370, 'IBM System/370' ],
|
107
|
+
10 => [ :MipsRS3LE, 'MIPS R3000 little-endian' ],
|
108
|
+
|
109
|
+
15 => [ :PaRisc, 'HPPA' ],
|
110
|
+
17 => [ :Vpp500, 'Fujitsu VPP500' ],
|
111
|
+
18 => [ :Sparc32Plus, 'Sun\'s "v8plus"' ],
|
112
|
+
19 => [ :I960, 'Intel 80960' ],
|
113
|
+
20 => [ :PPC, 'PowerPC' ],
|
114
|
+
21 => [ :PPC64, 'PowerPC 64-bit' ],
|
115
|
+
22 => [ :S390, 'IBM S390' ],
|
116
|
+
23 => [ :SPU, 'Sony/Toshiba/IBM SPU' ],
|
117
|
+
|
118
|
+
36 => [ :V800, 'NEC V800 series' ],
|
119
|
+
37 => [ :FR20, 'Fujitsu FR20' ],
|
120
|
+
38 => [ :RH32, 'TRW RH-32' ],
|
121
|
+
39 => [ :RCE, 'Motorola RCE' ],
|
122
|
+
40 => [ :ARM, 'ARM' ],
|
123
|
+
|
124
|
+
42 => [ :SH, 'Hitachi SH' ],
|
125
|
+
43 => [ :SparcV9, 'SPARC v9 64-bit' ],
|
126
|
+
44 => [ :Tricore, 'Siemens Tricore' ],
|
127
|
+
45 => [ :ARC, 'Argonaut RISC Core' ],
|
128
|
+
46 => [ :H8300, 'Hitachi H8/300' ],
|
129
|
+
47 => [ :H8300H, 'Hitachi H8/300H' ],
|
130
|
+
48 => [ :H8S, 'Hitachi H8S' ],
|
131
|
+
49 => [ :H8500, 'Hitachi H8/500' ],
|
132
|
+
50 => [ :IA64, 'Intel Merced' ],
|
133
|
+
51 => [ :MIPSX, 'Stanford MIPS-X' ],
|
134
|
+
52 => [ :Coldfire, 'Motorola Coldfire' ],
|
135
|
+
53 => [ :M68HC12, 'Motorola M68HC12' ],
|
136
|
+
54 => [ :MMA, 'Fujitsu MMA Multimedia Accelerator' ],
|
137
|
+
55 => [ :PCP, 'Siemens PCP' ],
|
138
|
+
56 => [ :NCPU, 'Sony nCPU embeeded RISC' ],
|
139
|
+
57 => [ :NDR1, 'Denso NDR1 microprocessor' ],
|
140
|
+
58 => [ :StarCore, 'Motorola Start*Core processor' ],
|
141
|
+
59 => [ :ME16, 'Toyota ME16 processor' ],
|
142
|
+
60 => [ :ST100, 'STMicroelectronic ST100 processor' ],
|
143
|
+
61 => [ :Tinyj, 'Advanced Logic Corp. Tinyj emb.fam' ],
|
144
|
+
62 => [ :X8664, 'AMD x86-64 architecture' ],
|
145
|
+
63 => [ :PDSP, 'Sony DSP Processor' ],
|
146
|
+
64 => [ :PDP10, 'DEC PDP-10' ],
|
147
|
+
65 => [ :PDP11, 'DEC PDP-11' ],
|
148
|
+
66 => [ :FX66, 'Siemens FX66 microcontroller' ],
|
149
|
+
67 => [ :ST9Plus, 'STMicroelectronics ST9+ 8/16 mc' ],
|
150
|
+
68 => [ :ST7, 'STmicroelectronics ST7 8 bit mc' ],
|
151
|
+
69 => [ :M68HC16, 'Motorola MC68HC16 microcontroller' ],
|
152
|
+
70 => [ :M68HC11, 'Motorola MC68HC11 microcontroller' ],
|
153
|
+
71 => [ :M68HC08, 'Motorola MC68HC08 microcontroller' ],
|
154
|
+
72 => [ :M68HC05, 'Motorola MC68HC05 microcontroller' ],
|
155
|
+
73 => [ :SVX, 'Silicon Graphics SVx' ],
|
156
|
+
74 => [ :ST19, 'STMicroelectronics ST19 8 bit mc' ],
|
157
|
+
75 => [ :VAX, 'Digital VAX' ],
|
158
|
+
76 => [ :Cris, 'Axis Communications 32-bit embedded processor' ],
|
159
|
+
77 => [ :Javelin, 'Infineon Technologies 32-bit embedded processor' ],
|
160
|
+
78 => [ :Firepath, 'Element 14 64-bit DSP Processor' ],
|
161
|
+
79 => [ :ZSP, 'LSI Logic 16-bit DSP Processor' ],
|
162
|
+
80 => [ :MMIX, 'Donald Knuth\'s educational 64-bit processor' ],
|
163
|
+
81 => [ :Huany, 'Harvard University machine-independent object files' ],
|
164
|
+
82 => [ :Prism, 'SiTera Prism' ],
|
165
|
+
83 => [ :AVR, 'Atmel AVR 8-bit microcontroller' ],
|
166
|
+
84 => [ :FR30, 'Fujitsu FR30' ],
|
167
|
+
85 => [ :D10V, 'Mitsubishi D10V' ],
|
168
|
+
86 => [ :D30V, 'Mitsubishi D30V' ],
|
169
|
+
87 => [ :V850, 'NEC v850' ],
|
170
|
+
88 => [ :M32R, 'Mitsubishi M32R' ],
|
171
|
+
89 => [ :MN10300, 'Matsushita MN10300' ],
|
172
|
+
90 => [ :MN10200, 'Matsushita MN10200' ],
|
173
|
+
91 => [ :PJ, 'picoJava' ],
|
174
|
+
92 => [ :OpenRISC, 'OpenRISC 32-bit embedded processor' ],
|
175
|
+
93 => [ :ARC_A5, 'ARC Cores Tangent-A5' ],
|
176
|
+
94 => [ :Xtensa, 'Tensilica Xtensa Architecture' ],
|
177
|
+
95 => [ :VideoCore, 'Alphamosaic VideoCore processor' ],
|
178
|
+
96 => [ :TMM_GPP, 'Thompson Multimedia General Purpose Processor' ],
|
179
|
+
97 => [ :NS32K, 'National Semiconductor 32000 series' ],
|
180
|
+
98 => [ :TPC, 'Tenor Network TPC processor' ],
|
181
|
+
99 => [ :SNP1K, 'Trebia SNP 1000 processor' ],
|
182
|
+
100 => [ :ST200, 'STMicroelectronics ST200 microcontroller' ],
|
183
|
+
101 => [ :IP2K, 'Ubicom IP2022 micro controller' ],
|
184
|
+
102 => [ :MAX, 'MAX Processor' ],
|
185
|
+
103 => [ :CR, 'National Semiconductor CompactRISC' ],
|
186
|
+
104 => [ :F2MC16, 'Fujitsu F2MC16' ],
|
187
|
+
105 => [ :MSP430, 'TI msp430 micro controller' ],
|
188
|
+
106 => [ :Blackfin, 'ADI Blackfin' ],
|
189
|
+
107 => [ :SE_C33, 'S1C33 Family of Seiko Epson processors' ],
|
190
|
+
108 => [ :SEP, 'Sharp embedded microprocessor' ],
|
191
|
+
109 => [ :ARCA, 'Arca RISC Microprocessor' ],
|
192
|
+
110 => [ :UNICORE, 'Microprocessor series from PKU-Unity Ltd. and MPRC of Peking University' ],
|
193
|
+
111 => [ :EXCESS, 'eXcess: 16/32/64-bit configurable embedded CPU' ],
|
194
|
+
112 => [ :DXP, 'Icera Semiconductor Inc. Deep Execution Processor' ],
|
195
|
+
113 => [ :Altera_Nios2, 'Altera Nios II soft-core processor' ],
|
196
|
+
114 => [ :CRX, 'National Semiconductor CRX' ],
|
197
|
+
115 => [ :XGATE, 'Motorola XGATE embedded processor' ],
|
198
|
+
116 => [ :C166, 'Infineon C16x/XC16x processor' ],
|
199
|
+
117 => [ :M16C, 'Renesas M16C series microprocessors' ],
|
200
|
+
118 => [ :DSPIC30F, 'Microchip Technology dsPIC30F Digital Signal Controller' ],
|
201
|
+
119 => [ :CE, 'Freescale Communication Engine RISC core' ],
|
202
|
+
120 => [ :M32C, 'Renesas M32C series microprocessors' ],
|
203
|
+
131 => [ :TSK3000, 'Altium TSK3000 core' ],
|
204
|
+
132 => [ :RS08, 'Freescale RS08 embedded processor' ],
|
205
|
+
134 => [ :ECOG2, 'Cyan Technology eCOG2 microprocessor' ],
|
206
|
+
135 => [ :Score, 'Sunplus Score' ],
|
207
|
+
135 => [ :Score7, 'Sunplus S+core7 RISC processor' ],
|
208
|
+
136 => [ :DSP24, 'New Japan Radio (NJR) 24-bit DSP Processor' ],
|
209
|
+
137 => [ :VideoCore3, 'Broadcom VideoCore III processor' ],
|
210
|
+
138 => [ :LatticeMICO32, 'RISC processor for Lattice FPGA architecture' ],
|
211
|
+
139 => [ :SE_C17, 'Seiko Epson C17 family' ],
|
212
|
+
140 => [ :TI_C6000, 'Texas Instruments TMS320C6000 DSP family' ],
|
213
|
+
141 => [ :TI_C2000, 'Texas Instruments TMS320C2000 DSP family' ],
|
214
|
+
142 => [ :TI_C5500, 'Texas Instruments TMS320C55x DSP family' ],
|
215
|
+
160 => [ :MMDSP_PLUS, 'STMicroelectronics 64bit VLIW Data Signal Processor' ],
|
216
|
+
161 => [ :Cypress_M8C, 'Cypress M8C microprocessor' ],
|
217
|
+
162 => [ :R32C, 'Renesas R32C series microprocessors' ],
|
218
|
+
163 => [ :TriMedia, 'NXP Semiconductors TriMedia architecture family' ],
|
219
|
+
164 => [ :QDSP6, 'QUALCOMM DSP6 Processor' ],
|
220
|
+
165 => [ :I8051, 'Intel 8051 and variants' ],
|
221
|
+
166 => [ :STXP7X, 'STMicroelectronics STxP7x family' ],
|
222
|
+
167 => [ :NDS32, 'Andes Technology compact code size embedded RISC processor family' ],
|
223
|
+
168 => [ :ECOG1, 'Cyan Technology eCOG1X family' ],
|
224
|
+
168 => [ :ECOG1X, 'Cyan Technology eCOG1X family' ],
|
225
|
+
169 => [ :MAXQ30, 'Dallas Semiconductor MAXQ30 Core Micro-controllers' ],
|
226
|
+
170 => [ :XIMO16, 'New Japan Radio (NJR) 16-bit DSP Processor' ],
|
227
|
+
171 => [ :MANIK, 'M2000 Reconfigurable RISC Microprocessor' ],
|
228
|
+
172 => [ :CRAYNV2, 'Cray Inc. NV2 vector architecture' ],
|
229
|
+
173 => [ :RX, 'Renesas RX family' ],
|
230
|
+
174 => [ :METAG, 'Imagination Technologies META processor architecture' ],
|
231
|
+
175 => [ :MCST_ELBRUS, 'MCST Elbrus general purpose hardware architecture' ],
|
232
|
+
176 => [ :ECOG16, 'Cyan Technology eCOG16 family' ],
|
233
|
+
177 => [ :CR16, 'National Semiconductor CompactRISC 16-bit processor' ],
|
234
|
+
178 => [ :ETPU, 'Freescale Extended Time Processing Unit' ],
|
235
|
+
179 => [ :SLE9X, 'Infineon Technologies SLE9X core' ],
|
236
|
+
180 => [ :L1OM, 'Intel L1OM' ],
|
237
|
+
185 => [ :AVR32, 'Atmel Corporation 32-bit microprocessor family' ],
|
238
|
+
186 => [ :STM8, 'STMicroeletronics STM8 8-bit microcontroller' ],
|
239
|
+
187 => [ :TILE64, 'Tilera TILE64 multicore architecture family' ],
|
240
|
+
188 => [ :TILEPro, 'Tilera TILEPro multicore architecture family' ],
|
241
|
+
189 => [ :MicroBlaze, 'Xilinx MicroBlaze 32-bit RISC soft processor core' ],
|
242
|
+
190 => [ :CUDA, 'NVIDIA CUDA architecture' ],
|
243
|
+
|
244
|
+
0x9026 => [ :Alpha, 'DEC Alpha' ]
|
245
|
+
)
|
246
|
+
end
|
247
|
+
|
248
|
+
end
|