minor
This commit is contained in:
parent
884bf23e5f
commit
e2c006b5ad
@ -21,7 +21,7 @@ module Elf
|
|||||||
set_text assembler.write_as_string
|
set_text assembler.write_as_string
|
||||||
|
|
||||||
# for debug add labels to the block positions
|
# 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|
|
clazz.instance_methods.each do |f|
|
||||||
f.instructions.each_label do |label|
|
f.instructions.each_label do |label|
|
||||||
add_symbol "#{clazz.name}::#{f.name}:#{label.name}" , label.position
|
add_symbol "#{clazz.name}::#{f.name}:#{label.name}" , label.position
|
||||||
@ -43,11 +43,14 @@ module Elf
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :text
|
attr_reader :text
|
||||||
|
|
||||||
def set_text(text)
|
def set_text(text)
|
||||||
@text.text = text
|
@text.text = text
|
||||||
add_symbol "_start", 0
|
add_symbol "_start", 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_symbol(name, offset, linkage = Elf::Constants::STB_GLOBAL)
|
def add_symbol(name, offset, linkage = Elf::Constants::STB_GLOBAL)
|
||||||
return add_symbol( name + "_" , offset ) if @symbol_table.has_name(name)
|
return add_symbol( name + "_" , offset ) if @symbol_table.has_name(name)
|
||||||
@symbol_table.add_func_symbol name, offset, @text, linkage
|
@symbol_table.add_func_symbol name, offset, @text, linkage
|
||||||
|
@ -9,7 +9,7 @@ class HelloTest < MiniTest::Test
|
|||||||
machine.collect
|
machine.collect
|
||||||
machine.translate_arm
|
machine.translate_arm
|
||||||
writer = Elf::ObjectWriter.new
|
writer = Elf::ObjectWriter.new
|
||||||
writer.save "hello.o"
|
writer.save "test/hello.o"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_string_put
|
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(:function, :Integer, s(:name, :main), s(:parameters),
|
||||||
s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments),
|
s(:statements, s(:return, s(:call, s(:name, :putstring), s(:arguments),
|
||||||
s(:receiver, s(:string, "Hello again\\n")))))))))
|
s(:receiver, s(:string, "Hello again\\n")))))))))
|
||||||
#FIXME: some more assembly tests need to get to the bottom of this one
|
|
||||||
check
|
check
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user