fix double label names
This commit is contained in:
parent
278eccbed5
commit
cc9b515752
@ -49,6 +49,7 @@ module Elf
|
||||
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
|
||||
end
|
||||
|
||||
|
@ -18,6 +18,10 @@ module Elf
|
||||
end
|
||||
end
|
||||
|
||||
def has_name(name)
|
||||
@strtab.index_for(name)
|
||||
end
|
||||
|
||||
def index_for_name(name)
|
||||
@symbols.each_with_index { |sym, idx|
|
||||
if (sym[0] == name)
|
||||
|
@ -17,6 +17,9 @@ module Register
|
||||
def to_s
|
||||
"Label: #{@name} (#{self.next.class})"
|
||||
end
|
||||
def sof_reference_name
|
||||
"Label: #{@name}"
|
||||
end
|
||||
|
||||
# a method start has a label of the form Class.method , test for that
|
||||
def is_method
|
||||
|
@ -83,9 +83,10 @@ module Soml
|
||||
# return self for chaining
|
||||
def init_method
|
||||
source = "_init_method"
|
||||
@method.instructions = Register::Label.new(source, "#{method.for_class.name}.#{method.name}")
|
||||
name = "#{method.for_class.name}.#{method.name}"
|
||||
@method.instructions = Register::Label.new(source, name)
|
||||
@current = enter = method.instructions
|
||||
add_code Register::Label.new( source, "return")
|
||||
add_code Register::Label.new( source, "return #{name}")
|
||||
#load the return address into pc, affecting return. (other cpus have commands for this, but not arm)
|
||||
add_code Register::FunctionReturn.new( source , Register.message_reg , Register.resolve_index(:message , :return_address) )
|
||||
@current = enter
|
||||
|
Loading…
Reference in New Issue
Block a user