exporting labels to elf for (a lot) better readability

This commit is contained in:
Torsten Ruger 2014-05-14 16:15:47 +03:00
parent d8d536aa2c
commit e10f4863ee
2 changed files with 6 additions and 2 deletions

View File

@ -36,7 +36,7 @@ module Vm
@main = Block.new("main") @main = Block.new("main")
@exit = Core::Kernel::main_exit Vm::Block.new("main_exit") @exit = Core::Kernel::main_exit Vm::Block.new("main_exit")
end end
attr_reader :context , :main , :functions attr_reader :context , :main , :functions , :entry , :exit
def add_object o def add_object o
return if @objects.include? o return if @objects.include? o

View File

@ -40,7 +40,11 @@ class TestRunner < MiniTest::Test
binary = program.assemble(StringIO.new ) binary = program.assemble(StringIO.new )
writer = Elf::ObjectWriter.new(Elf::Constants::TARGET_ARM) writer = Elf::ObjectWriter.new(Elf::Constants::TARGET_ARM)
blocks = program.functions.collect{ |f| [f.entry , f.exit , f.body] }
blocks += [program.entry , program.exit , program.main]
blocks.flatten.each do |b|
writer.add_symbol b.name.to_s , b.position
end
assembly = program.assemble(StringIO.new) assembly = program.assemble(StringIO.new)
writer.set_text assembly.string writer.set_text assembly.string