Sha256: 4c7f70389ce95c2504e76b28bb1103429f3807cb0734d8bc4f98d9659fee8e85

Contents?: true

Size: 726 Bytes

Versions: 3

Compression:

Stored size: 726 Bytes

Contents

#!/usr/bin/env ruby

#    This file is part of Metasm, the Ruby assembly manipulation suite
#    Copyright (C) 2006-2009 Yoann GUILLOT
#
#    Licence is LGPL, see LICENCE in the top-level directory

require 'metasm'
$opts = { :execlass => Metasm::ELF, :exetype => :lib }
load File.join(File.dirname(__FILE__), 'exeencode.rb')

__END__
.pt_gnu_stack rw
// .nointerp    // to disable the dynamic section, eg for stuff with int80 only
.text
.entrypoint
#if defined __i386__
push bla
push fmt
call printf

push 0
call exit

#elif defined __amd64__
lea rsi, [rip+bla-$_]
lea rdi, [rip+fmt-$_]
xor rax, rax
call printf

mov rdi, 0
call exit

#else
unsupported architecture!
#endif

.data
bla db "world", 0
fmt db "Hello, %s !\n", 0

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
metasm-1.0.5 samples/elfencode.rb
metasm-1.0.4 samples/elfencode.rb
metasm-1.0.3 samples/elfencode.rb