Module: Elf::Writer
- Defined in:
- lib/mithril/writer.rb
Defined Under Namespace
Classes: Layout, OutputSection, StringTable, Writer
Constant Summary
collapse
- PAGESIZE =
KLUDGE: largest pagesize , align everything to
1 << 12
- UINT64_MOD =
2**64
Class Method Summary
collapse
Class Method Details
.elf_hash(value) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/mithril/writer.rb', line 7
def self.elf_hash(value)
h=0
g=0
value.chars.map(&:ord).each {|char|
h = ((h << 4) + (char % 256) )
g = h & 0xf0000000
if g!=0
h = h ^ (g>> 24)
end
h &= ~g
}
h
end
|
.gnu_hash(value) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/mithril/writer.rb', line 20
def self.gnu_hash(value)
h = 5381
value.chars.map(&:ord).each {|char|
h = (h*33 + char) & 0xffffffff
}
pp "Gnu_hash #{value} #{h}"
h
end
|
.to_file(filename, elf) ⇒ Object
4
5
6
|
# File 'lib/mithril/writer.rb', line 4
def self.to_file(filename,elf)
Elf::Writer::Writer.to_file(filename,elf)
end
|