Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv4439
Modified Files:
elf.py makehello.py
Log Message:
initiated make_ELF32_header
Index: elf.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- elf.py 6 Feb 2003 21:10:23 -0000 1.2
+++ elf.py 6 Feb 2003 21:28:21 -0000 1.3
@@ -11,6 +11,11 @@
#
# The GNU C Library is © 1995-2002 by Free Software Foundation.
+class ELFCLASS: # File class
+ NONE = 0 # Invalid class
+ TETRA = 1 # 32-bit objects
+ OCTA = 2 # 64-bit objects
+ NUM = 3
class ET: # Legal values for e_type (object file type).
NONE = 0 # No file type
REL = 1 # Relocatable file
@@ -310,3 +315,11 @@
GOTPC = 10 # 32 bit PC relative offset to GOT
# Keep this the last entry.
NUM = 11
+
+from linkie import Linkie
+
+def make_ELF32_header (byte_order):
+ h = Linkie(byte_order)
+ h.emit_string('\x7F' + 'ELF') # magic
+ h.emit_byte(ELFCLASS.TETRA)
+ return h
Index: makehello.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- makehello.py 5 Feb 2003 22:43:57 -0000 1.1
+++ makehello.py 6 Feb 2003 21:28:21 -0000 1.2
@@ -7,6 +7,7 @@
#### @(#) $Id$
from linkie import Linkie
+from elf import make_ELF32_header
code = Linkie('<') # ia32
code.place_symbol('_start')
@@ -23,8 +24,12 @@
data.place_symbol('message')
data.emit_string('Hello, world!\n')
+header = make_ELF32_header('<')
+
+header.dump()
+print
code.dump()
print
data.dump()
print
-(code + data).dump()
+(header + code + data).dump()
|