public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Link tests after GCC_NO_EXECUTABLES
@ 2007-09-18 11:56 Jie Zhang
  2007-09-18 12:25 ` Bernd Schmidt
  2007-09-18 13:55 ` Rask Ingemann Lambertsen
  0 siblings, 2 replies; 72+ messages in thread
From: Jie Zhang @ 2007-09-18 11:56 UTC (permalink / raw)
  To: gcc

libstdc++ tries to avoid link tests when configured with newlib. But I
saw this when working on bfin port gcc:

checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed 
after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Error 1
make[1]: Leaving directory 
`/home/jie/blackfin-sources/build43/gcc_build-4.3'
make: *** [all] Error 2

I got this when building bfin-elf-gcc with patched gcc and newlib in the
same tree. I found LT_SYS_DLOPEN_SELF does link tests for shl_load after
GCC_NO_EXECUTABLES. The call path is

"libstdc++-v3/configure.ac" AM_PROG_LIBTOOL -> "libtool.m4" LT_INIT ->
_LT_SETUP -> _LT_LANG_C_CONFIG -> LT_SYS_DLOPEN_SELF

How about the patch below, which uses LT_SYS_DLOPEN_SELF only when not
cross compiling.


Jie


	* libtool.m4 (_LT_LANG_C_CONFIG): Only use LT_SYS_DLOPEN_SELF
	when not cross compiling.

Index: libtool.m4
===================================================================
--- libtool.m4  (revision 128569)
+++ libtool.m4  (working copy)
@@ -5117,7 +5117,9 @@
    _LT_LINKER_SHLIBS($1)
    _LT_SYS_DYNAMIC_LINKER($1)
    _LT_LINKER_HARDCODE_LIBPATH($1)
-  LT_SYS_DLOPEN_SELF
+  if test "$cross_compiling" = no; then
+    LT_SYS_DLOPEN_SELF
+  fi
    _LT_CMD_STRIPLIB

    # Report which library types will actually be built


^ permalink raw reply	[flat|nested] 72+ messages in thread
* Re: Link tests after GCC_NO_EXECUTABLES
@ 2007-11-28  1:34 Benjamin Kosnik
  2007-11-28  2:04 ` Joseph S. Myers
  0 siblings, 1 reply; 72+ messages in thread
From: Benjamin Kosnik @ 2007-11-28  1:34 UTC (permalink / raw)
  To: gcc

> if there is a rule that
> libstdc++ configure shouldn't try to link anything, it doesn't appear
> to be well enforced. 

The rule is that libstdc++ shouldn't do link tests unless it knows it
is native. Not "libstdc++ configure shouldn't try to link anything."

This means that there is a huge bias to do compile-time tests if at
all possible, as then native/cross configury is unified.

From configure.ac...

# Enable all the variable C++ runtime options that doesn't require
linking. 
GLIBCXX_ENABLE_CSTDIO

...

# Checks for operating systems support that don't require linking.
GLIBCXX_CHECK_SYSTEM_ERROR

...

if $GLIBCXX_IS_NATIVE; then

  # We can do more elaborate tests that assume a working linker.
  CANADIAN=no
....

The intent here seems obvious to me: is this not clear? 

It's not especially well enforced, as you note. (And other runtimes
may not take as much care or notice about this at all.) In particular, 

>> AM_PROG_LIBTOOL -> "libtool.m4" LT_INIT ->
>> _LT_SETUP -> _LT_LANG_C_CONFIG -> LT_SYS_DLOPEN_SELF

is not something libstdc++ has much control over.... I see this as a
bug in AM_PROG_LIBTOOL or these other macros.

> In any case, I think this is something that ought to be decided as a
> global policy for GCC and its run-time libraries, not something that
> differs between ports.  In particular, if run-time libraries are
> allowed to depend on linking in their configure tests, that's
> something everyone should know.

And....

> Since the preferred bare-metal setup is that linking not
> work without -msim (or a -T option), we don't want configure tests
> that detect any properties that might depend on what happens when you
> link. We want to make sure that detected properties are a property
> only of the parts that a user isn't going to change.

Thanks for this Mark. Absolutely agreed.

It is insanity to have this differ on a machine by machine or port by
port basis!!!! 

-benjamin


^ permalink raw reply	[flat|nested] 72+ messages in thread

end of thread, other threads:[~2007-12-04 14:46 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-18 11:56 Link tests after GCC_NO_EXECUTABLES Jie Zhang
2007-09-18 12:25 ` Bernd Schmidt
2007-09-18 12:52   ` Jie Zhang
2007-09-18 13:13     ` Bernd Schmidt
2007-09-18 13:15       ` Jie Zhang
2007-09-18 13:27         ` Bernd Schmidt
2007-09-18 13:33           ` Daniel Jacobowitz
2007-09-18 14:11             ` Jie Zhang
2007-09-18 14:02           ` Jie Zhang
2007-09-18 14:27             ` Bernd Schmidt
2007-09-18 14:48               ` Jie Zhang
2007-11-27 14:10             ` Bernd Schmidt
2007-11-27 22:40               ` Mark Mitchell
2007-11-27 22:46                 ` Bernd Schmidt
2007-11-27 23:40                   ` Mark Mitchell
2007-11-27 23:48                     ` Bernd Schmidt
2007-11-28  0:19                       ` Mark Mitchell
2007-11-28  0:43                         ` Bernd Schmidt
2007-11-28  0:45                           ` Mark Mitchell
2007-11-28  0:55                             ` Bernd Schmidt
2007-11-28  1:05                               ` Mark Mitchell
2007-11-28  1:14                                 ` Bernd Schmidt
2007-11-28  2:14                                   ` Mark Mitchell
2007-11-28 13:30                                     ` Bernd Schmidt
2007-11-28  1:28                                 ` Joseph S. Myers
2007-11-28  2:07                                   ` Mark Mitchell
2007-11-28  2:40                                     ` Joseph S. Myers
2007-11-28  8:12                                       ` Mark Mitchell
2007-11-28 13:17                                       ` Bernd Schmidt
2007-11-28 11:40                                     ` Hans-Peter Nilsson
2007-11-28 13:06                             ` Richard Sandiford
2007-11-28 14:32                               ` Rask Ingemann Lambertsen
2007-11-28 17:33                               ` Daniel Jacobowitz
2007-11-28 19:49                               ` Mark Mitchell
2007-11-28 21:04                                 ` Richard Sandiford
2007-11-28 22:42                                 ` Rask Ingemann Lambertsen
2007-11-29  6:15                                   ` Mark Mitchell
2007-11-30 19:37                                     ` Rask Ingemann Lambertsen
2007-11-30 19:45                                       ` Mark Mitchell
2007-11-30 22:19                                         ` Rask Ingemann Lambertsen
2007-12-01  9:48                                           ` Richard Sandiford
2007-12-01 11:53                                             ` Rask Ingemann Lambertsen
2007-12-01 12:03                                               ` Rask Ingemann Lambertsen
2007-12-01 13:37                                                 ` Andreas Schwab
2007-12-01 22:35                                                   ` Rask Ingemann Lambertsen
2007-12-02 21:11                                                     ` Mark Mitchell
2007-12-04 14:46                                                     ` Rask Ingemann Lambertsen
2007-11-29 22:59                                 ` Richard Sandiford
2007-11-29 23:18                                   ` Mark Mitchell
2007-11-29 23:33                                     ` Benjamin Kosnik
2007-11-30 16:11                                   ` Rask Ingemann Lambertsen
2007-11-30 16:27                                     ` Mark Mitchell
2007-11-30 22:18                                       ` Rask Ingemann Lambertsen
2007-11-30 17:00                                     ` Richard Sandiford
2007-11-30 18:17                                       ` Rask Ingemann Lambertsen
2007-11-30 20:52                                       ` Mark Mitchell
2007-11-30 21:17                                         ` DJ Delorie
2007-12-01  9:55                                         ` Richard Sandiford
2007-12-02 21:01                                           ` Mark Mitchell
2007-12-03 15:55                                             ` Richard Sandiford
2007-11-30 22:48                                     ` Rask Ingemann Lambertsen
     [not found]                                     ` <20071203092630.N17510@dair.pair.com>
     [not found]                                       ` <87d4tn4v94.fsf@firetop.home>
2007-12-03 18:13                                         ` Rask Ingemann Lambertsen
2007-11-30 18:59                                   ` Rask Ingemann Lambertsen
2007-11-28  1:42                       ` Joseph S. Myers
2007-09-18 13:55 ` Rask Ingemann Lambertsen
2007-09-18 14:19   ` Jie Zhang
2007-09-18 16:09     ` Rask Ingemann Lambertsen
2007-09-18 17:45       ` Rask Ingemann Lambertsen
2007-09-19  3:43         ` Jie Zhang
2007-11-28  1:34 Benjamin Kosnik
2007-11-28  2:04 ` Joseph S. Myers
2007-11-28  3:11   ` Benjamin Kosnik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).