fix names and requires to get some elf out again (still crashes though)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
require "asm/arm/code_generator"
|
||||
|
||||
if (__FILE__ == $0)
|
||||
gen = Asm::ArmCodeGenerator.new
|
||||
gen = Asm::Arm::CodeGenerator.new
|
||||
|
||||
gen.instance_eval {
|
||||
mov r0, 5
|
||||
@ -11,8 +12,7 @@ if (__FILE__ == $0)
|
||||
bx lr
|
||||
}
|
||||
|
||||
require 'objectwriter'
|
||||
require 'tempfile'
|
||||
require 'asm/object_writer'
|
||||
writer = Asm::ObjectWriter.new(Elf::Constants::TARGET_ARM)
|
||||
writer.set_text gen.assemble
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
if (__FILE__ == $0)
|
||||
obj = ELF::ObjectFile.new ELF::TARGET_ARM
|
||||
obj = Elf::ObjectFile.new Elf::TARGET_ARM
|
||||
|
||||
sym_strtab = ELF::StringTableSection.new(".strtab")
|
||||
sym_strtab = Elf::StringTableSection.new(".strtab")
|
||||
obj.add_section sym_strtab
|
||||
symtab = ELF::SymbolTableSection.new(".symtab", sym_strtab)
|
||||
symtab = Elf::SymbolTableSection.new(".symtab", sym_strtab)
|
||||
obj.add_section symtab
|
||||
|
||||
text_section = ELF::TextSection.new(".text")
|
||||
text_section = Elf::TextSection.new(".text")
|
||||
obj.add_section text_section
|
||||
|
||||
symtab.add_func_symbol "_start", 0, text_section, ELF::STB_GLOBAL
|
||||
symtab.add_func_symbol "_start", 0, text_section, Elf::STB_GLOBAL
|
||||
|
||||
fp = File.open("test.o", "wb")
|
||||
obj.write fp
|
||||
|
Reference in New Issue
Block a user