public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Skip ld/lto tests if plugins is disabled for binutils?
@ 2014-08-11  6:26 Bin.Cheng
  2014-08-11  7:55 ` Alan Modra
  0 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-11  6:26 UTC (permalink / raw)
  To: binutils

Hi,
I found there are some FAIL ld test cases with message like "sorry -
this program has been built without plugin support", and the program
in this case is ar.  I think it's because I configured/built binutils
without "--enable-plugins", the question is:
should we skip these kind of tests if plugins isn't enabled?

I don't know much about ld/lto tests, so please correct if I was wrong.

Thanks,
bin

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-11  6:26 Skip ld/lto tests if plugins is disabled for binutils? Bin.Cheng
@ 2014-08-11  7:55 ` Alan Modra
  2014-08-11  8:21   ` Bin.Cheng
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Modra @ 2014-08-11  7:55 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: binutils

On Mon, Aug 11, 2014 at 02:26:19PM +0800, Bin.Cheng wrote:
> Hi,
> I found there are some FAIL ld test cases with message like "sorry -
> this program has been built without plugin support", and the program
> in this case is ar.  I think it's because I configured/built binutils
> without "--enable-plugins", the question is:
> should we skip these kind of tests if plugins isn't enabled?

Actually the real question is why are we enabling plugins for ld
but not ar?

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-11  7:55 ` Alan Modra
@ 2014-08-11  8:21   ` Bin.Cheng
  2014-08-11 12:59     ` Alan Modra
  0 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-11  8:21 UTC (permalink / raw)
  To: Bin.Cheng, binutils

On Mon, Aug 11, 2014 at 3:55 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Aug 11, 2014 at 02:26:19PM +0800, Bin.Cheng wrote:
>> Hi,
>> I found there are some FAIL ld test cases with message like "sorry -
>> this program has been built without plugin support", and the program
>> in this case is ar.  I think it's because I configured/built binutils
>> without "--enable-plugins", the question is:
>> should we skip these kind of tests if plugins isn't enabled?
>
> Actually the real question is why are we enabling plugins for ld
> but not ar?

Thanks Alan, is it possible for binutils to have different plugin
enabling for sub-programs?  we use below configuration options, from
which I see nothing special.

.../binutils-gdb/configure
--enable-64-bit-bfd
--enable-targets=arm-none-eabi,aarch64-none-linux-gnu,aarch64-none-elf
--disable-newlib-supplied-syscalls
--enable-newlib-io-long-long
--enable-newlib-mb
--disable-gdb
--without-gdb
--target=aarch64-none-elf
--prefix=...
--with-pkgversion=unknown
--disable-nls
--without-x
--disable-gdbtk
--disable-tui
--without-python
--without-tcl
--without-tk

Thanks,
bin

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-11  8:21   ` Bin.Cheng
@ 2014-08-11 12:59     ` Alan Modra
  2014-08-12  2:52       ` Bin.Cheng
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Modra @ 2014-08-11 12:59 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: binutils

On Mon, Aug 11, 2014 at 04:21:55PM +0800, Bin.Cheng wrote:
> On Mon, Aug 11, 2014 at 3:55 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Mon, Aug 11, 2014 at 02:26:19PM +0800, Bin.Cheng wrote:
> >> Hi,
> >> I found there are some FAIL ld test cases with message like "sorry -
> >> this program has been built without plugin support", and the program
> >> in this case is ar.  I think it's because I configured/built binutils
> >> without "--enable-plugins", the question is:
> >> should we skip these kind of tests if plugins isn't enabled?
> >
> > Actually the real question is why are we enabling plugins for ld
> > but not ar?
> 
> Thanks Alan, is it possible for binutils to have different plugin
> enabling for sub-programs?

In ld/configure.ac we have:

# Check for dlopen support and enable plugins if possible.
enable_plugins=yes
AC_CHECK_HEADER([dlfcn.h],[],[enable_plugins=no],[AC_INCLUDES_DEFAULT])
AC_SEARCH_LIBS([dlopen],[dl],[],[enable_plugins=no],[])
AC_CHECK_FUNCS([dlopen dlsym dlclose],[],[enable_plugins=no])
# We also support plugins on Windows (MinGW).
if test x$enable_plugins = xno ; then
  AC_CHECK_HEADERS([windows.h],[enable_plugins=yes],[],[AC_INCLUDES_DEFAULT])
fi
AM_CONDITIONAL([ENABLE_PLUGINS], [test x$enable_plugins = xyes])

So ld plugin support is always enabled, even when you configure with
--disable-plugins.  That seems wrong to me.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-11 12:59     ` Alan Modra
@ 2014-08-12  2:52       ` Bin.Cheng
  2014-08-12  4:45         ` Alan Modra
  0 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-12  2:52 UTC (permalink / raw)
  To: Bin.Cheng, binutils

On Mon, Aug 11, 2014 at 8:59 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Aug 11, 2014 at 04:21:55PM +0800, Bin.Cheng wrote:
>> On Mon, Aug 11, 2014 at 3:55 PM, Alan Modra <amodra@gmail.com> wrote:
>> > On Mon, Aug 11, 2014 at 02:26:19PM +0800, Bin.Cheng wrote:
>> >> Hi,
>> >> I found there are some FAIL ld test cases with message like "sorry -
>> >> this program has been built without plugin support", and the program
>> >> in this case is ar.  I think it's because I configured/built binutils
>> >> without "--enable-plugins", the question is:
>> >> should we skip these kind of tests if plugins isn't enabled?
>> >
>> > Actually the real question is why are we enabling plugins for ld
>> > but not ar?
>>
>> Thanks Alan, is it possible for binutils to have different plugin
>> enabling for sub-programs?
>
> In ld/configure.ac we have:
>
> # Check for dlopen support and enable plugins if possible.
> enable_plugins=yes
> AC_CHECK_HEADER([dlfcn.h],[],[enable_plugins=no],[AC_INCLUDES_DEFAULT])
> AC_SEARCH_LIBS([dlopen],[dl],[],[enable_plugins=no],[])
> AC_CHECK_FUNCS([dlopen dlsym dlclose],[],[enable_plugins=no])
> # We also support plugins on Windows (MinGW).
> if test x$enable_plugins = xno ; then
>   AC_CHECK_HEADERS([windows.h],[enable_plugins=yes],[],[AC_INCLUDES_DEFAULT])
> fi
> AM_CONDITIONAL([ENABLE_PLUGINS], [test x$enable_plugins = xyes])
>
> So ld plugin support is always enabled, even when you configure with
> --disable-plugins.  That seems wrong to me.

Hi Alan, I searched around and found out that there was bug report on
this before at https://sourceware.org/bugzilla/show_bug.cgi?id=12402

It was resolved as invalid and said this is designed behavior, though
I am not convinced.
With this, the only choice is to enable-plugin for binutils?

Thanks,
bin
>
> --
> Alan Modra
> Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-12  2:52       ` Bin.Cheng
@ 2014-08-12  4:45         ` Alan Modra
  2014-08-12  5:00           ` Bin.Cheng
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Modra @ 2014-08-12  4:45 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: binutils

On Tue, Aug 12, 2014 at 10:51:56AM +0800, Bin.Cheng wrote:
> On Mon, Aug 11, 2014 at 8:59 PM, Alan Modra <amodra@gmail.com> wrote:
> > So ld plugin support is always enabled, even when you configure with
> > --disable-plugins.  That seems wrong to me.
> 
> Hi Alan, I searched around and found out that there was bug report on
> this before at https://sourceware.org/bugzilla/show_bug.cgi?id=12402
> 
> It was resolved as invalid and said this is designed behavior, though

Yeah, Richard Henderson thought it best that way
https://sourceware.org/ml/binutils/2010-10/msg00074.html

> I am not convinced.
> With this, the only choice is to enable-plugin for binutils?

Yes.

Nowadays, with gcc defaulting to -fno-fat-lto-objects you really don't
have a fully functional lto toolchain unless the ar/nm/ranlib plugin
is enabled.

I think we should make --enable-plugins default to yes, and make
ld/configure.ac respect --enable-plugins=no.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-12  4:45         ` Alan Modra
@ 2014-08-12  5:00           ` Bin.Cheng
  2014-08-12 13:14             ` Alan Modra
  0 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-12  5:00 UTC (permalink / raw)
  To: Bin.Cheng, binutils

On Tue, Aug 12, 2014 at 12:45 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Aug 12, 2014 at 10:51:56AM +0800, Bin.Cheng wrote:
>> On Mon, Aug 11, 2014 at 8:59 PM, Alan Modra <amodra@gmail.com> wrote:
>> > So ld plugin support is always enabled, even when you configure with
>> > --disable-plugins.  That seems wrong to me.
>>
>> Hi Alan, I searched around and found out that there was bug report on
>> this before at https://sourceware.org/bugzilla/show_bug.cgi?id=12402
>>
>> It was resolved as invalid and said this is designed behavior, though
>
> Yeah, Richard Henderson thought it best that way
> https://sourceware.org/ml/binutils/2010-10/msg00074.html
>
>> I am not convinced.
>> With this, the only choice is to enable-plugin for binutils?
>
> Yes.
>
> Nowadays, with gcc defaulting to -fno-fat-lto-objects you really don't
> have a fully functional lto toolchain unless the ar/nm/ranlib plugin
> is enabled.
>
> I think we should make --enable-plugins default to yes, and make
> ld/configure.ac respect --enable-plugins=no.
Yes, this should fix the inconsistency issue.  I will try to work out a patch.

Thanks,
bin
>
> --
> Alan Modra
> Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-12  5:00           ` Bin.Cheng
@ 2014-08-12 13:14             ` Alan Modra
  2014-08-13  5:58               ` Bin.Cheng
                                 ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Alan Modra @ 2014-08-12 13:14 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: binutils

On Tue, Aug 12, 2014 at 01:00:17PM +0800, Bin.Cheng wrote:
> On Tue, Aug 12, 2014 at 12:45 PM, Alan Modra <amodra@gmail.com> wrote:
> > I think we should make --enable-plugins default to yes, and make
> > ld/configure.ac respect --enable-plugins=no.
> Yes, this should fix the inconsistency issue.  I will try to work out a patch.

This is what I have here, so far.  I'm going to leave committing this
for a little while to let others comment.

    configury changes to make ld plugin support controlled by --enable-plugins
    
    This also makes --enable-plugins default to on for hosts that can
    support plugins, so we have consistent lto toolchain support.  The
    ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
    will be necessary if plugin support is extended to more hosts via
    libtool's dlopen support.  I started down that path then decided it
    was more work than I was interested in doing.  (ACX_LARGEFILE invokes
    AC_PLUGINS.)
    
    	* config/plugins.m4: Test for dlfcn.h or windows.h here to set
    	default for --enable-plugins.  Report error if someone tries to
    	enable plugins on a host we don't support.
    bfd/
    	* configure.ac: Delete redundant plugin related checks.
    	* configure: Regenerate.
    binutils/
    	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
    	* config.in: Regenerate.
    	* configure: Regenerate.
    gas/
    	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
    	* config.in: Regenerate.
    	* configure: Regenerate.
    gprof/
    	* configure.ac: Move ACX_LARGEFILE after LT_INIT.
    	* configure: Regenerate.
    	* gconfig.in: Regenerate.
    ld/
    	* configure.ac: Move AC_PROG_CC and other macros earlier.  Delete
    	plugin checks now done in config/plugins.m4.
    	* config.in: Regenerate.
    	* configure: Regenerate.

diff --git a/config/plugins.m4 b/config/plugins.m4
index 7ee8412..f65fdcb 100644
--- a/config/plugins.m4
+++ b/config/plugins.m4
@@ -1,11 +1,18 @@
 AC_DEFUN([AC_PLUGINS],
 [
-AC_ARG_ENABLE([plugins],
-AS_HELP_STRING([--enable-plugins], [Enable support for plugins (defaults no)]),
-[case "${enableval}" in
-  yes | "") plugins=yes ;;
-  no) plugins=no ;;
-  *) plugins=yes ;;
- esac],
-[plugins=no])
+  maybe_plugins=no
+  AC_CHECK_HEADERS([dlfcn.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
+  AC_CHECK_HEADERS([windows.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
+
+  AC_ARG_ENABLE([plugins],
+    AS_HELP_STRING([--enable-plugins], [Enable support for plugins]),
+    [case "${enableval}" in
+      no) plugins=no ;;
+      *) plugins=yes
+         if test "$maybe_plugins" != "yes" ; then
+	   AC_MSG_ERROR([Building with plugin support requires a host that supports dlopen.])
+	 fi ;;
+     esac],
+    [plugins=$maybe_plugins]
+  )
 ])
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 017304f..ba98e39 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -48,10 +48,6 @@ ACX_LARGEFILE
 AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
 
 if test "$plugins" = "yes"; then
-  if test "$enable_dlopen" != "yes" ; then
-    AC_MSG_ERROR([
-      Building BFD with plugin support requires a host that supports -ldl.])
-  fi
   enable_targets="$enable_targets plugin"
 fi
 
@@ -217,8 +213,6 @@ GCC_HEADER_STDINT(bfd_stdint.h)
 AC_HEADER_TIME
 AC_HEADER_DIRENT
 
-AC_CHECK_HEADERS(windows.h dlfcn.h)
-
 ACX_HEADER_STRING
 AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
 AC_CHECK_FUNCS(strtoull getrlimit)
diff --git a/binutils/configure.ac b/binutils/configure.ac
index ff0d4dc..c5da20d 100644
--- a/binutils/configure.ac
+++ b/binutils/configure.ac
@@ -31,8 +31,8 @@ AC_PROG_CC
 AC_GNU_SOURCE
 AC_USE_SYSTEM_EXTENSIONS
 
-ACX_LARGEFILE
 LT_INIT
+ACX_LARGEFILE
 
 AC_ARG_ENABLE(targets,
 [  --enable-targets        alternative target configurations],
diff --git a/gas/configure.ac b/gas/configure.ac
index cc4fc54..e2fc1b7 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -37,9 +37,9 @@ AM_INIT_AUTOMAKE
 AC_PROG_CC
 AC_GNU_SOURCE
 AC_USE_SYSTEM_EXTENSIONS
-ACX_LARGEFILE
 
 LT_INIT
+ACX_LARGEFILE
 
 AC_ARG_ENABLE(targets,
 [  --enable-targets        alternative target configurations besides the primary],
diff --git a/gprof/configure.ac b/gprof/configure.ac
index 583ad24..e2d3718 100644
--- a/gprof/configure.ac
+++ b/gprof/configure.ac
@@ -35,10 +35,10 @@ AC_CONFIG_HEADERS([gconfig.h:gconfig.in])
 AC_PROG_CC
 AC_GNU_SOURCE
 AC_USE_SYSTEM_EXTENSIONS
-ACX_LARGEFILE
 AC_PROG_INSTALL
 
 LT_INIT
+ACX_LARGEFILE
 
 AC_CHECK_FUNCS(setmode)
 
diff --git a/ld/configure.ac b/ld/configure.ac
index c81ccfe..1bddfc9 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -29,6 +29,15 @@ AC_ISC_POSIX
 AM_INIT_AUTOMAKE
 AM_MAINTAINER_MODE
 
+AC_PROG_CC
+AC_PROG_CXX
+AC_GNU_SOURCE
+AC_USE_SYSTEM_EXTENSIONS
+AC_PROG_INSTALL
+
+LT_INIT
+ACX_LARGEFILE
+
 AC_ARG_WITH(lib-path, [  --with-lib-path=dir1:dir2...  set default LIB_PATH],LIB_PATH=$withval)
 AC_ARG_ENABLE(targets,
 [  --enable-targets        alternative target configurations],
@@ -157,15 +166,6 @@ fi
 
 # host-specific stuff:
 
-AC_PROG_CC
-AC_PROG_CXX
-AC_GNU_SOURCE
-AC_USE_SYSTEM_EXTENSIONS
-ACX_LARGEFILE
-AC_PROG_INSTALL
-
-LT_INIT
-
 ALL_LINGUAS="fr sv tr es da vi zh_CN zh_TW ga fi id bg it uk"
 ZW_GNU_GETTEXT_SISTER_DIR
 AM_PO_SUBDIRS
@@ -195,16 +195,8 @@ AC_CHECK_FUNCS(glob mkstemp realpath sbrk setlocale waitpid)
 AC_CHECK_FUNCS(open lseek close)
 AC_HEADER_DIRENT
 
-# Check for dlopen support and enable plugins if possible.
-enable_plugins=yes
-AC_CHECK_HEADER([dlfcn.h],[],[enable_plugins=no],[AC_INCLUDES_DEFAULT])
-AC_SEARCH_LIBS([dlopen],[dl],[],[enable_plugins=no],[])
-AC_CHECK_FUNCS([dlopen dlsym dlclose],[],[enable_plugins=no])
-# We also support plugins on Windows (MinGW).
-if test x$enable_plugins = xno ; then
-  AC_CHECK_HEADERS([windows.h],[enable_plugins=yes],[],[AC_INCLUDES_DEFAULT])
-fi
-AM_CONDITIONAL([ENABLE_PLUGINS], [test x$enable_plugins = xyes])
+AC_SEARCH_LIBS([dlopen], [dl])
+AM_CONDITIONAL([ENABLE_PLUGINS], [test x$plugins = xyes])
 
 AC_ARG_ENABLE(initfini-array,
 	[  --enable-initfini-array	use .init_array/.fini_array sections],


-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-12 13:14             ` Alan Modra
@ 2014-08-13  5:58               ` Bin.Cheng
  2014-08-14  4:25                 ` Alan Modra
  2014-08-14 14:48               ` Hans-Peter Nilsson
  2014-08-19  2:52               ` [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?) Yao Qi
  2 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-13  5:58 UTC (permalink / raw)
  To: Bin.Cheng, binutils

On Tue, Aug 12, 2014 at 9:14 PM, Alan Modra <amodra@gmail.com> wrote:
> On Tue, Aug 12, 2014 at 01:00:17PM +0800, Bin.Cheng wrote:
>> On Tue, Aug 12, 2014 at 12:45 PM, Alan Modra <amodra@gmail.com> wrote:
>> > I think we should make --enable-plugins default to yes, and make
>> > ld/configure.ac respect --enable-plugins=no.
>> Yes, this should fix the inconsistency issue.  I will try to work out a patch.
>
> This is what I have here, so far.  I'm going to leave committing this
> for a little while to let others comment.
>
>     configury changes to make ld plugin support controlled by --enable-plugins
>
>     This also makes --enable-plugins default to on for hosts that can
>     support plugins, so we have consistent lto toolchain support.  The
>     ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
>     will be necessary if plugin support is extended to more hosts via
>     libtool's dlopen support.  I started down that path then decided it
>     was more work than I was interested in doing.  (ACX_LARGEFILE invokes
>     AC_PLUGINS.)
>
>         * config/plugins.m4: Test for dlfcn.h or windows.h here to set
>         default for --enable-plugins.  Report error if someone tries to
>         enable plugins on a host we don't support.
>     bfd/
>         * configure.ac: Delete redundant plugin related checks.
>         * configure: Regenerate.
>     binutils/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>     gas/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>     gprof/
>         * configure.ac: Move ACX_LARGEFILE after LT_INIT.
>         * configure: Regenerate.
>         * gconfig.in: Regenerate.
>     ld/
>         * configure.ac: Move AC_PROG_CC and other macros earlier.  Delete
>         plugin checks now done in config/plugins.m4.
>         * config.in: Regenerate.
>         * configure: Regenerate.
>
> diff --git a/config/plugins.m4 b/config/plugins.m4
> index 7ee8412..f65fdcb 100644
> --- a/config/plugins.m4
> +++ b/config/plugins.m4
> @@ -1,11 +1,18 @@
>  AC_DEFUN([AC_PLUGINS],
>  [
> -AC_ARG_ENABLE([plugins],
> -AS_HELP_STRING([--enable-plugins], [Enable support for plugins (defaults no)]),
> -[case "${enableval}" in
> -  yes | "") plugins=yes ;;
> -  no) plugins=no ;;
> -  *) plugins=yes ;;
> - esac],
> -[plugins=no])
> +  maybe_plugins=no
> +  AC_CHECK_HEADERS([dlfcn.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
> +  AC_CHECK_HEADERS([windows.h], [maybe_plugins=yes], [], [AC_INCLUDES_DEFAULT])
> +
> +  AC_ARG_ENABLE([plugins],
> +    AS_HELP_STRING([--enable-plugins], [Enable support for plugins]),
> +    [case "${enableval}" in
> +      no) plugins=no ;;
> +      *) plugins=yes
> +         if test "$maybe_plugins" != "yes" ; then
> +          AC_MSG_ERROR([Building with plugin support requires a host that supports dlopen.])
> +        fi ;;
> +     esac],
> +    [plugins=$maybe_plugins]
> +  )
>  ])
> diff --git a/bfd/configure.ac b/bfd/configure.ac
> index 017304f..ba98e39 100644
> --- a/bfd/configure.ac
> +++ b/bfd/configure.ac
> @@ -48,10 +48,6 @@ ACX_LARGEFILE
>  AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
>
>  if test "$plugins" = "yes"; then
> -  if test "$enable_dlopen" != "yes" ; then
> -    AC_MSG_ERROR([
> -      Building BFD with plugin support requires a host that supports -ldl.])
> -  fi
>    enable_targets="$enable_targets plugin"
>  fi
>
> @@ -217,8 +213,6 @@ GCC_HEADER_STDINT(bfd_stdint.h)
>  AC_HEADER_TIME
>  AC_HEADER_DIRENT
>
> -AC_CHECK_HEADERS(windows.h dlfcn.h)
> -
>  ACX_HEADER_STRING
>  AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
>  AC_CHECK_FUNCS(strtoull getrlimit)
> diff --git a/binutils/configure.ac b/binutils/configure.ac
> index ff0d4dc..c5da20d 100644
> --- a/binutils/configure.ac
> +++ b/binutils/configure.ac
> @@ -31,8 +31,8 @@ AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
>
> -ACX_LARGEFILE
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations],
> diff --git a/gas/configure.ac b/gas/configure.ac
> index cc4fc54..e2fc1b7 100644
> --- a/gas/configure.ac
> +++ b/gas/configure.ac
> @@ -37,9 +37,9 @@ AM_INIT_AUTOMAKE
>  AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
>
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations besides the primary],
> diff --git a/gprof/configure.ac b/gprof/configure.ac
> index 583ad24..e2d3718 100644
> --- a/gprof/configure.ac
> +++ b/gprof/configure.ac
> @@ -35,10 +35,10 @@ AC_CONFIG_HEADERS([gconfig.h:gconfig.in])
>  AC_PROG_CC
>  AC_GNU_SOURCE
>  AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
>  AC_PROG_INSTALL
>
>  LT_INIT
> +ACX_LARGEFILE
>
>  AC_CHECK_FUNCS(setmode)
>
> diff --git a/ld/configure.ac b/ld/configure.ac
> index c81ccfe..1bddfc9 100644
> --- a/ld/configure.ac
> +++ b/ld/configure.ac
> @@ -29,6 +29,15 @@ AC_ISC_POSIX
>  AM_INIT_AUTOMAKE
>  AM_MAINTAINER_MODE
>
> +AC_PROG_CC
> +AC_PROG_CXX
> +AC_GNU_SOURCE
> +AC_USE_SYSTEM_EXTENSIONS
> +AC_PROG_INSTALL
> +
> +LT_INIT
> +ACX_LARGEFILE
> +
>  AC_ARG_WITH(lib-path, [  --with-lib-path=dir1:dir2...  set default LIB_PATH],LIB_PATH=$withval)
>  AC_ARG_ENABLE(targets,
>  [  --enable-targets        alternative target configurations],
> @@ -157,15 +166,6 @@ fi
>
>  # host-specific stuff:
>
> -AC_PROG_CC
> -AC_PROG_CXX
> -AC_GNU_SOURCE
> -AC_USE_SYSTEM_EXTENSIONS
> -ACX_LARGEFILE
> -AC_PROG_INSTALL
> -
> -LT_INIT
> -
>  ALL_LINGUAS="fr sv tr es da vi zh_CN zh_TW ga fi id bg it uk"
>  ZW_GNU_GETTEXT_SISTER_DIR
>  AM_PO_SUBDIRS
> @@ -195,16 +195,8 @@ AC_CHECK_FUNCS(glob mkstemp realpath sbrk setlocale waitpid)
>  AC_CHECK_FUNCS(open lseek close)
>  AC_HEADER_DIRENT
>
> -# Check for dlopen support and enable plugins if possible.
> -enable_plugins=yes
> -AC_CHECK_HEADER([dlfcn.h],[],[enable_plugins=no],[AC_INCLUDES_DEFAULT])
> -AC_SEARCH_LIBS([dlopen],[dl],[],[enable_plugins=no],[])
> -AC_CHECK_FUNCS([dlopen dlsym dlclose],[],[enable_plugins=no])
> -# We also support plugins on Windows (MinGW).
> -if test x$enable_plugins = xno ; then
> -  AC_CHECK_HEADERS([windows.h],[enable_plugins=yes],[],[AC_INCLUDES_DEFAULT])
> -fi
> -AM_CONDITIONAL([ENABLE_PLUGINS], [test x$enable_plugins = xyes])
> +AC_SEARCH_LIBS([dlopen], [dl])
> +AM_CONDITIONAL([ENABLE_PLUGINS], [test x$plugins = xyes])
>
>  AC_ARG_ENABLE(initfini-array,
>         [  --enable-initfini-array      use .init_array/.fini_array sections],
>

Thanks very much.  This is much more complete than my experimental patch.

Thanks,
bin
>
> --
> Alan Modra
> Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-13  5:58               ` Bin.Cheng
@ 2014-08-14  4:25                 ` Alan Modra
  0 siblings, 0 replies; 23+ messages in thread
From: Alan Modra @ 2014-08-14  4:25 UTC (permalink / raw)
  To: Bin.Cheng; +Cc: binutils

On Wed, Aug 13, 2014 at 01:58:32PM +0800, Bin.Cheng wrote:
> On Tue, Aug 12, 2014 at 9:14 PM, Alan Modra <amodra@gmail.com> wrote:
> > On Tue, Aug 12, 2014 at 01:00:17PM +0800, Bin.Cheng wrote:
> >> On Tue, Aug 12, 2014 at 12:45 PM, Alan Modra <amodra@gmail.com> wrote:
> >> > I think we should make --enable-plugins default to yes, and make
> >> > ld/configure.ac respect --enable-plugins=no.
> >> Yes, this should fix the inconsistency issue.  I will try to work out a patch.
> >
> > This is what I have here, so far.  I'm going to leave committing this
> > for a little while to let others comment.
> >
> >     configury changes to make ld plugin support controlled by --enable-plugins

Now committed.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-12 13:14             ` Alan Modra
  2014-08-13  5:58               ` Bin.Cheng
@ 2014-08-14 14:48               ` Hans-Peter Nilsson
  2014-08-15  3:29                 ` Alan Modra
  2014-08-19  2:52               ` [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?) Yao Qi
  2 siblings, 1 reply; 23+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-14 14:48 UTC (permalink / raw)
  To: amodra; +Cc: binutils

> From: Alan Modra <amodra@gmail.com>
> Date: Tue, 12 Aug 2014 15:14:43 +0200

> This is what I have here, so far.  I'm going to leave committing this
> for a little while to let others comment.
> 
>     configury changes to make ld plugin support controlled by --enable-plugins
>     
>     This also makes --enable-plugins default to on for hosts that can
>     support plugins, so we have consistent lto toolchain support.  The
>     ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
>     will be necessary if plugin support is extended to more hosts via
>     libtool's dlopen support.  I started down that path then decided it
>     was more work than I was interested in doing.  (ACX_LARGEFILE invokes
>     AC_PLUGINS.)
>     
>     	* config/plugins.m4: Test for dlfcn.h or windows.h here to set
>     	default for --enable-plugins.  Report error if someone tries to
>     	enable plugins on a host we don't support.
>     bfd/
>     	* configure.ac: Delete redundant plugin related checks.
>     	* configure: Regenerate.

Needed for (gdb and) sim too?  It seems to have broken all
simulators, or at least those for arm-eabi, cris-elf, d10v-elf,
frv-elf, h8300-elf, iq2000-elf, m32c-elf, m32r-elf, m68hc11-elf,
mcore-elf, mips-elf, mn10300-elf, powerpc-eabisim, sh-elf,
v850-elf like so:

gcc -DHAVE_CONFIG_H     -DPROFILE=1 -DWITH_PROFILE=-1          -DDEFAULT_INLINE=0           -DMODET -DNEED_UI_LOOP_HOOK -DSIM_TARGET_SWITCHES   -I. -I/tmp/hpautotest-sim/src/sim/arm -I../common -I/tmp/hpautotest-sim/src/sim/arm/../common -I../../include -I/tmp/hpautotest-sim/src/sim/arm/../../include -I../../bfd -I/tmp/hpautotest-sim/src/sim/arm/../../bfd -I../../opcodes -I/tmp/hpautotest-sim/src/sim/arm/../../opcodes  -g -O2 -static-libstdc++ -static-libgcc  -o run \
	  run.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a  ../../libiberty/libiberty.a -lz -lnsl   
../../bfd/libbfd.a(plugin.o): In function `try_load_plugin':
/tmp/hpautotest-sim/src/bfd/plugin.c:168: undefined reference to `dlopen'
/tmp/hpautotest-sim/src/bfd/plugin.c:175: undefined reference to `dlsym'
/tmp/hpautotest-sim/src/bfd/plugin.c:171: undefined reference to `dlerror'
collect2: error: ld returned 1 exit status
make[3]: Leaving directory `/tmp/hpautotest-sim/arm-eabi/sim/arm'

brgds, H-P

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-14 14:48               ` Hans-Peter Nilsson
@ 2014-08-15  3:29                 ` Alan Modra
  2014-08-15  5:29                   ` Bin.Cheng
  2014-08-15 15:17                   ` Hans-Peter Nilsson
  0 siblings, 2 replies; 23+ messages in thread
From: Alan Modra @ 2014-08-15  3:29 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

On Thu, Aug 14, 2014 at 04:48:16PM +0200, Hans-Peter Nilsson wrote:
> Needed for (gdb and) sim too?  It seems to have broken all
> simulators, or at least those for arm-eabi, cris-elf, d10v-elf,
> frv-elf, h8300-elf, iq2000-elf, m32c-elf, m32r-elf, m68hc11-elf,
> mcore-elf, mips-elf, mn10300-elf, powerpc-eabisim, sh-elf,
> v850-elf like so:

I did build gdb and sim to test the patch, but just x86_64-linux.

The difference is that --enable-plugins is now the default.  I think
all the sim targets you list would have failed previously if you'd
configured with --enable-plugins.  For now, please configure them with
--disable-plugins.

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-15  3:29                 ` Alan Modra
@ 2014-08-15  5:29                   ` Bin.Cheng
  2014-08-15  9:45                     ` Bin.Cheng
  2014-08-15 15:17                   ` Hans-Peter Nilsson
  1 sibling, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-15  5:29 UTC (permalink / raw)
  To: Hans-Peter Nilsson, binutils

On Fri, Aug 15, 2014 at 11:29 AM, Alan Modra <amodra@gmail.com> wrote:
> On Thu, Aug 14, 2014 at 04:48:16PM +0200, Hans-Peter Nilsson wrote:
>> Needed for (gdb and) sim too?  It seems to have broken all
>> simulators, or at least those for arm-eabi, cris-elf, d10v-elf,
>> frv-elf, h8300-elf, iq2000-elf, m32c-elf, m32r-elf, m68hc11-elf,
>> mcore-elf, mips-elf, mn10300-elf, powerpc-eabisim, sh-elf,
>> v850-elf like so:
>
> I did build gdb and sim to test the patch, but just x86_64-linux.
>
> The difference is that --enable-plugins is now the default.  I think
> all the sim targets you list would have failed previously if you'd
> configured with --enable-plugins.  For now, please configure them with
> --disable-plugins.
Hi,
I also saw this on arm-none-linux-gnueabi and arm-none-eabi with below
error messages:

/../opcodes  -g -O2  -o run \
 run.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a
../../libiberty/libiberty.a -lz -lnsl
../../bfd/libbfd.a(plugin.o): In function `try_load_plugin':
....../src/binutils-gdb/bfd/plugin.c:168: undefined reference to `dlopen'
....../src/binutils-gdb/bfd/plugin.c:175: undefined reference to `dlsym'
....../src/binutils-gdb/bfd/plugin.c:171: undefined reference to `dlerror'
Could we add some check for dlopen/dlsym/dlerror in sim configure
script to disable it by default?

Thanks,
bin
>
> --
> Alan Modra
> Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-15  5:29                   ` Bin.Cheng
@ 2014-08-15  9:45                     ` Bin.Cheng
  0 siblings, 0 replies; 23+ messages in thread
From: Bin.Cheng @ 2014-08-15  9:45 UTC (permalink / raw)
  To: Hans-Peter Nilsson, binutils

On Fri, Aug 15, 2014 at 1:29 PM, Bin.Cheng <amker.cheng@gmail.com> wrote:
> On Fri, Aug 15, 2014 at 11:29 AM, Alan Modra <amodra@gmail.com> wrote:
>> On Thu, Aug 14, 2014 at 04:48:16PM +0200, Hans-Peter Nilsson wrote:
>>> Needed for (gdb and) sim too?  It seems to have broken all
>>> simulators, or at least those for arm-eabi, cris-elf, d10v-elf,
>>> frv-elf, h8300-elf, iq2000-elf, m32c-elf, m32r-elf, m68hc11-elf,
>>> mcore-elf, mips-elf, mn10300-elf, powerpc-eabisim, sh-elf,
>>> v850-elf like so:
>>
>> I did build gdb and sim to test the patch, but just x86_64-linux.
>>
>> The difference is that --enable-plugins is now the default.  I think
>> all the sim targets you list would have failed previously if you'd
>> configured with --enable-plugins.  For now, please configure them with
>> --disable-plugins.
> Hi,
> I also saw this on arm-none-linux-gnueabi and arm-none-eabi with below
> error messages:
>
> /../opcodes  -g -O2  -o run \
>  run.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a
> ../../libiberty/libiberty.a -lz -lnsl
> ../../bfd/libbfd.a(plugin.o): In function `try_load_plugin':
> ....../src/binutils-gdb/bfd/plugin.c:168: undefined reference to `dlopen'
> ....../src/binutils-gdb/bfd/plugin.c:175: undefined reference to `dlsym'
> ....../src/binutils-gdb/bfd/plugin.c:171: undefined reference to `dlerror'
> Could we add some check for dlopen/dlsym/dlerror in sim configure
> script to disable it by default?

Also If we build binutils/gdb in a combined tree, it's impossible to
configure gdb differently?  If it's impossible, the "enable-plugins"
can't work for combined build now.  So we have to fix this?

Thanks,
bin
>
> Thanks,
> bin
>>
>> --
>> Alan Modra
>> Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-15  3:29                 ` Alan Modra
  2014-08-15  5:29                   ` Bin.Cheng
@ 2014-08-15 15:17                   ` Hans-Peter Nilsson
  2014-08-15 15:41                     ` Hans-Peter Nilsson
  1 sibling, 1 reply; 23+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-15 15:17 UTC (permalink / raw)
  To: amodra; +Cc: binutils

> From: Alan Modra <amodra@gmail.com>
> Date: Fri, 15 Aug 2014 05:29:24 +0200

> On Thu, Aug 14, 2014 at 04:48:16PM +0200, Hans-Peter Nilsson wrote:
> > Needed for (gdb and) sim too?  It seems to have broken all
> > simulators, or at least those for arm-eabi, cris-elf, d10v-elf,
> > frv-elf, h8300-elf, iq2000-elf, m32c-elf, m32r-elf, m68hc11-elf,
> > mcore-elf, mips-elf, mn10300-elf, powerpc-eabisim, sh-elf,
> > v850-elf like so:
> 
> I did build gdb and sim to test the patch, but just x86_64-linux.

Meh, configuring for x86_64-linux doesn't cause anything in sim
to build...

> The difference is that --enable-plugins is now the default.  I think
> all the sim targets you list

(And all others, presumably.)

> would have failed previously if you'd
> configured with --enable-plugins.  For now, please configure them with
> --disable-plugins.

Nah, I'd rather fix up the broken pieces of "plugin support"
(just there to pacify bfd's need) that actually *are* in sim
already and look like they *should* pull in -ldl.  See
sim/common/{configure.ac,Make-common.in}; I'm looking into it.

brgds, H-P

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-15 15:17                   ` Hans-Peter Nilsson
@ 2014-08-15 15:41                     ` Hans-Peter Nilsson
  2014-08-19  2:28                       ` Bin.Cheng
  0 siblings, 1 reply; 23+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-15 15:41 UTC (permalink / raw)
  To: amodra; +Cc: binutils

> From: Hans-Peter Nilsson <hp@axis.com>
> Date: Fri, 15 Aug 2014 17:17:13 +0200

> I'd rather fix up the broken pieces of "plugin support"
> (just there to pacify bfd's need) that actually *are* in sim
> already and look like they *should* pull in -ldl.  See
> sim/common/{configure.ac,Make-common.in}; I'm looking into it.

Looks like all that's actually needed is to regenerate
sim/*/configure, for example by means of "make autoconf-common"
in sim. Will do later; no keys here.

brgds, H-P

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-15 15:41                     ` Hans-Peter Nilsson
@ 2014-08-19  2:28                       ` Bin.Cheng
  2014-08-19  3:43                         ` Hans-Peter Nilsson
  0 siblings, 1 reply; 23+ messages in thread
From: Bin.Cheng @ 2014-08-19  2:28 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: amodra, binutils

On Fri, Aug 15, 2014 at 11:41 PM, Hans-Peter Nilsson
<hans-peter.nilsson@axis.com> wrote:
>> From: Hans-Peter Nilsson <hp@axis.com>
>> Date: Fri, 15 Aug 2014 17:17:13 +0200
>
>> I'd rather fix up the broken pieces of "plugin support"
>> (just there to pacify bfd's need) that actually *are* in sim
>> already and look like they *should* pull in -ldl.  See
>> sim/common/{configure.ac,Make-common.in}; I'm looking into it.
>
> Looks like all that's actually needed is to regenerate
> sim/*/configure, for example by means of "make autoconf-common"
> in sim. Will do later; no keys here.

Hi Hans-Peter,
Any updates about this?  In the meantime, what else can I do except
disable plugins/lto through out all toolchain components?  Since we
use combined source tree and can't configure binutils and gdb
differently.  Thanks very much.

Thanks,
bin

>
> brgds, H-P

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

* [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?)
  2014-08-12 13:14             ` Alan Modra
  2014-08-13  5:58               ` Bin.Cheng
  2014-08-14 14:48               ` Hans-Peter Nilsson
@ 2014-08-19  2:52               ` Yao Qi
  2014-08-19  3:36                 ` Yao Qi
  2 siblings, 1 reply; 23+ messages in thread
From: Yao Qi @ 2014-08-19  2:52 UTC (permalink / raw)
  To: gdb-patches; +Cc: binutils

On 08/12/2014 09:14 PM, Alan Modra wrote:
>     configury changes to make ld plugin support controlled by --enable-plugins
>     
>     This also makes --enable-plugins default to on for hosts that can
>     support plugins, so we have consistent lto toolchain support.  The
>     ACX_LARGEFILE moves aren't strictly necessary, but are harmless and
>     will be necessary if plugin support is extended to more hosts via
>     libtool's dlopen support.  I started down that path then decided it
>     was more work than I was interested in doing.  (ACX_LARGEFILE invokes
>     AC_PLUGINS.)

The config/plugins.m4 was updated recently by commit
b879806f2fdd2eca7092d7b854d6cbbbbbd0493b.  Various sourceware components
configure files were updated except GDB's.  I run aclocal and autoconf
to update gdb/configure.

I'll push it in in one day or two, if no comments.

-- 
Yao (齐尧)

gdb:

2014-08-19  Yao Qi  <yao@codesourcery.com>

	* configure: Regenerate.
---
 gdb/configure | 45 ++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/gdb/configure b/gdb/configure
index 874922d..0b992ed 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -1482,7 +1482,7 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-maintainer-mode  enable make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer
-  --enable-plugins        Enable support for plugins (defaults no)
+  --enable-plugins        Enable support for plugins
   --disable-largefile     omit support for large files
   --enable-targets=TARGETS
                           alternative target configurations
@@ -4090,15 +4090,46 @@ test -n "$target_alias" &&
 # even in directories otherwise not depending on the $plugins option.
 
 
-# Check whether --enable-plugins was given.
+  maybe_plugins=no
+  for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+  for ac_header in windows.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_windows_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINDOWS_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+
+  # Check whether --enable-plugins was given.
 if test "${enable_plugins+set}" = set; then :
   enableval=$enable_plugins; case "${enableval}" in
-  yes | "") plugins=yes ;;
-  no) plugins=no ;;
-  *) plugins=yes ;;
- esac
+      no) plugins=no ;;
+      *) plugins=yes
+         if test "$maybe_plugins" != "yes" ; then
+	   as_fn_error "Building with plugin support requires a host that supports dlopen." "$LINENO" 5
+	 fi ;;
+     esac
 else
-  plugins=no
+  plugins=$maybe_plugins
+
 fi
 
 
-- 
1.9.3

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

* Re: [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?)
  2014-08-19  2:52               ` [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?) Yao Qi
@ 2014-08-19  3:36                 ` Yao Qi
  2014-08-19  6:33                   ` Joel Brobecker
  0 siblings, 1 reply; 23+ messages in thread
From: Yao Qi @ 2014-08-19  3:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: binutils

On 08/19/2014 10:48 AM, Yao Qi wrote:
> configure files were updated except GDB's.  I run aclocal and autoconf
> to update gdb/configure.

> 2014-08-19  Yao Qi  <yao@codesourcery.com>
> 
> 	* configure: Regenerate.

Ur, I should run autoreconf instead, and get gdb/config.in updated too.
Here is the updated patch.

-- 
Yao (齐尧)

gdb:

2014-08-19  Yao Qi  <yao@codesourcery.com>

	* configure: Regenerate.
	* config.in: Regenerate.
---
 gdb/config.in |  3 +++
 gdb/configure | 45 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/gdb/config.in b/gdb/config.in
index fb9b0cd..b853412 100644
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -531,6 +531,9 @@
 /* Define to 1 if you have the `wborder' function. */
 #undef HAVE_WBORDER
 
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
 /* Define to 1 if `fork' works. */
 #undef HAVE_WORKING_FORK
 
diff --git a/gdb/configure b/gdb/configure
index 874922d..0b992ed 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -1482,7 +1482,7 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-maintainer-mode  enable make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer
-  --enable-plugins        Enable support for plugins (defaults no)
+  --enable-plugins        Enable support for plugins
   --disable-largefile     omit support for large files
   --enable-targets=TARGETS
                           alternative target configurations
@@ -4090,15 +4090,46 @@ test -n "$target_alias" &&
 # even in directories otherwise not depending on the $plugins option.
 
 
-# Check whether --enable-plugins was given.
+  maybe_plugins=no
+  for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+  for ac_header in windows.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "windows.h" "ac_cv_header_windows_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_windows_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINDOWS_H 1
+_ACEOF
+ maybe_plugins=yes
+fi
+
+done
+
+
+  # Check whether --enable-plugins was given.
 if test "${enable_plugins+set}" = set; then :
   enableval=$enable_plugins; case "${enableval}" in
-  yes | "") plugins=yes ;;
-  no) plugins=no ;;
-  *) plugins=yes ;;
- esac
+      no) plugins=no ;;
+      *) plugins=yes
+         if test "$maybe_plugins" != "yes" ; then
+	   as_fn_error "Building with plugin support requires a host that supports dlopen." "$LINENO" 5
+	 fi ;;
+     esac
 else
-  plugins=no
+  plugins=$maybe_plugins
+
 fi
 
 
-- 
1.9.3

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-19  2:28                       ` Bin.Cheng
@ 2014-08-19  3:43                         ` Hans-Peter Nilsson
  2014-08-19 12:29                           ` Alan Modra
  0 siblings, 1 reply; 23+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-19  3:43 UTC (permalink / raw)
  To: amker.cheng; +Cc: amodra, binutils

> From: Bin.Cheng <amker.cheng@gmail.com>
> Date: Tue, 19 Aug 2014 04:28:32 +0200

> On Fri, Aug 15, 2014 at 11:41 PM, Hans-Peter Nilsson
> <hans-peter.nilsson@axis.com> wrote:
> >> From: Hans-Peter Nilsson <hp@axis.com>
> >> Date: Fri, 15 Aug 2014 17:17:13 +0200
> >
> >> I'd rather fix up the broken pieces of "plugin support"
> >> (just there to pacify bfd's need) that actually *are* in sim
> >> already and look like they *should* pull in -ldl.  See
> >> sim/common/{configure.ac,Make-common.in}; I'm looking into it.
> >
> > Looks like all that's actually needed is to regenerate
> > sim/*/configure, for example by means of "make autoconf-common"
> > in sim. Will do later; no keys here.
> 
> Hi Hans-Peter,
> Any updates about this?  In the meantime, what else can I do except
> disable plugins/lto through out all toolchain components?  Since we
> use combined source tree and can't configure binutils and gdb
> differently.  Thanks very much.

Roland McGrath committed a re-build of sim/*/config{.in,ure}
later that day.  I'm guessing you haven't tried since then?
arm-eabi is fine in my autotester builds (using only --target
and --prefix options).

There are a couple of simulators suffering from fallout from the
regenerated config.in due to older configury bugs
(e.g. iq2000-elf, frv-elf, m32r-elf and powerpc-eabisim needs
special treatment), but you didn't mention any others.

brgds, H-P

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

* Re: [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?)
  2014-08-19  3:36                 ` Yao Qi
@ 2014-08-19  6:33                   ` Joel Brobecker
  0 siblings, 0 replies; 23+ messages in thread
From: Joel Brobecker @ 2014-08-19  6:33 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, binutils

> 2014-08-19  Yao Qi  <yao@codesourcery.com>
> 
> 	* configure: Regenerate.
> 	* config.in: Regenerate.

OK to push how.

Thank you!

-- 
Joel

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-19  3:43                         ` Hans-Peter Nilsson
@ 2014-08-19 12:29                           ` Alan Modra
  2014-08-19 13:00                             ` Hans-Peter Nilsson
  0 siblings, 1 reply; 23+ messages in thread
From: Alan Modra @ 2014-08-19 12:29 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: amker.cheng, binutils, gdb-patches

On Tue, Aug 19, 2014 at 05:43:26AM +0200, Hans-Peter Nilsson wrote:
> > From: Bin.Cheng <amker.cheng@gmail.com>
> > Date: Tue, 19 Aug 2014 04:28:32 +0200
> 
> > On Fri, Aug 15, 2014 at 11:41 PM, Hans-Peter Nilsson
> > <hans-peter.nilsson@axis.com> wrote:
> > >> From: Hans-Peter Nilsson <hp@axis.com>
> > >> Date: Fri, 15 Aug 2014 17:17:13 +0200
> > >
> > >> I'd rather fix up the broken pieces of "plugin support"
> > >> (just there to pacify bfd's need) that actually *are* in sim
> > >> already and look like they *should* pull in -ldl.  See
> > >> sim/common/{configure.ac,Make-common.in}; I'm looking into it.
> > >
> > > Looks like all that's actually needed is to regenerate
> > > sim/*/configure, for example by means of "make autoconf-common"
> > > in sim. Will do later; no keys here.
> > 
> > Hi Hans-Peter,
> > Any updates about this?  In the meantime, what else can I do except
> > disable plugins/lto through out all toolchain components?  Since we
> > use combined source tree and can't configure binutils and gdb
> > differently.  Thanks very much.
> 
> Roland McGrath committed a re-build of sim/*/config{.in,ure}
> later that day.  I'm guessing you haven't tried since then?
> arm-eabi is fine in my autotester builds (using only --target
> and --prefix options).
> 
> There are a couple of simulators suffering from fallout from the
> regenerated config.in due to older configury bugs
> (e.g. iq2000-elf, frv-elf, m32r-elf and powerpc-eabisim needs
> special treatment), but you didn't mention any others.

I'm about to commit the following to clean up my mess.  Adding -ldl in
AC_PLUGINS fixes the current --disable-shared breakage.  It's not
strictly necessary to add -ldl in directories that use libtool to link
libbfd, eg. binutils, since libtool magically picks up libbfd
dependencies (libbfd.la dependency_libs shell variable).  However,
invoking AC_SEARCH_LIBS in AC_PLUGINS has the benefit that it only
needs doing in one place.

bfd/
	* configure: Regenerate.
binutils/
	* configure: Regenerate.
config/
	* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
	LIBS via AC_SEARCH_LIBS.
gas/
	* configure: Regenerate.
gdb/
	* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
	* config.in: Regenerate.
	* configure: Regenerate.
gprof/
	* configure: Regenerate.
ld/
	* configure: Regenerate.
sim/arm/
	* configure: Regenerate.
sim/avr/
	* configure: Regenerate.
sim/bfin/
	* configure: Regenerate.
sim/common/
	* configure: Regenerate.
sim/cr16/
	* configure: Regenerate.
sim/cris/
	* configure: Regenerate.
sim/d10v/
	* configure: Regenerate.
sim/erc32/
	* configure: Regenerate.
sim/frv/
	* configure: Regenerate.
sim/h8300/
	* configure: Regenerate.
sim/iq2000/
	* configure: Regenerate.
sim/lm32/
	* configure: Regenerate.
sim/m32c/
	* configure: Regenerate.
sim/m32r/
	* configure: Regenerate.
sim/m68hc11/
	* configure: Regenerate.
sim/mcore/
	* configure: Regenerate.
sim/microblaze/
	* configure: Regenerate.
sim/mips/
	* configure: Regenerate.
sim/mn10300/
	* configure: Regenerate.
sim/moxie/
	* configure: Regenerate.
sim/msp430/
	* configure: Regenerate.
sim/ppc/
	* configure.ac: Invoke AC_PLUGINS.
	* configure: Regenerate.
	* config.in: Regenerate.
sim/rl78/
	* configure: Regenerate.
sim/rx/
	* configure: Regenerate.
sim/sh/
	* configure: Regenerate.
sim/sh64/
	* configure: Regenerate.
sim/v850/
	* configure: Regenerate.

diff --git a/config/plugins.m4 b/config/plugins.m4
index f65fdcb..513c690 100644
--- a/config/plugins.m4
+++ b/config/plugins.m4
@@ -15,4 +15,7 @@ AC_DEFUN([AC_PLUGINS],
      esac],
     [plugins=$maybe_plugins]
   )
+  if test "$plugins" = "yes"; then
+    AC_SEARCH_LIBS([dlopen], [dl])
+  fi
 ])
diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4
index a3fb9e2..2b46f73 100644
--- a/gdb/acinclude.m4
+++ b/gdb/acinclude.m4
@@ -458,10 +458,6 @@ AC_DEFUN([GDB_AC_CHECK_BFD], [
   CFLAGS="-I${srcdir}/../include -I../bfd -I${srcdir}/../bfd $CFLAGS"
   LDFLAGS="-L../bfd -L../libiberty $LDFLAGS"
   intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-  # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
-  if test "$plugins" = "yes"; then
-    AC_SEARCH_LIBS(dlopen, dl)
-  fi
   LIBS="-lbfd -liberty $intl $LIBS"
   AC_CACHE_CHECK([$1], [$2],
   [AC_TRY_LINK(
diff --git a/gdb/config.in b/gdb/config.in
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9c3fa54..f1a7e06 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -670,6 +670,9 @@ AC_ARG_PROGRAM
 # using the same condition.
 AM_ZLIB
 
+# BFD uses libdl when when plugins enabled.
+AC_PLUGINS
+
 . ${srcdir}/../../bfd/configure.host
 
 case ${host} in

-- 
Alan Modra
Australia Development Lab, IBM

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

* Re: Skip ld/lto tests if plugins is disabled for binutils?
  2014-08-19 12:29                           ` Alan Modra
@ 2014-08-19 13:00                             ` Hans-Peter Nilsson
  0 siblings, 0 replies; 23+ messages in thread
From: Hans-Peter Nilsson @ 2014-08-19 13:00 UTC (permalink / raw)
  To: amodra; +Cc: amker.cheng, binutils, gdb-patches

> From: Alan Modra <amodra@gmail.com>
> Date: Tue, 19 Aug 2014 14:28:57 +0200

> On Tue, Aug 19, 2014 at 05:43:26AM +0200, Hans-Peter Nilsson wrote:
> > There are a couple of simulators suffering from fallout from the
> > regenerated config.in due to older configury bugs
> > (e.g. iq2000-elf, frv-elf, m32r-elf and powerpc-eabisim needs
> > special treatment), but you didn't mention any others.
> 
> I'm about to commit the following to clean up my mess.  Adding -ldl in
> AC_PLUGINS fixes the current --disable-shared breakage.  It's not
> strictly necessary to add -ldl in directories that use libtool to link
> libbfd, eg. binutils, since libtool magically picks up libbfd
> dependencies (libbfd.la dependency_libs shell variable).  However,
> invoking AC_SEARCH_LIBS in AC_PLUGINS has the benefit that it only
> needs doing in one place.

That seems like it'd fix the ppc sim build failure, I'm onto the others.

(They're totally unrelated to any -ldl issue, just sim config
goofs from 2013 undetected until config.in was regenerated.)

brgds, H-P

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

end of thread, other threads:[~2014-08-19 13:00 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11  6:26 Skip ld/lto tests if plugins is disabled for binutils? Bin.Cheng
2014-08-11  7:55 ` Alan Modra
2014-08-11  8:21   ` Bin.Cheng
2014-08-11 12:59     ` Alan Modra
2014-08-12  2:52       ` Bin.Cheng
2014-08-12  4:45         ` Alan Modra
2014-08-12  5:00           ` Bin.Cheng
2014-08-12 13:14             ` Alan Modra
2014-08-13  5:58               ` Bin.Cheng
2014-08-14  4:25                 ` Alan Modra
2014-08-14 14:48               ` Hans-Peter Nilsson
2014-08-15  3:29                 ` Alan Modra
2014-08-15  5:29                   ` Bin.Cheng
2014-08-15  9:45                     ` Bin.Cheng
2014-08-15 15:17                   ` Hans-Peter Nilsson
2014-08-15 15:41                     ` Hans-Peter Nilsson
2014-08-19  2:28                       ` Bin.Cheng
2014-08-19  3:43                         ` Hans-Peter Nilsson
2014-08-19 12:29                           ` Alan Modra
2014-08-19 13:00                             ` Hans-Peter Nilsson
2014-08-19  2:52               ` [PATCH] Regenerate gdb/configure (Re: Skip ld/lto tests if plugins is disabled for binutils?) Yao Qi
2014-08-19  3:36                 ` Yao Qi
2014-08-19  6:33                   ` Joel Brobecker

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).