[Wisp-cvs] wisp/users/dig elf.py,1.14,1.15 makehello.py,1.16,1.17
Status: Alpha
Brought to you by:
digg
From: <di...@us...> - 2003-04-03 08:49:17
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv13761 Modified Files: elf.py makehello.py Log Message: wrote emit_ELF32_symstr_entry Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- elf.py 24 Mar 2003 21:18:13 -0000 1.14 +++ elf.py 3 Apr 2003 08:49:11 -0000 1.15 @@ -386,6 +386,13 @@ t.place_symbol('#elf/shnum', len(names) + 1) return t +# Returns offset of the string added +def emit_ELF32_symstr_entry (symstr, string): + ofs = symstr.memsz() + symstr.emit_string (string) + symstr.emit_byte(0) + return ofs + # Thoughts of generating ELF32 files # * In ELF parlance, linker notes are called relocations. # We need to solve relocations only when generating an Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- makehello.py 1 Apr 2003 09:07:12 -0000 1.16 +++ makehello.py 3 Apr 2003 08:49:12 -0000 1.17 @@ -167,11 +167,8 @@ for symbol, value in section.get_symbols(): if symbol[0] != '&': continue # only process memory references symbol = symbol[1:] # but not their prefixen - symstr = sections['.symstr'] - symstr.place_symbol('#.symstr/strings/' + symbol) - sections['.symstr'].emit_string(symbol) - sections['.symstr'].emit_byte(0) - sections['.symtab'].emit_tetra_sum(['#.symstr/strings/' + symbol]) + ofs = emit_ELF32_symstr_entry(sections['.symstr'], symbol) + sections['.symtab'].emit_tetra(ofs) sections['.symtab'].emit_tetra_sum(['&' + name]) sections['.symtab'].emit_tetra(0) sections['.symtab'].emit_byte(STB.GLOBAL << 4 | STT.NOTYPE) |