node/lib/metasm/metasm/exe_format/elf_encode.rb
def automagic_symbols
		GNUExports rescue return	# autorequire
		autoexports = GNUExports::EXPORT.dup
		@sections.each { |s|
			next if not s.encoded
			s.encoded.export.keys.each { |e| autoexports.delete e }
		}
		@sections.each { |s|
			next if not s.encoded
			s.encoded.reloc.each_value { |r|
				et = r.target.externals
				extern = et.find_all { |name| autoexports[name] }
				next if extern.length != 1
				symname = extern.first
				if not @symbols.find { |sym| sym.name == symname }
					@tag['NEEDED'] ||= []
					@tag['NEEDED'] |= [autoexports[symname]]
					sym = Symbol.new
					sym.shndx = 'UNDEF'
					sym.type = 'FUNC'
					sym.name = symname
					sym.bind = 'GLOBAL'
					@symbols << sym
				end
			}
		}
	end
# creates the undef symbol list from the section.encoded.reloc and a list of known exported symbols (e.g. from libc)
# also populates @tag['NEEDED']
creates the undef symbol list from the section.encoded.reloc and a list of known exported symbols
also populates @tag['NEEDED']
creates the undef symbol list from the section . encoded . reloc and a list of known exported symbols also populates @tag [ ' NEEDED ' ]
def automagic_symbols
		GNUExports rescue return	
		autoexports = GNUExports::EXPORT.dup
		@sections.each { |s|
			next if not s.encoded
			s.encoded.export.keys.each { |e| autoexports.delete e }
		}
		@sections.each { |s|
			next if not s.encoded
			s.encoded.reloc.each_value { |r|
				et = r.target.externals
				extern = et.find_all { |name| autoexports[name] }
				next if extern.length != 1
				symname = extern.first
				if not @symbols.find { |sym| sym.name == symname }
					@tag['NEEDED'] ||= []
					@tag['NEEDED'] |= [autoexports[symname]]
					sym = Symbol.new
					sym.shndx = 'UNDEF'
					sym.type = 'FUNC'
					sym.name = symname
					sym.bind = 'GLOBAL'
					@symbols << sym
				end
			}
		}
	end
def automagic_symbols GNUExports rescue return autoexports = GNUExports :: EXPORT . dup @sections . each { | s | next if not s . encoded s . encoded . export . keys . each { | e | autoexports . delete e } } @sections . each { | s | next if not s . encoded s . encoded . reloc . each_value { | r | et = r . target . externals extern = et . find_all { | name | autoexports [ name ] } next if extern . length != 1 symname = extern . first if not @symbols . find { | sym | sym . name == symname } @tag [ 'NEEDED' ] ||= [ ] @tag [ 'NEEDED' ] |= [ autoexports [ symname ] ] sym = Symbol . new sym . shndx = 'UNDEF' sym . type = 'FUNC' sym . name = symname sym . bind = 'GLOBAL' @symbols << sym end } } end
creates the undef symbol list from the section.encoded.reloc and a list of known exported symbols (e.g.
creates the undef symbol list from the section . encoded . reloc and a list of known exported symbols ( e . g .
# autorequire