[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: PR libjava/32098: New libtool doesn't support libjava

From: Peter O'Gorman
Subject: Re: PATCH: PR libjava/32098: New libtool doesn't support libjava
Date: Mon, 28 May 2007 03:59:23 -0500

On May 28, 2007, at 2:21 AM, Paolo Bonzini wrote:

No, that's wrong. You can try changing libtool.m4 to run tests on .class files instead; compile them with an old GCJ, and include the bytecode in libtool.m4, using tr or awk to turn ASCII strings into bytecode.

That is the best I can find. I don't know anything about .classs file
nor java bytecode.

So the attached patch (untested because the problem does not reproduce on my machine) should give you an idea of what I meant. Please test it and/or fix it.

Libtool maintainers, would you accept a patch like this one? The problem is that under some configurations, GCC 4.3 cannot compile Java source code until its build has finished.

2007-05-27  Paolo Bonzini  <address@hidden>

        * libtool.m4 (_LT_LANG_GCJ_CONFIG): Run tests on .class files.

Index: libtool.m4
--- libtool.m4  (revision 125123)
+++ libtool.m4  (working copy)
@@ -6737,18 +6737,54 @@ m4_defun([_LT_LANG_GCJ_CONFIG],

-# Source file extension for Java test sources.
+# Source file extension for Java test sources. Actually, we use a list
+# of input files so that we can prepare binary .class files and keep
+# lt_simple_compile_test_code/lt_simple_link_test_code in ASCII.

 # Object file extension for compiled Java test sources.
 _LT_TAGVAR(objext, $1)=$objext

 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
+# "class conftest_compile {}"
+# Turn it into hex using "od -x foo.class | sed s/^.......// | tr - d ' '"
+awk 'BEGIN { h = "0123456789abcdef" }
+  {
+    for (i = 1; i <= length; i+=2)
+ printf "%c", 16*index(h, substr($0, i, 1))+index(h, substr ($0, i+1, 1))-17
+  }' > conftest_compile.class << EOF

As I understand the theory (compile .class files instead of .java files) this is fine with me. However, being curious about the portability of the awk expression, I tried it on solaris, there with both awk and nawk, printf "%c",0; prints nothing at all, so all those 00 above do not end up in the output. Needs another method to convert text to binary.

% od -x < conftest_compile.class
0000000 cafe babe 310d 0a03 0a07 0b07 0c01 063c
0000020 696e 6974 3e01 0328 2956 0104 436f 6465
0000040 010f 4c69 6e65 4e75 6d62 6572 5461 626c
0000060 6501 0a53 6f75 7263 6546 696c 6501 1563
0000100 6f6e 6674 6573 745f 636f 6d70 696c 652e
0000120 6a61 7661 0c04 0501 1063 6f6e 6674 6573
0000140 745f 636f 6d70 696c 6501 106a 6176 612f
0000160 6c61 6e67 2f4f 626a 6563 7420 0203 0104
0000200 0501 061d 0101 052a b701 b101 0706 0101
0000220 0108 0209

Peter O'Gorman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]