Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv13813
Modified Files:
coff.py make-pe-exe.py
Log Message:
moved make_coff_header to coff.py
Index: coff.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/coff.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- coff.py 16 May 2003 14:03:29 -0000 1.1
+++ coff.py 16 May 2003 16:23:04 -0000 1.2
@@ -8,6 +8,49 @@
from linkie import Linkie
+def make_coff_header ():
+ h = Linkie('<')
+ h.align(4)
+ h[::2] = '#coff/magic'
+ # Known magic values:
+ # 0x0000 unknown
+ # 0x014C i80386
+ # 0x014D i80486
+ # 0x014E Pentium
+ # 0x0162 Mips Mark I (R2000, R3000)
+ # 0x0163 Mips Mark II (R6000)
+ # 0x0166 Mips Mark III (R4000)
+ # 0x0168 R10000
+ # 0x0184 Alpha AXP
+ # 0x01A2 Hitachi SH3
+ # 0x01A6 Hitachi SH4
+ # 0x01C0 ARM
+ # 0x01F0 PowerPC LittleEndian
+ # 0x0200 ia64
+ # 0x0266 Mips 16
+ # 0x0268 m68k
+ # 0x0284 Alpha AXP 64-bit
+ # 0x0366 Mips with FPU
+ # 0x0466 Mips 16 with FPU
+ h[::2] = '#coff/nscns'
+ h[::4] = '#coff/timdat', '!coff/symptr', '#coff/nsyms'
+ h[::2] = '#coff/opthdr', '#coff/flags'
+ # Flags for COFF:
+ # 0x0001 no relocations -- can only be loaded at the preferred address
+ # 0x0002 executable
+ # 0x0004 no COFF line number data
+ # 0x0008 no COFF local symbol entries
+ # Additional flags for PE:
+ # 0x0010 aggressively trim working set (?)
+ # 0x0020 program is aware of addresses larger than 2Gi
+ # 0x0040 reserved
+ # 0x0200 debugging information stripped away
+ # 0x0400 if file on removable media, copy and run from swap (?)
+ # 0x1000 is a system program (?)
+ # 0x2000 library
+ # 0x4000 should only be run on uniprocessor machines
+ return h
+
def make_coff_section_header (byte_order, name):
h = Linkie(byte_order)
h.align(4)
@@ -22,4 +65,3 @@
h[::2] = '#%s/lineno' % name
h[::4] = '#%s/flags' % name
return h
-
Index: make-pe-exe.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/make-pe-exe.py,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- make-pe-exe.py 16 May 2003 15:02:36 -0000 1.65
+++ make-pe-exe.py 16 May 2003 16:23:04 -0000 1.66
@@ -10,54 +10,13 @@
from linkie import Linkie
from pe import *
+from coff import *
import time
# This file is *very* incomplete
def roundup (value, boundary):
return (value + boundary - 1) & ~(boundary - 1)
-
-def make_coff_header ():
- h = Linkie('<')
- h.align(4)
- h[::2] = '#coff/magic'
- # Known magic values:
- # 0x0000 unknown
- # 0x014C i80386
- # 0x014D i80486
- # 0x014E Pentium
- # 0x0162 Mips Mark I (R2000, R3000)
- # 0x0163 Mips Mark II (R6000)
- # 0x0166 Mips Mark III (R4000)
- # 0x0168 R10000
- # 0x0184 Alpha AXP
- # 0x01A2 Hitachi SH3
- # 0x01A6 Hitachi SH4
- # 0x01C0 ARM
- # 0x01F0 PowerPC LittleEndian
- # 0x0200 ia64
- # 0x0266 Mips 16
- # 0x0268 m68k
- # 0x0284 Alpha AXP 64-bit
- # 0x0366 Mips with FPU
- # 0x0466 Mips 16 with FPU
- h[::2] = '#coff/nscns'
- h[::4] = '#coff/timdat', '!coff/symptr', '#coff/nsyms'
- h[::2] = '#coff/opthdr', '#coff/flags'
- # Flags for PE:
- # 0x0001 no relocations -- can only be loaded at the preferred address
- # 0x0002 executable
- # 0x0004 no COFF line number data
- # 0x0008 no COFF local symbol entries
- # 0x0010 aggressively trim working set (?)
- # 0x0020 program is aware of addresses larger than 2Gi
- # 0x0040 reserved
- # 0x0200 debugging information stripped away
- # 0x0400 if file on removable media, copy and run from swap (?)
- # 0x1000 is a system program (?)
- # 0x2000 library
- # 0x4000 should only be run on uniprocessor machines
- return h
text = Linkie('<') # ia32
text.place_symbol('&_start')
|