[Wisp-cvs] wisp/users/dig elf.py,1.61,1.62 elf.tran,1.2,1.3
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-05-18 16:46:06
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv7613 Modified Files: elf.py elf.tran Log Message: converted the body of make_ELF32_header into the |make-elf32-header| tran macro Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.61 retrieving revision 1.62 diff -u -d -r1.61 -r1.62 --- elf.py 18 May 2003 16:29:37 -0000 1.61 +++ elf.py 18 May 2003 16:46:02 -0000 1.62 @@ -326,26 +326,11 @@ def make_ELF32_header (byte_order, reloc = 0): h = Linkie(byte_order) - h.align(4) - h[::1] = 0x7F, 0x45, 0x4C, 0x46 # magic - h[::1] = ELFCLASS.TETRA - if byte_order == '<': - h[::1] = ELFDATA.TWOLSB - elif byte_order == '>': - h[::1] = ELFDATA.TWOMSB - else: - raise 'Invalid byte order', byte_order - h[::1] = EV.CURRENT - h[::1] = (0,) * 9 - h[::2] = '#elf/type', '#elf/machine' - h[::4] = EV.CURRENT - if not reloc: h[::4] = '&_start', '!elf/proghdr' - else: h[::4] = 0, 0 - h[::4] = '!elf/secthdr', '#elf/flags' - h[::2] = 0x34, 32 # e_ehsize, e_phentsize - h[::2] = '#elf/phnum' - h[::2] = 40 # e_shentsize - h[::2] = '#elf/shnum', '#elf/shstrndx' + interpret_single('make-elf32-header', h, include = 'elf') + if byte_order == '<': h.place_symbol('#elf/byte-order', ELFDATA.TWOLSB) + elif byte_order == '>': h.place_symbol('#elf/byte-order', ELFDATA.TWOMSB) + else: raise 'Invalid byte order', byte_order + if reloc: h.place_symbol('&_start', 0); h.place_symbol('!elf/proghdr', 0) return h def make_ELF32_phtable (byte_order, names): Index: elf.tran =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.tran,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- elf.tran 18 May 2003 16:29:37 -0000 1.2 +++ elf.tran 18 May 2003 16:46:02 -0000 1.3 @@ -6,6 +6,32 @@ \ \\\\ @(#) $Id$ +:[ ] ELF-CLASS-NONE 0 ; +:[ ] ELF-CLASS-TETRA 1 ; +:[ ] ELF-CLASS-OCTA 2 ; +:[ ] ELF-CLASS-NUM 3 ; + +:[ ] ELF-EV-NONE 0 ; +:[ ] ELF-EV-CURRENT 1 ; +:[ ] ELF-EV-NUM 2 ; + +:[ ] make-elf32-header \ ( -- ) + 16 align \ well ... + #x7F b, #x45 b, #x4C b, #x46 b, \ magic + ELF-CLASS-TETRA b, + '#elf/byte-order b, + ELF-EV-CURRENT b, + 16 align \ padding + '#elf/type w, '#elf/machine w, + ELF-EV-CURRENT t, + '&_start t, '!elf/proghdr t, + '!elf/secthdr t, '#elf/flags t, + #x34 w, 32 w, \ e_ehsize, e_phentsize + '#elf/phnum w, + 40 w, \ e_shentsize + '#elf/shnum w, '#elf/shstrndx w, +; + :[ ] make-elf32-phentry \ ( section-name -- ) 4 align dup mingle #*/p_type t, |