PR libgcj/40868 - ecjx should be build with host compiler

Submitted by Ralf Wildenhues on Aug. 26, 2010, 6:49 p.m.

Details

Message ID 20100826184937.GI8657@gmx.de
State New
Headers show

Commit Message

Ralf Wildenhues Aug. 26, 2010, 6:49 p.m.
[ http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00930.html ]

Sorry for the delay.

Below is my attempt.  Tested in native configuration.  Can you please
test the cross compile case?  You need to use --enable-maintainer-mode
or run 'cd libjava && autoreconf -v' explicitly for the patch to have
effect.  Thanks.

Tom, if that succeeds, OK to commit?

Notes:

The patch assumes that in the native setup, users expect
CXXFLAGS and GCJFLAGS to be applied to the compile resp. link.
The latter is already done, so the former seems just logical,
which is why the compile rule is placed in the !NATIVE block only.

Ensuring both of the variables are always nonempty was done for
consistency reasons.

The dummy object is needed because, well, there are gcj versions out
there that will refuse to link without finding an object on the command
line.  It could have probably just as well been created with the same
driver, but I don't think that this way makes things worse than they
were before.

Thanks,
Ralf

Fix building ecjx in cross compile mode.

2010-08-26  Dmitrijs Ledkovs  <dmitrij.ledkov@ubuntu.com>
	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

libjava/:
	PR libgcj/40868
	* configure.ac: Add GCC_FOR_ECJX variable.  Ensure
	GCJ_FOR_ECJX is always set.
	* Makefile.am [!NATIVE] (ecjx.$(OBJEXT)): New rule.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* gcj/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

Comments

Tom Tromey Aug. 26, 2010, 7:14 p.m.
>>>>> "Ralf" == Ralf Wildenhues <Ralf.Wildenhues@gmx.de> writes:

Ralf> Below is my attempt.  Tested in native configuration.  Can you please
Ralf> test the cross compile case?  You need to use --enable-maintainer-mode
Ralf> or run 'cd libjava && autoreconf -v' explicitly for the patch to have
Ralf> effect.  Thanks.

Ralf> Tom, if that succeeds, OK to commit?

Yes, thanks.

Tom
Dmitrijs Ledkovs Aug. 26, 2010, 7:59 p.m.
On 26 August 2010 19:49, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> [ http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00930.html ]
>
> Sorry for the delay.
>
> Below is my attempt.  Tested in native configuration.  Can you please
> test the cross compile case?  You need to use --enable-maintainer-mode
> or run 'cd libjava && autoreconf -v' explicitly for the patch to have
> effect.  Thanks.
>

Successfully build cross-compiler: build/host i686-gnu-linux & target
= i686-w64-mingw32.

Thanks a lot for looking at this issue.

Patch hide | download patch | download mbox

diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index dcdf827..52d0995 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -1170,6 +1170,8 @@  ecjx_LINK = $(GCJ_FOR_ECJX_LINK) $(ecjx_LDFLAGS)
 ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR)
 ecjx_LDADD = 
 ecjx_DEPENDENCIES = 
+ecjx.$(OBJEXT): ecjx.cc
+	$(GCC_FOR_ECJX) -c $<
 
 endif !NATIVE
 
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 685cb72..df6bca3 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -394,7 +394,8 @@  NATIVE=yes
 # Which gcj and host gcj (for ecjx) do we use?
 which_gcj=default
 host_exeext=${ac_exeext}
-GCJ_FOR_ECJX=
+GCJ_FOR_ECJX='$(GCJ)'
+GCC_FOR_ECJX='$(CXX)'
 built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
 if test -n "${with_cross_host}"; then
   # We are being configured with a cross compiler. We can't
@@ -402,6 +403,7 @@  if test -n "${with_cross_host}"; then
   NATIVE=no
   cross_host_exeext=
   GCJ_FOR_ECJX="${with_cross_host}-gcj"
+  GCC_FOR_ECJX="${with_cross_host}-gcc"
   case "${with_cross_host}" in
      *mingw* | *cygwin*)
          cross_host_exeext=.exe
@@ -467,6 +469,7 @@  JAVAC="$GCJ -C"
 export JAVAC
 
 AC_SUBST(GCJ_FOR_ECJX)
+AC_SUBST(GCC_FOR_ECJX)
 AC_SUBST(GCJH)
 AC_SUBST(host_exeext)