[Joeq-checkins] SF.net SVN: joeq: [2474] trunk
Status: Alpha
Brought to you by:
joewhaley
From: <joe...@us...> - 2006-12-24 07:54:26
|
Revision: 2474 http://svn.sourceforge.net/joeq/?rev=2474&view=rev Author: joewhaley Date: 2006-12-23 23:54:24 -0800 (Sat, 23 Dec 2006) Log Message: ----------- Fix for corrupt ELF files. Thanks to Alan Ryan for tracking this down. Also an incomplete attempt at getting bootstrapping working on the newest JDK 1.5. Modified Paths: -------------- trunk/joeq_native/joeq/Bootstrap/SinglePassBootImage.java trunk/joeq_native/joeq/ClassLib/sun15_linux/Interface.java trunk/joeq_native/joeq/ClassLib/sun15_linux/java/io/FileDescriptor.java trunk/joeq_native/joeq/Linker/ELF/ELFOutput.java trunk/joeq_native/joeq/Linker/ELF/ELFRandomAccessFile.java trunk/jwutil/main/src/java/jwutil/io/DataOutputByteBuffer.java Modified: trunk/joeq_native/joeq/Bootstrap/SinglePassBootImage.java =================================================================== --- trunk/joeq_native/joeq/Bootstrap/SinglePassBootImage.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/joeq_native/joeq/Bootstrap/SinglePassBootImage.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -1443,8 +1443,14 @@ e = new SymbolTableEntry("joeq_code_startaddress", 0, 0, STB_GLOBAL, STT_OBJECT, text); symtab.addSymbol(e); + e = new SymbolTableEntry("joeq_code_endaddress", bca.size(), 0, STB_GLOBAL, STT_OBJECT, text); + symtab.addSymbol(e); + e = new SymbolTableEntry("joeq_data_startaddress", 0, 0, STB_GLOBAL, STT_OBJECT, data); symtab.addSymbol(e); + + e = new SymbolTableEntry("joeq_data_endaddress", heapCurrent, 0, STB_GLOBAL, STT_OBJECT, data); + symtab.addSymbol(e); } it = text_relocs1.iterator(); @@ -1521,7 +1527,7 @@ byte[] b; if (heapBuffer.hasArray()) b = heapBuffer.array(); else { - b = new byte[heapBuffer.position()]; + b = new byte[heapCurrent]; heapBuffer.position(0); heapBuffer.get(b); } Modified: trunk/joeq_native/joeq/ClassLib/sun15_linux/Interface.java =================================================================== --- trunk/joeq_native/joeq/ClassLib/sun15_linux/Interface.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/joeq_native/joeq/ClassLib/sun15_linux/Interface.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -50,6 +50,11 @@ k = (jq_Class) PrimordialClassLoader.getJavaLangClass(); nullInstanceFields.add(k.getOrCreateInstanceField("name", "Ljava/lang/String;")); + // generated during reflective access. + k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljava/lang/reflect/Field;"); + nullInstanceFields.add(k.getOrCreateInstanceField("fieldAccessor", "Lsun/reflect/FieldAccessor;")); + nullInstanceFields.add(k.getOrCreateInstanceField("overrideFieldAccessor", "Lsun/reflect/FieldAccessor;")); + // crashes on reflective access. k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Lsun/reflect/UnsafeStaticFieldAccessorImpl;"); nullInstanceFields.add(k.getOrCreateInstanceField("base", "Ljava/lang/Object;")); @@ -75,6 +80,12 @@ nullStaticFields.add(k.getOrCreateStaticField("first", "Lsun/misc/Cleaner;")); nullStaticFields.add(k.getOrCreateStaticField("dummyQueue", "Ljava/lang/ref/ReferenceQueue;")); + // reflective access not allowed. + k = (jq_Class) PrimordialClassLoader.loader.getOrCreateBSType("Ljava/io/FileDescriptor;"); + nullStaticFields.add(k.getOrCreateStaticField("in", "Ljava/io/FileDescriptor;")); + nullStaticFields.add(k.getOrCreateStaticField("out", "Ljava/io/FileDescriptor;")); + nullStaticFields.add(k.getOrCreateStaticField("err", "Ljava/io/FileDescriptor;")); + // we need to reinitialize in/out/err on startup. if (jq.on_vm_startup != null) { Object[] args = { } ; Modified: trunk/joeq_native/joeq/ClassLib/sun15_linux/java/io/FileDescriptor.java =================================================================== --- trunk/joeq_native/joeq/ClassLib/sun15_linux/java/io/FileDescriptor.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/joeq_native/joeq/ClassLib/sun15_linux/java/io/FileDescriptor.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -15,10 +15,17 @@ static FileDescriptor out; static FileDescriptor err; + private /* */ FileDescriptor(int fd) { + this.fd = fd; + } + public static void init() { - in.fd = 0; - out.fd = 1; - err.fd = 2; + in = new FileDescriptor(0); + out = new FileDescriptor(0); + err = new FileDescriptor(0); + //in.fd = 0; + //out.fd = 1; + //err.fd = 2; } } Modified: trunk/joeq_native/joeq/Linker/ELF/ELFOutput.java =================================================================== --- trunk/joeq_native/joeq/Linker/ELF/ELFOutput.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/joeq_native/joeq/Linker/ELF/ELFOutput.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -22,7 +22,7 @@ public DataOutput getOutput() { return out; } public void write_byte(byte v) throws IOException { - out.write(v); + out.writeByte(v); } public void write_bytes(byte[] v) throws IOException { Modified: trunk/joeq_native/joeq/Linker/ELF/ELFRandomAccessFile.java =================================================================== --- trunk/joeq_native/joeq/Linker/ELF/ELFRandomAccessFile.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/joeq_native/joeq/Linker/ELF/ELFRandomAccessFile.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -96,7 +96,7 @@ } public void write_byte(byte v) throws IOException { - file.write(v); + file.writeByte(v); } public void write_bytes(byte[] v) throws IOException { @@ -105,25 +105,25 @@ public void write_half(int v) throws IOException { if (isLittleEndian()) { - file.write((byte)v); - file.write((byte)(v>>8)); + file.writeByte((byte)v); + file.writeByte((byte)(v>>8)); } else { - file.write((byte)(v>>8)); - file.write((byte)v); + file.writeByte((byte)(v>>8)); + file.writeByte((byte)v); } } public void write_word(int v) throws IOException { if (isLittleEndian()) { - file.write((byte)v); - file.write((byte)(v>>8)); - file.write((byte)(v>>16)); - file.write((byte)(v>>24)); + file.writeByte((byte)v); + file.writeByte((byte)(v>>8)); + file.writeByte((byte)(v>>16)); + file.writeByte((byte)(v>>24)); } else { - file.write((byte)(v>>24)); - file.write((byte)(v>>16)); - file.write((byte)(v>>8)); - file.write((byte)v); + file.writeByte((byte)(v>>24)); + file.writeByte((byte)(v>>16)); + file.writeByte((byte)(v>>8)); + file.writeByte((byte)v); } } Modified: trunk/jwutil/main/src/java/jwutil/io/DataOutputByteBuffer.java =================================================================== --- trunk/jwutil/main/src/java/jwutil/io/DataOutputByteBuffer.java 2006-11-06 09:30:45 UTC (rev 2473) +++ trunk/jwutil/main/src/java/jwutil/io/DataOutputByteBuffer.java 2006-12-24 07:54:24 UTC (rev 2474) @@ -31,7 +31,7 @@ * @see java.io.DataOutput#write(int) */ public void write(int b) throws IOException { - buf.putInt(b); + buf.put((byte)b); } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |