node/lib/metasm/metasm/exe_format/elf_encode.rb
def encode(type='DYN')
		@header.type ||= {:bin => 'EXEC', :lib => 'DYN', :obj => 'REL'}.fetch(type, type)
		@header.machine ||= case @cpu.shortname
				when 'x64'; 'X86_64'
				when 'ia32'; '386'
				when 'mips'; 'MIPS'
				when 'powerpc'; 'PPC'
				when 'arm'; 'ARM'
				end

		if @header.type == 'REL'
			encode_rel
		else
			encode_elf
		end
	end
# create the relocations from the sections.encoded.reloc
# create the dynamic sections
# put sections/phdr in PT_LOAD segments
# link
# TODO support mapped PHDR, obey section-specified base address, handle NOBITS
#      encode ET_REL
create the relocations from the sections.encoded.reloc
create the dynamic sections
put sections/phdr in PT_LOAD segments
link
TODO support mapped PHDR, obey section-specified base address, handle NOBITS
encode ET_REL
create the relocations from the sections . encoded . reloc create the dynamic sections put sections / phdr in PT_LOAD segments link TODO support mapped PHDR obey section - specified base address handle NOBITS encode ET_REL
def encode(type='DYN')
		@header.type ||= {:bin => 'EXEC', :lib => 'DYN', :obj => 'REL'}.fetch(type, type)
		@header.machine ||= case @cpu.shortname
				when 'x64'; 'X86_64'
				when 'ia32'; '386'
				when 'mips'; 'MIPS'
				when 'powerpc'; 'PPC'
				when 'arm'; 'ARM'
				end
		if @header.type == 'REL'
			encode_rel
		else
			encode_elf
		end
	end
def encode ( type = 'DYN' ) @header . type ||= { :bin => 'EXEC' , :lib => 'DYN' , :obj => 'REL' } . fetch ( type , type ) @header . machine ||= case @cpu . shortname when 'x64' ; 'X86_64' when 'ia32' ; '386' when 'mips' ; 'MIPS' when 'powerpc' ; 'PPC' when 'arm' ; 'ARM' end if @header . type == 'REL' encode_rel else encode_elf end end
create the relocations from the sections.encoded.reloc
create the dynamic sections
put sections/phdr in PT_LOAD segments
link
TODO support mapped PHDR, obey section-specified base address, handle NOBITS
encode ET_REL
create the relocations from the sections . encoded . reloc create the dynamic sections put sections / phdr in PT_LOAD segments link TODO support mapped PHDR obey section - specified base address handle NOBITS encode ET_REL
type