node/lib/metasm/metasm/exe_format/elf_decode.rb
# read symbol table, and mark all symbols found as exports of self.encoded
# tables locations are found in self.tags
# XXX symbol count is found from the hash table, this may not work with GNU_HASH only binaries
read symbol table, and mark all symbols found as exports of self.encoded
tables locations are found in self.tags
XXX symbol count is found from the hash table, this may not work with GNU_HASH only binaries
read symbol table and mark all symbols found as exports of self . encoded tables locations are found in self . tags XXX symbol count is found from the hash table this may not work with GNU_HASH only binaries
def decode_segments_symbols
		return unless @tag['STRTAB'] and @tag['STRSZ'] and @tag['SYMTAB'] and (@tag['HASH'] or @tag['GNU_HASH'])
		raise "E: ELF: unsupported symbol entry size: #{@tag['SYMENT']}" if @tag['SYMENT'] != Symbol.size(self)
		if @tag['HASH']
			@encoded.ptr = @tag['HASH']	
			decode_word
			sym_count = decode_word
		else
			sym_count = check_symbols_gnu_hash(@tag['GNU_HASH'], true)
		end
		strtab = @encoded[@tag['STRTAB'], @tag['STRSZ']].data.to_str
		@encoded.ptr = @tag['SYMTAB']
		@symbols.clear
		sym_count.times {
			s = Symbol.decode(self, strtab)
			@symbols << s
			decode_symbol_export(s)
		}
		check_symbols_hash if $VERBOSE
		check_symbols_gnu_hash if $VERBOSE
	end
def decode_segments_symbols return unless @tag [ 'STRTAB' ] and @tag [ 'STRSZ' ] and @tag [ 'SYMTAB' ] and ( @tag [ 'HASH' ] or @tag [ 'GNU_HASH' ] ) raise "E: ELF: unsupported symbol entry size: #{@tag['SYMENT']}" if @tag [ 'SYMENT' ] != Symbol . size ( self ) if @tag [ 'HASH' ] @encoded . ptr = @tag [ 'HASH' ] decode_word sym_count = decode_word else sym_count = check_symbols_gnu_hash ( @tag [ 'GNU_HASH' ] , true ) end strtab = @encoded [ @tag [ 'STRTAB' ] , @tag [ 'STRSZ' ] ] . data . to_str @encoded . ptr = @tag [ 'SYMTAB' ] @symbols . clear sym_count . times { s = Symbol . decode ( self , strtab ) @symbols << s decode_symbol_export ( s ) } check_symbols_hash if $VERBOSE check_symbols_gnu_hash if $VERBOSE end
read symbol table, and mark all symbols found as exports of self.encoded
tables locations are found in self.tags
XXX symbol count is found from the hash table, this may not work with GNU_HASH only binaries
read symbol table and mark all symbols found as exports of self . encoded tables locations are found in self . tags XXX symbol count is found from the hash table this may not work with GNU_HASH only binaries
# find number of symbols # assume tag already interpreted (would need addr_to_off otherwise)