adds first version of the expanded as assembler from mikko
This commit is contained in:
29
lib/elf/string_table_section.rb
Normal file
29
lib/elf/string_table_section.rb
Normal file
@ -0,0 +1,29 @@
|
||||
module Elf
|
||||
class StringTableSection < Section
|
||||
def initialize(*args)
|
||||
super
|
||||
|
||||
@string_data = "\x00"
|
||||
@indices = {"" => 0}
|
||||
end
|
||||
|
||||
def add_string(str)
|
||||
return if @indices[str]
|
||||
|
||||
@indices[str] = @string_data.length
|
||||
@string_data << str << "\x00"
|
||||
end
|
||||
|
||||
def index_for(str)
|
||||
@indices[str]
|
||||
end
|
||||
|
||||
def write(io)
|
||||
io << @string_data
|
||||
end
|
||||
|
||||
def type
|
||||
Elf::Constants::SHT_STRTAB
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user