This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Link tests after GCC_NO_EXECUTABLES


Rask Ingemann Lambertsen <rask@sygehus.dk> writes:
> On Thu, Nov 29, 2007 at 10:05:54PM +0000, Richard Sandiford wrote:
>> Even though current mainline can build libgfortran, all tests fail for
>> simulator testing, and I'm not sure whether you could get it work for
>> bare-metal boards or not. 
>
>    It works on arm-unknown-elf, v850-unknown-elf and frv-unknown-elf:
> http://gcc.gnu.org/ml/gcc-testresults/2007-11/msg01428.html
> http://gcc.gnu.org/ml/gcc-testresults/2007-11/msg01468.html
> http://gcc.gnu.org/ml/gcc-testresults/2007-11/msg00427.html
>
>    Some work has been and is being done in this area:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21185
>
>    Hans, you showed gfortran results for cris-elf, but we don't seem to be
> building gfortran for the cris?
>
>> It sounds like we've agreed that, if we want
>> to support libgfortran on targets like mips*-elf*, we should use
>> libstd++-like with_newlib checks there too.
>
>    Likewise for the other target libraries - how many did you test?

C, C++ and Objective C.  Libjava isn't supported before or after
the patch for mips*-elf*.  Which other libraries were you thinking of?

>    I tried a build of sparc-unknown-elf (which is know to fail link tests)
> with "with_newlib" checks around the AC_LIBTOOL_DLOPEN macro in both
> libstdc++ and libgfortran. It fails because:
>
> configure:3391: checking whether symbol versioning is supported
> configure:3402: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
>
> With this patch I get marginally further:

Yeah, as it happens, I'd got a similar patch too.  As the comment says,
the test is taken from libssp, which was later adjusted to handle
$with_newlib correctly:

--------------------------------------------------------------------------
AC_MSG_CHECKING([whether symbol versioning is supported])
cat > conftest.map <<EOF
FOO_1.0 {
  global: *foo*; bar; local: *;
};
EOF
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
if test x$gcc_no_link = xyes; then
  # If we cannot link, we cannot build shared libraries, so do not use
  # symbol versioning.
  ssp_use_symver=no
else
  AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
fi
LDFLAGS="$save_LDFLAGS"
AC_MSG_RESULT($ssp_use_symver)
AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" = xyes])
--------------------------------------------------------------------------

So my patch simply copied the new test across to libgfortran, although the
outcome is obviously the same either way.

However, I then realised that it was only the beginning.  We have lots
of AC_CHECK_FUNCS and AC_CHECK_LIB tests, which we would need to handle
in the same way as for libstdc++-v3.  A useful project, but probably too
dangerous for 4.3.

>> @@ -2410,6 +2368,16 @@ fi
>>  
>>  # Search for other target-specific linker scripts and such.
>>  case "${target}" in
>> +  m32c-*-* )
>> +    if test -d ${srcdir}/libgloss/m32c; then
>> +      # This is for crt0.o
>> +      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -B$$r/$(TARGET_SUBDIR)/libgloss/m32c'
>> +      # This is for r8c.ld
>> +      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/m32c'
>> +      # This is for libnosys.a
>> +      FLAGS_FOR_TARGET=$FLAGS_FOR_TARGET' -L$$r/$(TARGET_SUBDIR)/libgloss/libnosys'
>> +    fi
>> +    ;;
>>    mep*)
>>      FLAGS_FOR_TARGET="$FLAGS_FOR_TARGET -mlibrary"
>>      ;;
>
>    This hunk should be left out.

I was thinking I should return it to the pre-patch situation, as I wasn't
comfortable overriding a decision made by the m32c maintainer.  That said,
the changelog says:

2006-04-18  DJ Delorie  <dj@redhat.com>

	* configure.in (m32c): Build libstdc++-v3.  Pass flags to
	reference libgloss so that libssp can be built in a combined
	tree.
	* configure: Regenerate.

and libssp was later made newlib-friendly by (at least):

2006-09-29  Joseph S. Myers  <joseph@codesourcery.com>

	PR other/25035
	* configure.ac (AC_EXEEXT): Remove.
	(GCC_NO_EXECUTABLES): Call.
	(ssp_use_symver): Default to no if unable to link.
	(AC_CHECK_FUNCS): Hardwire results if unable to link.
	* aclocal.m4, configure, Makefile.in: Regenerate.

Mark, DJ?  Do you agree it's OK to drop that hunk?

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]