2008-09-18 21:02:32 +00:00
|
|
|
require 'metasm'
|
|
|
|
|
|
|
|
src = <<EOS
|
|
|
|
void foo(int);
|
|
|
|
void bla()
|
|
|
|
{
|
|
|
|
int i = 10;
|
|
|
|
while (--i)
|
|
|
|
foo(i);
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
cp = Metasm::C::Parser.parse src
|
|
|
|
puts cp, '', ' ----', ''
|
|
|
|
cp.precompile
|
|
|
|
puts cp, '', ' ----', ''
|
|
|
|
|
|
|
|
cp = Metasm::C::Parser.parse src
|
|
|
|
cpu = Metasm::Ia32.new
|
|
|
|
cpu.generate_PIC = false
|
2008-10-19 21:03:39 +00:00
|
|
|
puts cpu.new_ccompiler(cp).compile
|