public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [Bug general/25227] New: "eu-nm --extern" skips first symbol
@ 2019-11-27 15:01 ematsumiya at suse dot com
  2019-11-27 21:25 ` [Bug general/25227] " mark at klomp dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ematsumiya at suse dot com @ 2019-11-27 15:01 UTC (permalink / raw)
  To: elfutils-devel

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

            Bug ID: 25227
           Summary: "eu-nm --extern" skips first symbol
           Product: elfutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: general
          Assignee: unassigned at sourceware dot org
          Reporter: ematsumiya at suse dot com
                CC: elfutils-devel at sourceware dot org
  Target Milestone: ---

Reproduction steps:

> # cat example.c
> void *SYM1;
> void *SYM2;
> void *SYM3;
> # gcc -c -std=gnu89 -fstack-protector-all -funsigned-char -fPIC -Wall -Wconversion -Wextra -g -O0 example.c
> # eu-nm --extern example.o
> 
> 
> Symbols from /home/enzo/tmp/eu-nm-bug/example.o:
> 
> Name Value            Class  Type     Size             Line Section
> 
> SYM2|0000000000000008|GLOBAL|OBJECT  |0000000000000008|    |COMMON
> SYM3|0000000000000008|GLOBAL|OBJECT  |0000000000000008|    |COMMON

Expected result:

> Name    Value            Class  Type     Size                   Line Section
> 
> SYM1|0000000000000008|GLOBAL|OBJECT  |0000000000000008|    |COMMON
> SYM2|0000000000000008|GLOBAL|OBJECT  |0000000000000008|    |COMMON
> SYM3|0000000000000008|GLOBAL|OBJECT  |0000000000000008|    |COMMON

i.e. "SYM1" line is not present.

Reverting this change fixes the problem:

commit 66f4c37d497bdde040a33f299b12163f044b1bf2
Author: Ulrich Drepper <drepper@gmail.com>
Date:   Mon Oct 3 15:53:12 2011 -0400

    Fix nm output for sysv format

    Undefined symbols need no address and siz printed.  Avoid the initial
    entry which is no real symbol.  Avoid section symbols.

@@ -808,8 +808,12 @@ show_symbols_sysv (Ebl *ebl, GElf_Word strndx, const char
*fullname,
 #endif

   /* Iterate over all symbols.  */
-  for (cnt = 0; cnt < nsyms; ++cnt)
+  for (cnt = 1; cnt < nsyms; ++cnt)

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
@ 2019-11-27 21:25 ` mark at klomp dot org
  2019-12-09 16:01 ` ematsumiya at suse dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2019-11-27 21:25 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2019-11-27
                 CC|                            |mark at klomp dot org
     Ever confirmed|0                           |1

--- Comment #1 from Mark Wielaard <mark at klomp dot org> ---
Yes, that is odd. Thank for the reproducer.
I think that must be a typo in the patch.
The other formats show_symbols_bsd and show_symbols_posix do start at zero.
And they are all three called with the same nsyms and syms array.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
  2019-11-27 21:25 ` [Bug general/25227] " mark at klomp dot org
@ 2019-12-09 16:01 ` ematsumiya at suse dot com
  2019-12-09 16:48 ` mark at klomp dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ematsumiya at suse dot com @ 2019-12-09 16:01 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #2 from Enzo Matsumiya <ematsumiya at suse dot com> ---
Hi Mark, do you have any updates here? Will you revert that specific part in
commit 66f4c37d497b? Thanks.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
  2019-11-27 21:25 ` [Bug general/25227] " mark at klomp dot org
  2019-12-09 16:01 ` ematsumiya at suse dot com
@ 2019-12-09 16:48 ` mark at klomp dot org
  2020-01-16 18:22 ` ematsumiya at suse dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2019-12-09 16:48 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 12113
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12113&action=edit
test file with symbols for objects/functions global/local TLS/UNIQUE debug,
weak, etc.

> Hi Mark, do you have any updates here?
> Will you revert that specific part in commit 66f4c37d497b? Thanks.

Sorry I got distracted by other things.
Yes, I believe that line should indeed read cnt = 0.

I was just extending your testcase as attached (gcc -g -m32 -c symbols.c) and
noticed some other small issues compared to binutils nm that I wanted to look
at.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (2 preceding siblings ...)
  2019-12-09 16:48 ` mark at klomp dot org
@ 2020-01-16 18:22 ` ematsumiya at suse dot com
  2020-01-16 22:47 ` mark at klomp dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ematsumiya at suse dot com @ 2020-01-16 18:22 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #4 from Enzo Matsumiya <ematsumiya at suse dot com> ---
Ping?

We're looking to roll out this fix internally, but we need upstream to
acknowledge/release it first.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (3 preceding siblings ...)
  2020-01-16 18:22 ` ematsumiya at suse dot com
@ 2020-01-16 22:47 ` mark at klomp dot org
  2020-01-16 22:52 ` mark at klomp dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2020-01-16 22:47 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #5 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Enzo Matsumiya from comment #4)
> Ping?
> 
> We're looking to roll out this fix internally, but we need upstream to
> acknowledge/release it first.

Sorry, I forgot. Like I said in comment #3 I created some testcases and noticed
the output of eu-nm didn't always match binutils nm. I wanted to look deeper
into that but then other stuff came up.

I have pushed the patch to simply fix this issue now:

commit 62e3c37afd5828466f9192bd19217de835a3620f (HEAD -> master)
Author: Mark Wielaard <mark@klomp.org>
Date:   Thu Jan 16 23:33:52 2020 +0100

    nm: Fix nm --external sysv format output.

    Partial revert of commit 66f4c37d497bdde040a33f299b12163f044b1bf2.
    If index zero wasn't a real symbol it has already been filtered out
    in show_symbols so don't skip it in show_symbols_sysv.

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

    Reported-by: Enzo Matsumiya <ematsumiya@suse.com>
    Signed-off-by: Mark Wielaard <mark@klomp.org>

But if you don't mind I'll keep this bug open to remind myself I need to
checkout the other discrepancies with binutils nm.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (4 preceding siblings ...)
  2020-01-16 22:47 ` mark at klomp dot org
@ 2020-01-16 22:52 ` mark at klomp dot org
  2020-01-17  3:13 ` ematsumiya at suse dot com
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2020-01-16 22:52 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #6 from Mark Wielaard <mark at klomp dot org> ---
Created attachment 12215
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12215&action=edit
C source code file defining various different symbol types

Test source file with more symbol types. Compile with gcc -g -c symbols.c

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (5 preceding siblings ...)
  2020-01-16 22:52 ` mark at klomp dot org
@ 2020-01-17  3:13 ` ematsumiya at suse dot com
  2020-03-02 13:57 ` marxin.liska at gmail dot com
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ematsumiya at suse dot com @ 2020-01-17  3:13 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #7 from Enzo Matsumiya <ematsumiya at suse dot com> ---
(In reply to Mark Wielaard from comment #5)
> I have pushed the patch to simply fix this issue now:
> 
> commit 62e3c37afd5828466f9192bd19217de835a3620f (HEAD -> master)

Ok, great. Thanks a lot.

> But if you don't mind I'll keep this bug open to remind myself I need to
> checkout the other discrepancies with binutils nm.

Sure, no problem at all.

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (6 preceding siblings ...)
  2020-01-17  3:13 ` ematsumiya at suse dot com
@ 2020-03-02 13:57 ` marxin.liska at gmail dot com
  2020-03-02 14:03 ` mark at klomp dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: marxin.liska at gmail dot com @ 2020-03-02 13:57 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #8 from Martin Liška <marxin.liska at gmail dot com> ---
Can the bug be closed?

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (7 preceding siblings ...)
  2020-03-02 13:57 ` marxin.liska at gmail dot com
@ 2020-03-02 14:03 ` mark at klomp dot org
  2020-06-06 23:17 ` mark at klomp dot org
  2020-06-10 10:17 ` mark at klomp dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2020-03-02 14:03 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #9 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Martin Liška from comment #8)
> Can the bug be closed?

No sorry, see comment #3 and comment #5

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (8 preceding siblings ...)
  2020-03-02 14:03 ` mark at klomp dot org
@ 2020-06-06 23:17 ` mark at klomp dot org
  2020-06-10 10:17 ` mark at klomp dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2020-06-06 23:17 UTC (permalink / raw)
  To: elfutils-devel

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

--- Comment #10 from Mark Wielaard <mark at klomp dot org> ---
Proposed patch:
https://sourceware.org/pipermail/elfutils-devel/2020q2/002713.html

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

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

* [Bug general/25227] "eu-nm --extern" skips first symbol
  2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
                   ` (9 preceding siblings ...)
  2020-06-06 23:17 ` mark at klomp dot org
@ 2020-06-10 10:17 ` mark at klomp dot org
  10 siblings, 0 replies; 12+ messages in thread
From: mark at klomp dot org @ 2020-06-10 10:17 UTC (permalink / raw)
  To: elfutils-devel

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

Mark Wielaard <mark at klomp dot org> changed:

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

--- Comment #11 from Mark Wielaard <mark at klomp dot org> ---
commit 76ff94dce7ee8dd88c502bc0bbfc8dea15efea5b
Author: Mark Wielaard <mark@klomp.org>
Date:   Sun Jun 7 01:02:52 2020 +0200

    nm: Explicitly print weak 'V' or 'T' and common 'C' symbols.

    Mimic binutils nm for bsd and posix formats which uses 'V' for weak
    symbols, 'C' for common symbols and 'T' for weak functions. Also fix
    some formatting issues. Don't print undefined addresses as zeros, but
    make sure there is enough padding instead. Just print UNIQUE for
    GNU_UNIQUE to make it fit 6 chars, like other binding names in sysv
    format.

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

    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] 12+ messages in thread

end of thread, other threads:[~2020-06-10 10:17 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 15:01 [Bug general/25227] New: "eu-nm --extern" skips first symbol ematsumiya at suse dot com
2019-11-27 21:25 ` [Bug general/25227] " mark at klomp dot org
2019-12-09 16:01 ` ematsumiya at suse dot com
2019-12-09 16:48 ` mark at klomp dot org
2020-01-16 18:22 ` ematsumiya at suse dot com
2020-01-16 22:47 ` mark at klomp dot org
2020-01-16 22:52 ` mark at klomp dot org
2020-01-17  3:13 ` ematsumiya at suse dot com
2020-03-02 13:57 ` marxin.liska at gmail dot com
2020-03-02 14:03 ` mark at klomp dot org
2020-06-06 23:17 ` mark at klomp dot org
2020-06-10 10:17 ` 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).