fix double label names

This commit is contained in:
Torsten Ruger
2015-11-14 22:53:01 +02:00
parent 278eccbed5
commit cc9b515752
4 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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)