Update of /cvsroot/wisp/wisp/users/dig
In directory sc8-pr-cvs1:/tmp/cvs-serv8594
Modified Files:
elf.py makehello.py
Log Message:
prepare ELF-linking for usage of the origin feature
Index: elf.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- elf.py 17 Feb 2003 20:27:18 -0000 1.12
+++ elf.py 14 Mar 2003 19:01:16 -0000 1.13
@@ -339,7 +339,7 @@
h.emit_wyde_sum(['elf/type'])
h.emit_wyde_sum(['elf/machine'])
h.emit_tetra(EV.CURRENT)
- h.emit_tetra_sum(['_start'])
+ h.emit_tetra_sum(['&_start'])
h.emit_tetra_sum(['elf/phoff'])
h.emit_tetra_sum(['elf/shoff'])
h.emit_tetra_sum(['elf/flags'])
Index: makehello.py
===================================================================
RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- makehello.py 25 Feb 2003 20:28:33 -0000 1.13
+++ makehello.py 14 Mar 2003 19:01:18 -0000 1.14
@@ -19,9 +19,9 @@
return m
code = Linkie('<') # ia32
-code.place_symbol('_start')
+code.place_symbol('&_start')
code.emit_byte(0xBA); code.emit_tetra(14) # mov edx, 14
-code.emit_byte(0xB9); code.emit_tetra_sum(['message']) # mov ecx, message
+code.emit_byte(0xB9); code.emit_tetra_sum(['&message']) # mov ecx, message
code.emit_byte(0xBB); code.emit_tetra(1) # mov ebx, 1
code.emit_byte(0xB8); code.emit_tetra(4) # mov eax, 4
code.emit_byte(0xCD); code.emit_byte(0x80) # int 0x80
@@ -30,7 +30,7 @@
code.emit_byte(0xCD); code.emit_byte(0x80) # int 0x80
data = Linkie('<') # ia32
-data.place_symbol('message')
+data.place_symbol('&message')
data.emit_string('Hello, world!\n')
def infer_by_prefix (name, dict):
@@ -160,7 +160,7 @@
for symbol, value in section.get_symbols():
symbols[symbol] = address + value
for symbol, value in section.get_symbols():
- binary.place_symbol(symbol, offset + value) # for dump to work nicely
+ if symbol[0] != '&': continue # only process memory references
sofs = sections['.symstr'].filesz()
symbols['.symstr/strings/' + symbol] = sofs
sections['.symstr'].emit_string(symbol)
|