really remove externs

This commit is contained in:
Torsten Ruger
2014-04-23 11:14:25 +03:00
parent dc9bba58e2
commit 8955cf31da
12 changed files with 1 additions and 698 deletions

View File

@ -35,7 +35,7 @@ module Asm
node.args << add_string(arg)
elsif (arg.is_a?(Symbol))
node.args << Asm::LabelRefNode.new(arg.to_s)
elsif (arg.is_a?(Asm::Arm::GeneratorLabel) or arg.is_a?(Asm::Arm::GeneratorExternLabel))
elsif (arg.is_a?(Asm::Arm::GeneratorLabel))
node.args << arg
else
raise 'Invalid argument `%s\' for instruction' % arg.inspect
@ -65,17 +65,6 @@ module Asm
}
}
#externs dropped for now
def extern(sym)
if (lbl = @externs.find { |extern| extern.name == sym })
lbl
else
@externs << lbl = Asm::Arm::GeneratorExternLabel.new(sym)
add_value lbl
lbl
end
end
def assemble_to_string
#put the strings at the end of the assembled code.
# adding them will fix their position and make them assemble after

View File

@ -15,11 +15,3 @@ class Asm::Arm::GeneratorLabel < Asm::LabelObject
self
end
end
class Asm::Arm::GeneratorExternLabel < Asm::LabelObject
def initialize(name)
@name = name
extern!
end
attr_reader :name
end

View File

@ -48,37 +48,5 @@ module Asm
end
end
# class Relocation
# def initialize(pos, label, type, handler)
# @position = pos
# @label = label
# @type = type
# @handler = handler
# end
# attr_reader :position, :label, :type, :handler
# end
#old assemble function
#def assemble(io)
# @values.each do |obj|
# obj.assemble io, self
# end
# @relocations.delete_if do |reloc|
# io.seek reloc.position
# #puts "reloc #{reloc.inspect}"
# if (reloc.label.extern?)
# reloc.handler.call(io, io.tell, reloc.type)
# else
# reloc.handler.call(io, reloc.label.address, reloc.type)
# end
# not reloc.label.extern?
#end
#end
#def add_relocation(*args)
# reloc = Asm::Relocation.new(*args)
# #raise "reloc #{reloc.inspect}"
# @relocations << reloc
#end
end

View File

@ -3,13 +3,10 @@ module Asm
class LabelObject
def initialize
@address = nil
@extern = false
end
attr_writer :address
def address
return 0 if extern?
if (@address.nil?)
raise 'Tried to use label object that has not been set'
end
@ -20,13 +17,6 @@ module Asm
self.address = io.tell
end
def extern?
@extern
end
def extern!
@extern = true
end
end
end