From e10f4863ee427e14986538e7be4168bfd0ba56e1 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 14 May 2014 16:15:47 +0300 Subject: [PATCH] exporting labels to elf for (a lot) better readability --- lib/vm/program.rb | 2 +- test/test_runner.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/vm/program.rb b/lib/vm/program.rb index 592f2537..b84c79d6 100644 --- a/lib/vm/program.rb +++ b/lib/vm/program.rb @@ -36,7 +36,7 @@ module Vm @main = Block.new("main") @exit = Core::Kernel::main_exit Vm::Block.new("main_exit") end - attr_reader :context , :main , :functions + attr_reader :context , :main , :functions , :entry , :exit def add_object o return if @objects.include? o diff --git a/test/test_runner.rb b/test/test_runner.rb index 711f63e6..ebb51e30 100644 --- a/test/test_runner.rb +++ b/test/test_runner.rb @@ -40,7 +40,11 @@ class TestRunner < MiniTest::Test binary = program.assemble(StringIO.new ) 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) writer.set_text assembly.string