2014-04-14 17:09:56 +02:00
|
|
|
module Elf
|
|
|
|
class TextSection < Section
|
|
|
|
attr_accessor :text
|
|
|
|
|
|
|
|
def write(io)
|
|
|
|
io << text
|
|
|
|
end
|
|
|
|
|
|
|
|
def type
|
|
|
|
Elf::Constants::SHT_PROGBITS
|
|
|
|
end
|
|
|
|
|
2014-05-16 09:42:25 +02:00
|
|
|
def flags #making the text writable !gogogo
|
|
|
|
Elf::Constants::SHF_WRITE | Elf::Constants::SHF_ALLOC | Elf::Constants::SHF_EXECINSTR
|
2014-04-14 17:09:56 +02:00
|
|
|
end
|
|
|
|
|
2014-05-20 09:29:08 +02:00
|
|
|
def length
|
|
|
|
@text.length
|
|
|
|
end
|
|
|
|
def to_s
|
|
|
|
"[" + @text.bytes.join(",") + "]"
|
|
|
|
end
|
2014-04-14 17:09:56 +02:00
|
|
|
def alignment
|
|
|
|
4
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|