This commit is contained in:
Torsten Ruger 2016-12-15 18:08:55 +02:00
parent 884bf23e5f
commit e2c006b5ad
2 changed files with 5 additions and 3 deletions

View File

@ -21,7 +21,7 @@ module Elf
set_text assembler.write_as_string
# for debug add labels to the block positions
Register.machine.space.classes.values.each do |clazz|
Register.machine.space.types.values.each do |clazz|
clazz.instance_methods.each do |f|
f.instructions.each_label do |label|
add_symbol "#{clazz.name}::#{f.name}:#{label.name}" , label.position
@ -43,11 +43,14 @@ module Elf
end
end
end
attr_reader :text
def set_text(text)
@text.text = text
add_symbol "_start", 0
end
def add_symbol(name, offset, linkage = Elf::Constants::STB_GLOBAL)
return add_symbol( name + "_" , offset ) if @symbol_table.has_name(name)
@symbol_table.add_func_symbol name, offset, @text, linkage

View File

@ -9,7 +9,7 @@ class HelloTest < MiniTest::Test
machine.collect
machine.translate_arm
writer = Elf::ObjectWriter.new
writer.save "hello.o"
writer.save "test/hello.o"
end
def test_string_put
@ -17,7 +17,6 @@ class HelloTest < MiniTest::Test
s(:statements, s(:function, :Integer, s(:name, :main), s(:parameters),
s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments),
s(:receiver, s(:string, "Hello again\\n")))))))))
#FIXME: some more assembly tests need to get to the bottom of this one
check
end
end