Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] fix sim build when configured with --enable-plugins
@ 2012-11-15 14:32 Pavel Chupin
  2012-11-15 14:36 ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Chupin @ 2012-11-15 14:32 UTC (permalink / raw)
  To: gdb-patches

Hi,
Patch below fix sim builds for some targets when bfd build is
configured with --enable-plugins. In this case libbfd.a (plugin.o) has
dependencies on libdl so it should be included into link commands,
similar as zlib.
Is it OK for trunk?

Patch:

diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index fe0a5b7..1d2fd1c 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -21,6 +21,7 @@
 # Include global overrides and fixes for Autoconf.
 m4_include(../../config/override.m4)
 sinclude([../../config/zlib.m4])
+sinclude([../../config/plugins.m4])
 sinclude([../../config/depstand.m4])

 AC_DEFUN([SIM_AC_COMMON],
@@ -90,6 +91,12 @@ AC_CHECK_LIB(nsl, gethostbyname)
 # using the same condition.
 AM_ZLIB

+# BFD uses libdl when when plugins enabled.
+AC_PLUGINS
+if test "x$plugins" = "xyes"; then
+  LIBS+=" -ldl"
+fi
+
 . ${srcdir}/../../bfd/configure.host

 dnl Standard (and optional) simulator options.

sim/ChangeLog entry:

2012-11-09  Pavel Chupin  <pavel.v.chupin@intel.com>

        Fix sim build when bfd is configured with --enable-plugins
        * arm/configure: Regenerate.
        * avr/configure: Regenerate.
        * bfin/configure: Regenerate.
        * common/acinclude.m4: Add libdl into LIBS.
        * common/configure: Regenerate.
        * cr16/configure: Regenerate.
        * cris/configure: Regenerate.
        * d10v/configure: Regenerate.
        * erc32/configure: Regenerate.
        * frv/configure: Regenerate.
        * h8300/configure: Regenerate.
        * igen/configure: Regenerate.
        * iq2000/configure: Regenerate.
        * lm32/configure: Regenerate.
        * m32c/configure: Regenerate.
        * m32r/configure: Regenerate.
        * m68hc11/configure: Regenerate.
        * mcore/configure: Regenerate.
        * microblaze/configure: Regenerate.
        * mips/configure: Regenerate.
        * mn10300/configure: Regenerate.
        * moxie/configure: Regenerate.
        * ppc/configure: Regenerate.
        * rl78/configure: Regenerate.
        * rx/configure: Regenerate.
        * sh/configure: Regenerate.
        * sh64/configure: Regenerate.
        * testsuite/configure: Regenerate.
        * v850/configure: Regenerate.


Can be reproduced on trunk with (for example):

configure --enable-plugins --target arm-linux-androideabi
make

Error:

gcc -DHAVE_CONFIG_H     -DPROFILE=1 -DWITH_PROFILE=-1
-DDEFAULT_INLINE=0           -DMODET -DNEED_UI_LOOP_HOOK
-DSIM_TARGET_SWITCHES   -I. -I../../../sim/arm -I../common
-I../../../sim/arm/../common -I../../include
-I../../../sim/arm/../../include -I../../bfd
-I../../../sim/arm/../../bfd -I../../opcodes
-I../../../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/gdb/BUILD/bfd/../../bfd/plugin.c:170: undefined reference to `dlopen'
/tmp/gdb/BUILD/bfd/../../bfd/plugin.c:177: undefined reference to `dlsym'
/tmp/gdb/BUILD/bfd/../../bfd/plugin.c:173: undefined reference to `dlerror'

--
Pavel Chupin
Intel Corporation


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

* Re: [PATCH] fix sim build when configured with --enable-plugins
  2012-11-15 14:32 [PATCH] fix sim build when configured with --enable-plugins Pavel Chupin
@ 2012-11-15 14:36 ` H.J. Lu
  2012-11-16  9:14   ` Pavel Chupin
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2012-11-15 14:36 UTC (permalink / raw)
  To: Pavel Chupin; +Cc: gdb-patches

On Thu, Nov 15, 2012 at 6:31 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
> Hi,
> Patch below fix sim builds for some targets when bfd build is
> configured with --enable-plugins. In this case libbfd.a (plugin.o) has
> dependencies on libdl so it should be included into link commands,
> similar as zlib.
> Is it OK for trunk?
>
> Patch:
>
> diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
> index fe0a5b7..1d2fd1c 100644
> --- a/sim/common/acinclude.m4
> +++ b/sim/common/acinclude.m4
> @@ -21,6 +21,7 @@
>  # Include global overrides and fixes for Autoconf.
>  m4_include(../../config/override.m4)
>  sinclude([../../config/zlib.m4])
> +sinclude([../../config/plugins.m4])
>  sinclude([../../config/depstand.m4])
>
>  AC_DEFUN([SIM_AC_COMMON],
> @@ -90,6 +91,12 @@ AC_CHECK_LIB(nsl, gethostbyname)
>  # using the same condition.
>  AM_ZLIB
>
> +# BFD uses libdl when when plugins enabled.
> +AC_PLUGINS
> +if test "x$plugins" = "xyes"; then
> +  LIBS+=" -ldl"
> +fi
> +

This is wrong.  Please do it like:

http://sourceware.org/git/?p=binutils.git;a=patch;h=f780e457f046c09d336e4dab0ffbcfbec70bfbee

-- 
H.J.


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

* Re: [PATCH] fix sim build when configured with --enable-plugins
  2012-11-15 14:36 ` H.J. Lu
@ 2012-11-16  9:14   ` Pavel Chupin
  2012-11-17  8:09     ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Chupin @ 2012-11-16  9:14 UTC (permalink / raw)
  To: H.J. Lu; +Cc: gdb-patches

Changed:

diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 1a3a6b6..bacfa24 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -58,6 +58,7 @@ man1dir = $(mandir)/man1
 infodir = @infodir@
 includedir = @includedir@

+lt_cv_dlopen_libs = @lt_cv_dlopen_libs@
 # This can be referenced by the gettext configuration code.
 top_builddir = ..

@@ -255,6 +256,7 @@ COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH)

 LIBIBERTY_LIB = ../../libiberty/libiberty.a
 BFD_LIB = ../../bfd/libbfd.a
+@PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
 OPCODES_LIB = ../../opcodes/libopcodes.a
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
@@ -262,7 +264,7 @@ CONFIG_LIBS = @LIBS@
 LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) \
    $(SIM_EXTRA_LIBDEPS)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
-   $(CONFIG_LIBS) $(SIM_EXTRA_LIBS)
+   $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL)

 LIB_OBJS = callback.o syscall.o targ-map.o version.o $(SIM_OBJS)

diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
index fe0a5b7..b6ebf15 100644
--- a/sim/common/acinclude.m4
+++ b/sim/common/acinclude.m4
@@ -21,6 +21,12 @@
 # Include global overrides and fixes for Autoconf.
 m4_include(../../config/override.m4)
 sinclude([../../config/zlib.m4])
+m4_include([../../config/plugins.m4])
+m4_include([../../libtool.m4])
+m4_include([../../ltoptions.m4])
+m4_include([../../ltsugar.m4])
+m4_include([../../ltversion.m4])
+m4_include([../../lt~obsolete.m4])
 sinclude([../../config/depstand.m4])

 AC_DEFUN([SIM_AC_COMMON],
@@ -90,6 +96,12 @@ AC_CHECK_LIB(nsl, gethostbyname)
 # using the same condition.
 AM_ZLIB

+# BFD uses libdl when when plugins enabled.
+AC_PLUGINS
+AM_CONDITIONAL(PLUGINS, test "$plugins" = yes)
+LT_INIT([dlopen])
+AC_SUBST(lt_cv_dlopen_libs)
+
 . ${srcdir}/../../bfd/configure.host

 dnl Standard (and optional) simulator options.

ChangeLog:

2012-11-09  Pavel Chupin  <pavel.v.chupin@intel.com>

        Fix sim build when bfd is configured with --enable-plugins
        * arm/configure: Regenerate.
        * avr/configure: Regenerate.
        * bfin/configure: Regenerate.
        * common/Make-common.in: Use lt_cv_dlopen_libs under PLUGINS condition.
        * common/acinclude.m4: Define lt_cv_dlopen_libs.
        * common/configure: Regenerate.
        * cr16/configure: Regenerate.
        * cris/configure: Regenerate.
        * d10v/configure: Regenerate.
        * erc32/configure: Regenerate.
        * frv/configure: Regenerate.
        * h8300/configure: Regenerate.
        * igen/configure: Regenerate.
        * iq2000/configure: Regenerate.
        * lm32/configure: Regenerate.
        * m32c/configure: Regenerate.
        * m32r/configure: Regenerate.
        * m68hc11/configure: Regenerate.
        * mcore/configure: Regenerate.
        * microblaze/configure: Regenerate.
        * mips/configure: Regenerate.
        * mn10300/configure: Regenerate.
        * moxie/configure: Regenerate.
        * ppc/configure: Regenerate.
        * rl78/configure: Regenerate.
        * rx/configure: Regenerate.
        * sh/configure: Regenerate.
        * sh64/configure: Regenerate.
        * testsuite/configure: Regenerate.
        * v850/configure: Regenerate.

2012/11/15 H.J. Lu <hjl.tools@gmail.com>:
> On Thu, Nov 15, 2012 at 6:31 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
>> Hi,
>> Patch below fix sim builds for some targets when bfd build is
>> configured with --enable-plugins. In this case libbfd.a (plugin.o) has
>> dependencies on libdl so it should be included into link commands,
>> similar as zlib.
>> Is it OK for trunk?
>>
>> Patch:
>>
>> diff --git a/sim/common/acinclude.m4 b/sim/common/acinclude.m4
>> index fe0a5b7..1d2fd1c 100644
>> --- a/sim/common/acinclude.m4
>> +++ b/sim/common/acinclude.m4
>> @@ -21,6 +21,7 @@
>>  # Include global overrides and fixes for Autoconf.
>>  m4_include(../../config/override.m4)
>>  sinclude([../../config/zlib.m4])
>> +sinclude([../../config/plugins.m4])
>>  sinclude([../../config/depstand.m4])
>>
>>  AC_DEFUN([SIM_AC_COMMON],
>> @@ -90,6 +91,12 @@ AC_CHECK_LIB(nsl, gethostbyname)
>>  # using the same condition.
>>  AM_ZLIB
>>
>> +# BFD uses libdl when when plugins enabled.
>> +AC_PLUGINS
>> +if test "x$plugins" = "xyes"; then
>> +  LIBS+=" -ldl"
>> +fi
>> +
>
> This is wrong.  Please do it like:
>
> http://sourceware.org/git/?p=binutils.git;a=patch;h=f780e457f046c09d336e4dab0ffbcfbec70bfbee
>
> --
> H.J.



--
Pavel Chupin
Intel Corporation


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

* Re: [PATCH] fix sim build when configured with --enable-plugins
  2012-11-16  9:14   ` Pavel Chupin
@ 2012-11-17  8:09     ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2012-11-17  8:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Pavel Chupin, H.J. Lu

[-- Attachment #1: Type: Text/Plain, Size: 191 bytes --]

On Friday 16 November 2012 04:14:26 Pavel Chupin wrote:
> Changed:

OK

on a different note, please don't top post in the future.  also, your patch had 
some whitespace damage.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-11-17  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 14:32 [PATCH] fix sim build when configured with --enable-plugins Pavel Chupin
2012-11-15 14:36 ` H.J. Lu
2012-11-16  9:14   ` Pavel Chupin
2012-11-17  8:09     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox