node/lib/metasm/metasm/exe_format/elf_decode.rb
# marks a symbol as @encoded.export (from s.value, using segments or sections)
marks a symbol as @encoded.export (from s.value, using segments or sections)
marks a symbol as @encoded . export ( from s . value using segments or sections )
def decode_symbol_export(s)
		if s.name and s.shndx != 'UNDEF' and %w[NOTYPE OBJECT FUNC].include?(s.type)
			if @header.type == 'REL'
				sec = @sections[s.shndx]
				o = sec.offset + s.value
			elsif not o = addr_to_off(s.value)
				if not seg = @segments.find { |seg_| seg_.type == 'LOAD' and seg_.vaddr + seg_.memsz == s.value }	
					puts "W: Elf: symbol points to unmmaped space (#{s.inspect})" if $VERBOSE and s.shndx != 'ABS'
					return
				end
				o = s.value - seg.vaddr + seg.offset
			end
			name = s.name
			while @encoded.export[name] and @encoded.export[name] != o
				puts "W: Elf: symbol #{name} already seen at #{'%X' % @encoded.export[name]} - now at #{'%X' % o}) (may be a different version definition)" if $VERBOSE
				name += '_'	
			end
			@encoded.add_export name, o
		end
	end
def decode_symbol_export ( s ) if s . name and s . shndx != 'UNDEF' and %w[ NOTYPE OBJECT FUNC ] . include? ( s . type ) if @header . type == 'REL' sec = @sections [ s . shndx ] o = sec . offset + s . value elsif not o = addr_to_off ( s . value ) if not seg = @segments . find { | seg_ | seg_ . type == 'LOAD' and seg_ . vaddr + seg_ . memsz == s . value } puts "W: Elf: symbol points to unmmaped space (#{s.inspect})" if $VERBOSE and s . shndx != 'ABS' return end o = s . value - seg . vaddr + seg . offset end name = s . name while @encoded . export [ name ] and @encoded . export [ name ] != o puts "W: Elf: symbol #{name} already seen at #{'%X' % @encoded.export[name]} - now at #{'%X' % o}) (may be a different version definition)" if $VERBOSE name += '_' end @encoded . add_export name , o end end
marks a symbol as @encoded.export (from s.value, using segments or sections)
marks a symbol as @encoded . export ( from s . value using segments or sections )
# allow to point to end of segment # check end # LoadedELF would have returned an addr_to_off = addr # do not modify inplace
s