[PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'

Vladimir Mezentsev vladimir.mezentsev@oracle.com
Fri Jan 13 23:41:33 GMT 2023


  I pushed my fixes to the master branch.
May I push this to the 2.40 branch ?

Thank you,
-Vladimir


On 1/12/23 12:56, vladimir.mezentsev@oracle.com wrote:
> From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
>
>
> gprofng only depends on libopcodes but has been linked with libbfd and libiberty.
> I removed unnecessary dependencies.
> But the libbfd build has a side effect.
> When I configure with --with-system-zlib and links my application with '../libbfd/libbfd.la -L ../libiberty -liberty',
> my application will be linked with /usr/lib/liberty.a instead of ../libiberty/liberty.a
> The problem is here:
> % grep dependency_libs bfd/libbfd.la
> dependency_libs=' -lz -L/usr/lib -lzstd /dev/shm/bld/libsframe/libsframe.la -ldl'
>                        ^^^^^^^^^^^^^^^^^
>                        |
>    This is probably $(ZSTD_LIBS). Why is it not just -lzstd?
>
>    
> Please review my fixes in gprofng below.
> Thank you,
> -Vladimir
>
> gprofng/ChangeLog
> 2023-01-12  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
>
> 	PR gprofng/29987
> 	* configure.ac: Remove dependencies on libbfd and libiberty.
> 	* gprofng/src/Makefile.am: Likewise.
> 	* configure: Rebuild.
> 	* Makefile.in: Rebuild.
> 	* src/Makefile.in: Rebuild.
> 	* doc/Makefile.in: Rebuild.
> 	* gp-display-html/Makefile.in: Rebuild.
> ---
>   gprofng/Makefile.in                 |  1 -
>   gprofng/configure                   | 11 ++---------
>   gprofng/configure.ac                |  6 ------
>   gprofng/doc/Makefile.in             |  1 -
>   gprofng/gp-display-html/Makefile.in |  1 -
>   gprofng/src/Makefile.am             |  2 --
>   gprofng/src/Makefile.in             |  8 ++------
>   7 files changed, 4 insertions(+), 26 deletions(-)
>
> diff --git a/gprofng/Makefile.in b/gprofng/Makefile.in
> index 01f7dca3f2a..3464b793813 100644
> --- a/gprofng/Makefile.in
> +++ b/gprofng/Makefile.in
> @@ -267,7 +267,6 @@ FGREP = @FGREP@
>   GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
>   GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
>   GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
> -GPROFNG_LIBADD = @GPROFNG_LIBADD@
>   GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
>   GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
>   GREP = @GREP@
> diff --git a/gprofng/configure b/gprofng/configure
> index 40604319dc9..bcf971b75fa 100755
> --- a/gprofng/configure
> +++ b/gprofng/configure
> @@ -665,7 +665,6 @@ BUILD_COLLECTOR_TRUE
>   GPROFNG_NO_SWITCH_CFLAGS
>   gprofng_cflags
>   WERROR
> -GPROFNG_LIBADD
>   CXXCPP
>   OTOOL64
>   OTOOL
> @@ -12221,7 +12220,7 @@ else
>     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>     lt_status=$lt_dlunknown
>     cat > conftest.$ac_ext <<_LT_EOF
> -#line 12224 "configure"
> +#line 12223 "configure"
>   #include "confdefs.h"
>   
>   #if HAVE_DLFCN_H
> @@ -12327,7 +12326,7 @@ else
>     lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>     lt_status=$lt_dlunknown
>     cat > conftest.$ac_ext <<_LT_EOF
> -#line 12330 "configure"
> +#line 12329 "configure"
>   #include "confdefs.h"
>   
>   #if HAVE_DLFCN_H
> @@ -15571,12 +15570,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
>   
>   
>   
> -GPROFNG_LIBADD="-L../../libiberty -liberty"
> -if test "$enable_shared" = "yes"; then
> -  GPROFNG_LIBADD="-L../../libiberty/pic -liberty"
> -fi
> -
> -
>   # Figure out what compiler warnings we can enable.
>   # See config/warnings.m4 for details.
>   
> diff --git a/gprofng/configure.ac b/gprofng/configure.ac
> index 83e60a640cf..55312cab3f8 100644
> --- a/gprofng/configure.ac
> +++ b/gprofng/configure.ac
> @@ -37,12 +37,6 @@ fi
>   AC_DISABLE_SHARED
>   LT_INIT
>   
> -GPROFNG_LIBADD="-L../../libiberty -liberty"
> -if test "$enable_shared" = "yes"; then
> -  GPROFNG_LIBADD="-L../../libiberty/pic -liberty"
> -fi
> -AC_SUBST(GPROFNG_LIBADD)
> -
>   # Figure out what compiler warnings we can enable.
>   # See config/warnings.m4 for details.
>   
> diff --git a/gprofng/doc/Makefile.in b/gprofng/doc/Makefile.in
> index a45018334e8..fd35f629403 100644
> --- a/gprofng/doc/Makefile.in
> +++ b/gprofng/doc/Makefile.in
> @@ -249,7 +249,6 @@ FGREP = @FGREP@
>   GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
>   GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
>   GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
> -GPROFNG_LIBADD = @GPROFNG_LIBADD@
>   GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
>   GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
>   GREP = @GREP@
> diff --git a/gprofng/gp-display-html/Makefile.in b/gprofng/gp-display-html/Makefile.in
> index 42886f7c645..d2b9872fc71 100644
> --- a/gprofng/gp-display-html/Makefile.in
> +++ b/gprofng/gp-display-html/Makefile.in
> @@ -212,7 +212,6 @@ FGREP = @FGREP@
>   GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
>   GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
>   GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
> -GPROFNG_LIBADD = @GPROFNG_LIBADD@
>   GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
>   GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
>   GREP = @GREP@
> diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
> index b802ffd39db..2278b9a39bb 100644
> --- a/gprofng/src/Makefile.am
> +++ b/gprofng/src/Makefile.am
> @@ -132,8 +132,6 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
>   # when -nostdlib is passed to libtool.
>   # See bug 29364 - libgprofng.so: needs to link against -pthread
>   libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \
> -	$(top_builddir)/../bfd/libbfd.la \
> -	$(GPROFNG_LIBADD) \
>   	-lpthread -ldl
>   
>   dbedir = $(SYSCONFDIR)
> diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
> index 4274762334e..71dccf5f952 100644
> --- a/gprofng/src/Makefile.in
> +++ b/gprofng/src/Makefile.in
> @@ -158,9 +158,7 @@ am__uninstall_files_from_dir = { \
>   am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \
>   	"$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"
>   LTLIBRARIES = $(pkglib_LTLIBRARIES)
> -am__DEPENDENCIES_1 =
> -libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la \
> -	$(top_builddir)/../bfd/libbfd.la $(am__DEPENDENCIES_1)
> +libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la
>   am__objects_1 = Application.lo BaseMetric.lo BaseMetricTreeNode.lo \
>   	CallStack.lo CatchOutOfMemory.lo ClassFile.lo Command.lo \
>   	CompCom.lo DataObject.lo DataSpace.lo Data_window.lo \
> @@ -192,6 +190,7 @@ libgprofng_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \
>   PROGRAMS = $(bin_PROGRAMS)
>   am_gp_archive_OBJECTS = gp-archive.$(OBJEXT) ArchiveExp.$(OBJEXT)
>   gp_archive_OBJECTS = $(am_gp_archive_OBJECTS)
> +am__DEPENDENCIES_1 =
>   gp_archive_DEPENDENCIES = $(LIBGPROFNG) $(am__DEPENDENCIES_1) \
>   	$(am__DEPENDENCIES_1)
>   am_gp_collect_app_OBJECTS = gp-collect-app.$(OBJEXT) checks.$(OBJEXT) \
> @@ -336,7 +335,6 @@ FGREP = @FGREP@
>   GPROFNG_BROKEN_JAVAC = @GPROFNG_BROKEN_JAVAC@
>   GPROFNG_CFLAGS = @GPROFNG_CFLAGS@
>   GPROFNG_CPPFLAGS = @GPROFNG_CPPFLAGS@
> -GPROFNG_LIBADD = @GPROFNG_LIBADD@
>   GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS = @GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS@
>   GPROFNG_NO_SWITCH_CFLAGS = @GPROFNG_NO_SWITCH_CFLAGS@
>   GREP = @GREP@
> @@ -556,8 +554,6 @@ libgprofng_la_LDFLAGS = -version-info 0:0:0
>   # when -nostdlib is passed to libtool.
>   # See bug 29364 - libgprofng.so: needs to link against -pthread
>   libgprofng_la_LIBADD = $(top_builddir)/../opcodes/libopcodes.la \
> -	$(top_builddir)/../bfd/libbfd.la \
> -	$(GPROFNG_LIBADD) \
>   	-lpthread -ldl
>   
>   dbedir = $(SYSCONFDIR)



More information about the Binutils mailing list