public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
@ 2023-01-12 20:56 vladimir.mezentsev
  2023-01-13 23:41 ` Vladimir Mezentsev
  0 siblings, 1 reply; 7+ messages in thread
From: vladimir.mezentsev @ 2023-01-12 20:56 UTC (permalink / raw)
  To: binutils; +Cc: Vladimir Mezentsev

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


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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-12 20:56 [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp' vladimir.mezentsev
@ 2023-01-13 23:41 ` Vladimir Mezentsev
  2023-01-16 14:10   ` Luis Machado
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Mezentsev @ 2023-01-13 23:41 UTC (permalink / raw)
  To: binutils

  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)


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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-13 23:41 ` Vladimir Mezentsev
@ 2023-01-16 14:10   ` Luis Machado
  2023-01-16 19:28     ` Joseph Myers
  2023-01-17  0:05     ` Vladimir Mezentsev
  0 siblings, 2 replies; 7+ messages in thread
From: Luis Machado @ 2023-01-16 14:10 UTC (permalink / raw)
  To: Vladimir Mezentsev, binutils, Nick Clifton

Hi,

I bisected a broken build on aarch64-linux Ubuntu 22.04 to this commit.

It seems to cause a number of undefined references when building with --enable-targets=all.

--
gprofng/src/../../../../repos/binutils-gdb/gprofng/src/Elf.cc:142: undefined reference to `bfd_init'

/usr/bin/ld: ./.libs/libgprofng.a(Elf.o): in function `Elf::Elf(char*)':
--

A master build of binutils-gdb should hopefully run into the problem. Passing --disable-gprofng seems to make the build complete OK.

Could you please take a look at it?

On 1/13/23 23:41, Vladimir Mezentsev via Binutils wrote:
>   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)
> 


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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-16 14:10   ` Luis Machado
@ 2023-01-16 19:28     ` Joseph Myers
  2023-01-17  0:05     ` Vladimir Mezentsev
  1 sibling, 0 replies; 7+ messages in thread
From: Joseph Myers @ 2023-01-16 19:28 UTC (permalink / raw)
  To: Luis Machado; +Cc: Vladimir Mezentsev, binutils, Nick Clifton

On Mon, 16 Jan 2023, Luis Machado via Binutils wrote:

> Hi,
> 
> I bisected a broken build on aarch64-linux Ubuntu 22.04 to this commit.
> 
> It seems to cause a number of undefined references when building with
> --enable-targets=all.

I'm also seeing this with cross builds for x86_64-linux-gnu and 
aarch64-linux-gnu targets.

https://sourceware.org/pipermail/libc-testresults/2023q1/010729.html

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-16 14:10   ` Luis Machado
  2023-01-16 19:28     ` Joseph Myers
@ 2023-01-17  0:05     ` Vladimir Mezentsev
  2023-01-17 10:21       ` Luis Machado
  1 sibling, 1 reply; 7+ messages in thread
From: Vladimir Mezentsev @ 2023-01-17  0:05 UTC (permalink / raw)
  To: Luis Machado, binutils

Hi Luis,

On 1/16/23 06:10, Luis Machado wrote:
> Hi,
>
> I bisected a broken build on aarch64-linux Ubuntu 22.04 to this commit.
>
> It seems to cause a number of undefined references when building with 
> --enable-targets=all.
>
> -- 
> gprofng/src/../../../../repos/binutils-gdb/gprofng/src/Elf.cc:142: 
> undefined reference to `bfd_init'
>
> /usr/bin/ld: ./.libs/libgprofng.a(Elf.o): in function `Elf::Elf(char*)':
> -- 
>
> A master build of binutils-gdb should hopefully run into the problem. 
> Passing --disable-gprofng seems to make the build complete OK.
>
> Could you please take a look at it?



I don't have Ubuntu.
I cannot reproduce the problem on my configuration:

% uname -a
Linux OL8.4-beta3 5.4.17-2102.200.13.el8uek.aarch64 #2 SMP Sun Mar 28 
15:24:03 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux

% gcc --version
gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1.0.1)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

% libtool --version
libtool (GNU libtool) 2.4.6
Written by Gordon Matzigkeit, 1996
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


gprofng depends on libopcodes and as I see now gprofng directly depends 
on libbfd.
We use libtool to link gprofng only with libopcodes.
It looks like on my machines, libtool automatically links gprofng with 
libbfd because libopcodes depends on libbfd.

I propose the fix below.
All builds on my machines are OK with and without this fix.
Could you check my fix on your machine ? Or should I push my path to the 
master branch now ?


Thank you,
-Vladimir


% cat 0001-gprofng-link-with-libbfd.patch
 From 8b2b7967649a605935d6810aa58c97437cd46b6b Mon Sep 17 00:00:00 2001
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
Date: Mon, 16 Jan 2023 15:51:44 -0800
Subject: [PATCH] gprofng: link with libbfd

gprofng/ChangeLog
2023-01-16  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

     PR gprofng/29987
     * src/Makefile.am: Link with libbfd.
     * src/Makefile.in: Rebuild.
---
  gprofng/src/Makefile.am | 1 +
  gprofng/src/Makefile.in | 4 +++-
  2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
index 2278b9a39bb..b3423e121e3 100644
--- a/gprofng/src/Makefile.am
+++ b/gprofng/src/Makefile.am
@@ -132,6 +132,7 @@ 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 \
      -lpthread -ldl

  dbedir = $(SYSCONFDIR)
diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
index 71dccf5f952..90455880ec7 100644
--- a/gprofng/src/Makefile.in
+++ b/gprofng/src/Makefile.in
@@ -158,7 +158,8 @@ am__uninstall_files_from_dir = { \
  am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \
      "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"
  LTLIBRARIES = $(pkglib_LTLIBRARIES)
-libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la
+libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la \
+    $(top_builddir)/../bfd/libbfd.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 \
@@ -554,6 +555,7 @@ 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 \
      -lpthread -ldl

  dbedir = $(SYSCONFDIR)
-- 
2.31.1










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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-17  0:05     ` Vladimir Mezentsev
@ 2023-01-17 10:21       ` Luis Machado
  2023-01-18  3:35         ` Vladimir Mezentsev
  0 siblings, 1 reply; 7+ messages in thread
From: Luis Machado @ 2023-01-17 10:21 UTC (permalink / raw)
  To: Vladimir Mezentsev, binutils; +Cc: nick Clifton, Joseph Myers

Hi Vladimir,

I gave the attach patch a try (had to rework it, as it doesn't apply cleanly), and it still runs into a build error.

Should we revert this (did it make it to binutils 2.40?) and try to address it on-the-side as opposed to leaving the
master branch in an unstable state?

On 1/17/23 00:05, Vladimir Mezentsev wrote:
> Hi Luis,
> 
> On 1/16/23 06:10, Luis Machado wrote:
>> Hi,
>>
>> I bisected a broken build on aarch64-linux Ubuntu 22.04 to this commit.
>>
>> It seems to cause a number of undefined references when building with --enable-targets=all.
>>
>> -- 
>> gprofng/src/../../../../repos/binutils-gdb/gprofng/src/Elf.cc:142: undefined reference to `bfd_init'
>>
>> /usr/bin/ld: ./.libs/libgprofng.a(Elf.o): in function `Elf::Elf(char*)':
>> -- 
>>
>> A master build of binutils-gdb should hopefully run into the problem. Passing --disable-gprofng seems to make the build complete OK.
>>
>> Could you please take a look at it?
> 
> 
> 
> I don't have Ubuntu.
> I cannot reproduce the problem on my configuration:
> 
> % uname -a
> Linux OL8.4-beta3 5.4.17-2102.200.13.el8uek.aarch64 #2 SMP Sun Mar 28 15:24:03 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux
> 
> % gcc --version
> gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1.0.1)
> Copyright (C) 2018 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> % libtool --version
> libtool (GNU libtool) 2.4.6
> Written by Gordon Matzigkeit, 1996
> Copyright (C) 2014 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> 
> gprofng depends on libopcodes and as I see now gprofng directly depends on libbfd.
> We use libtool to link gprofng only with libopcodes.
> It looks like on my machines, libtool automatically links gprofng with libbfd because libopcodes depends on libbfd.
> 
> I propose the fix below.
> All builds on my machines are OK with and without this fix.
> Could you check my fix on your machine ? Or should I push my path to the master branch now ?
> 
> 
> Thank you,
> -Vladimir
> 
> 
> % cat 0001-gprofng-link-with-libbfd.patch
>  From 8b2b7967649a605935d6810aa58c97437cd46b6b Mon Sep 17 00:00:00 2001
> From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> Date: Mon, 16 Jan 2023 15:51:44 -0800
> Subject: [PATCH] gprofng: link with libbfd
> 
> gprofng/ChangeLog
> 2023-01-16  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> 
>      PR gprofng/29987
>      * src/Makefile.am: Link with libbfd.
>      * src/Makefile.in: Rebuild.
> ---
>   gprofng/src/Makefile.am | 1 +
>   gprofng/src/Makefile.in | 4 +++-
>   2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
> index 2278b9a39bb..b3423e121e3 100644
> --- a/gprofng/src/Makefile.am
> +++ b/gprofng/src/Makefile.am
> @@ -132,6 +132,7 @@ 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 \
>       -lpthread -ldl
> 
>   dbedir = $(SYSCONFDIR)
> diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
> index 71dccf5f952..90455880ec7 100644
> --- a/gprofng/src/Makefile.in
> +++ b/gprofng/src/Makefile.in
> @@ -158,7 +158,8 @@ am__uninstall_files_from_dir = { \
>   am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \
>       "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"
>   LTLIBRARIES = $(pkglib_LTLIBRARIES)
> -libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la
> +libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la \
> +    $(top_builddir)/../bfd/libbfd.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 \
> @@ -554,6 +555,7 @@ 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 \
>       -lpthread -ldl
> 
>   dbedir = $(SYSCONFDIR)


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

* Re: [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp'
  2023-01-17 10:21       ` Luis Machado
@ 2023-01-18  3:35         ` Vladimir Mezentsev
  0 siblings, 0 replies; 7+ messages in thread
From: Vladimir Mezentsev @ 2023-01-18  3:35 UTC (permalink / raw)
  To: Luis Machado, binutils; +Cc: nick Clifton, Joseph Myers

Hi Luis,

On 1/17/23 02:21, Luis Machado wrote:
> Hi Vladimir,
>
> I gave the attach patch a try (had to rework it, as it doesn't apply 
> cleanly), and it still runs into a build error.

  I found Ubuntu machine and reproduced the build problem.
My fix for PR29987 was incorrect..
I made `git revert c2a5d74050e` and pushed to the master branch.

I need to research again how to solve the problem.

>
> Should we revert this (did it make it to binutils 2.40?) and try to 
> address it on-the-side as opposed to leaving the
> master branch in an unstable state?

My fix was not in binutils 2.40.

-Vladimir


>
> On 1/17/23 00:05, Vladimir Mezentsev wrote:
>> Hi Luis,
>>
>> On 1/16/23 06:10, Luis Machado wrote:
>>> Hi,
>>>
>>> I bisected a broken build on aarch64-linux Ubuntu 22.04 to this commit.
>>>
>>> It seems to cause a number of undefined references when building 
>>> with --enable-targets=all.
>>>
>>> -- 
>>> gprofng/src/../../../../repos/binutils-gdb/gprofng/src/Elf.cc:142: 
>>> undefined reference to `bfd_init'
>>>
>>> /usr/bin/ld: ./.libs/libgprofng.a(Elf.o): in function 
>>> `Elf::Elf(char*)':
>>> -- 
>>>
>>> A master build of binutils-gdb should hopefully run into the 
>>> problem. Passing --disable-gprofng seems to make the build complete OK.
>>>
>>> Could you please take a look at it?
>>
>>
>>
>> I don't have Ubuntu.
>> I cannot reproduce the problem on my configuration:
>>
>> % uname -a
>> Linux OL8.4-beta3 5.4.17-2102.200.13.el8uek.aarch64 #2 SMP Sun Mar 28 
>> 15:24:03 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux
>>
>> % gcc --version
>> gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1.0.1)
>> Copyright (C) 2018 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions. There 
>> is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
>> PURPOSE.
>>
>> % libtool --version
>> libtool (GNU libtool) 2.4.6
>> Written by Gordon Matzigkeit, 1996
>> Copyright (C) 2014 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions. There 
>> is NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
>> PURPOSE.
>>
>>
>> gprofng depends on libopcodes and as I see now gprofng directly 
>> depends on libbfd.
>> We use libtool to link gprofng only with libopcodes.
>> It looks like on my machines, libtool automatically links gprofng 
>> with libbfd because libopcodes depends on libbfd.
>>
>> I propose the fix below.
>> All builds on my machines are OK with and without this fix.
>> Could you check my fix on your machine ? Or should I push my path to 
>> the master branch now ?
>>
>>
>> Thank you,
>> -Vladimir
>>
>>
>> % cat 0001-gprofng-link-with-libbfd.patch
>>  From 8b2b7967649a605935d6810aa58c97437cd46b6b Mon Sep 17 00:00:00 2001
>> From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
>> Date: Mon, 16 Jan 2023 15:51:44 -0800
>> Subject: [PATCH] gprofng: link with libbfd
>>
>> gprofng/ChangeLog
>> 2023-01-16  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
>>
>>      PR gprofng/29987
>>      * src/Makefile.am: Link with libbfd.
>>      * src/Makefile.in: Rebuild.
>> ---
>>   gprofng/src/Makefile.am | 1 +
>>   gprofng/src/Makefile.in | 4 +++-
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/gprofng/src/Makefile.am b/gprofng/src/Makefile.am
>> index 2278b9a39bb..b3423e121e3 100644
>> --- a/gprofng/src/Makefile.am
>> +++ b/gprofng/src/Makefile.am
>> @@ -132,6 +132,7 @@ 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 \
>>       -lpthread -ldl
>>
>>   dbedir = $(SYSCONFDIR)
>> diff --git a/gprofng/src/Makefile.in b/gprofng/src/Makefile.in
>> index 71dccf5f952..90455880ec7 100644
>> --- a/gprofng/src/Makefile.in
>> +++ b/gprofng/src/Makefile.in
>> @@ -158,7 +158,8 @@ am__uninstall_files_from_dir = { \
>>   am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(bindir)" \
>>       "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(dbedir)"
>>   LTLIBRARIES = $(pkglib_LTLIBRARIES)
>> -libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la
>> +libgprofng_la_DEPENDENCIES = $(top_builddir)/../opcodes/libopcodes.la \
>> +    $(top_builddir)/../bfd/libbfd.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 \
>> @@ -554,6 +555,7 @@ 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 \
>>       -lpthread -ldl
>>
>>   dbedir = $(SYSCONFDIR)
>


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

end of thread, other threads:[~2023-01-18  3:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-12 20:56 [PATCH] gprofng: PR29987 bfd/archive.c:1447: undefined reference to `filename_ncmp' vladimir.mezentsev
2023-01-13 23:41 ` Vladimir Mezentsev
2023-01-16 14:10   ` Luis Machado
2023-01-16 19:28     ` Joseph Myers
2023-01-17  0:05     ` Vladimir Mezentsev
2023-01-17 10:21       ` Luis Machado
2023-01-18  3:35         ` Vladimir Mezentsev

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