public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal'
@ 2024-03-02  3:58 rudi at heitbaum dot com
  2024-03-02  3:58 ` [Bug general/31439] " rudi at heitbaum dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rudi at heitbaum dot com @ 2024-03-02  3:58 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=31439

            Bug ID: 31439
           Summary: error: undefined reference to
                    '__dwarf_get_units_internal'
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: general
          Assignee: unassigned at sourceware dot org
          Reporter: rudi at heitbaum dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

When cross-compiling 0.191 as target if fails linking with

  CCLD     readelf
readelf.o:readelf.c:function str_offsets_base_off:(.text+0x804e): error:
undefined reference to '__dwarf_get_units_internal'
collect2: error: ld returned 1 exit status

Full output:

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug general/31439] error: undefined reference to '__dwarf_get_units_internal'
  2024-03-02  3:58 [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal' rudi at heitbaum dot com
@ 2024-03-02  3:58 ` rudi at heitbaum dot com
  2024-03-02 14:09 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rudi at heitbaum dot com @ 2024-03-02  3:58 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=31439

rudi at heitbaum dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |x86_64
             Target|                            |x86_64

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug general/31439] error: undefined reference to '__dwarf_get_units_internal'
  2024-03-02  3:58 [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal' rudi at heitbaum dot com
  2024-03-02  3:58 ` [Bug general/31439] " rudi at heitbaum dot com
@ 2024-03-02 14:09 ` mark at klomp dot org
  2024-03-02 23:04 ` rudi at heitbaum dot com
  2024-03-02 23:53 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-02 14:09 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=31439

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at klomp dot org

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
I don't fully understand how you are building, and I cannot replicate, but it
seems something goes wrong with readelf.c using the libdwP.h "internals"
header. Does the following patch help?

diff --git a/libdw/libdwP.h b/libdw/libdwP.h
index 8b2f06fa5937..c1c84ed3567d 100644
--- a/libdw/libdwP.h
+++ b/libdw/libdwP.h
@@ -1153,8 +1153,7 @@ str_offsets_base_off (Dwarf *dbg, Dwarf_CU *cu)
   if (cu == NULL && dbg != NULL)
     {
       Dwarf_CU *first_cu;
-      if (INTUSE(dwarf_get_units) (dbg, NULL, &first_cu,
-                                  NULL, NULL, NULL, NULL) == 0)
+      if (dwarf_get_units (dbg, NULL, &first_cu, NULL, NULL, NULL, NULL) == 0)
        cu = first_cu;
     }

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug general/31439] error: undefined reference to '__dwarf_get_units_internal'
  2024-03-02  3:58 [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal' rudi at heitbaum dot com
  2024-03-02  3:58 ` [Bug general/31439] " rudi at heitbaum dot com
  2024-03-02 14:09 ` mark at klomp dot org
@ 2024-03-02 23:04 ` rudi at heitbaum dot com
  2024-03-02 23:53 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rudi at heitbaum dot com @ 2024-03-02 23:04 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=31439

--- Comment #2 from rudi at heitbaum dot com ---
(In reply to Mark Wielaard from comment #1)
> I don't fully understand how you are building, and I cannot replicate, but
> it seems something goes wrong with readelf.c using the libdwP.h "internals"
> header. Does the following patch help?
> 
> diff --git a/libdw/libdwP.h b/libdw/libdwP.h
> index 8b2f06fa5937..c1c84ed3567d 100644
> --- a/libdw/libdwP.h
> +++ b/libdw/libdwP.h
> @@ -1153,8 +1153,7 @@ str_offsets_base_off (Dwarf *dbg, Dwarf_CU *cu)
>    if (cu == NULL && dbg != NULL)
>      {
>        Dwarf_CU *first_cu;
> -      if (INTUSE(dwarf_get_units) (dbg, NULL, &first_cu,
> -				   NULL, NULL, NULL, NULL) == 0)
> +      if (dwarf_get_units (dbg, NULL, &first_cu, NULL, NULL, NULL, NULL) ==
> 0)
>  	cu = first_cu;
>      }

Hi mark, sorry for not sharing more yesterday, somehow I locked my account out
on sourceware…. But I can confirm your patch does fix the build.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug general/31439] error: undefined reference to '__dwarf_get_units_internal'
  2024-03-02  3:58 [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal' rudi at heitbaum dot com
                   ` (2 preceding siblings ...)
  2024-03-02 23:04 ` rudi at heitbaum dot com
@ 2024-03-02 23:53 ` mark at klomp dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mark at klomp dot org @ 2024-03-02 23:53 UTC (permalink / raw)
  To: elfutils-devel

https://sourceware.org/bugzilla/show_bug.cgi?id=31439

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Thanks for testing. I don't know why I am unable to replicate or why none of
our buildbots caught this. But it makes sense that an INTUSE used in readelf
might cause issues.

Fixed by:

commit 7cf4586e5b429c0fa74d3ae73f49e6cda6660e93
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun Mar 3 00:45:34 2024 +0100

    libdw: Don't use INTUSE in libdwP.h str_offsets_base_off

    readelf.c cheats and include libdwP.h, which is an internal only
    header of libdw. It really shouldn't do that, but there are some
    internals that readelf currently needs. The str_offsets_base_off
    function used by readelf uses INTUSE when calling dwarf_get_units.
    This is a micro optimization useful inside libdw so a public
    function can be called directly, skipping a PLT call. This can
    cause issues linking readelf since it might not be able to call
    the internal function, since readelf.c isn't part of libdw itself.
    Just drop the INTUSE.

            * libdw/libdwP.h (str_offsets_base_off): Don't use INTUSE
            when calling dwarf_get_units.

    Signed-off-by: Mark Wielaard <mark@klomp.org>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-03-02 23:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-02  3:58 [Bug general/31439] New: error: undefined reference to '__dwarf_get_units_internal' rudi at heitbaum dot com
2024-03-02  3:58 ` [Bug general/31439] " rudi at heitbaum dot com
2024-03-02 14:09 ` mark at klomp dot org
2024-03-02 23:04 ` rudi at heitbaum dot com
2024-03-02 23:53 ` mark at klomp dot org

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