public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* objdump --syms output
@ 2007-09-05 16:18 Nameer Yarkon
  2007-09-07 14:42 ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Nameer Yarkon @ 2007-09-05 16:18 UTC (permalink / raw)
  To: binutils

Hello All,

I'm trying to understand the output of objdump --syms.
True, as the manpage says, it is similar to nm's output,
but it uses different representations. I can guess some,
but not all. for example, i guess that "g" is global, and it probably
like nm's uppercase letters (i.e. T). likewise "l" is probably local.

But - is there a concise manual for this ?
Even nm has a nice explanations for its letters - inside the manpage itself,
but objdump seems to lack any...

(I'm mainly interested in --syms (which is -t))

Thank You !
Nameer

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

* Re: objdump --syms output
  2007-09-05 16:18 objdump --syms output Nameer Yarkon
@ 2007-09-07 14:42 ` Nick Clifton
  2007-09-07 14:59   ` Nameer Yarkon
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2007-09-07 14:42 UTC (permalink / raw)
  To: Nameer Yarkon; +Cc: binutils

Hi Nameer,

> I'm trying to understand the output of objdump --syms.
> True, as the manpage says, it is similar to nm's output,
> but it uses different representations. I can guess some,
> but not all. for example, i guess that "g" is global, and it probably
> like nm's uppercase letters (i.e. T). likewise "l" is probably local.
> 
> But - is there a concise manual for this ?

No :-(

> Even nm has a nice explanations for its letters - inside the manpage itself,
> but objdump seems to lack any...

True.  The objdump manpage does mention nm program, but it should place more 
emphasis on the fact that the description of the letters can be found there.

In theory however nm and objdump should be using the same single letter 
abbreviations.  Is there a case where you think that they do not ?

Cheers
   Nick

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

* Re: objdump --syms output
  2007-09-07 14:42 ` Nick Clifton
@ 2007-09-07 14:59   ` Nameer Yarkon
  2007-09-07 16:54     ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Nameer Yarkon @ 2007-09-07 14:59 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick,

On 9/7/07, Nick Clifton <nickc@redhat.com> wrote:
> > I'm trying to understand the output of objdump --syms.
> > Even nm has a nice explanations for its letters - inside the manpage itself,
> > but objdump seems to lack any...
>
> True.  The objdump manpage does mention nm program, but it should place more
> emphasis on the fact that the description of the letters can be found there.

Sorry, but no, it can not.

> In theory however nm and objdump should be using the same single letter
> abbreviations.  Is there a case where you think that they do not ?

Unfortunately they use utterly different letter abbreviations. It is
so different
that one cannot understand it. please, try for yourself.
Here is a simple example (just compiled an empty main):
nm yields:
00000000 T main
while objdump -t yields:
00000000 g     F .text  00000019 main

So here it is simple (i guess that 'g' stands for global ?)
but there are more complex cases...
oh and even here I don't know what 'F' is ?

Do you know all of objdump's letter abbr. ? or maybe one can find them in
the source itself ?

thank you !
nameer

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

* Re: objdump --syms output
  2007-09-07 14:59   ` Nameer Yarkon
@ 2007-09-07 16:54     ` Nick Clifton
  2007-09-07 18:56       ` Nameer Yarkon
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2007-09-07 16:54 UTC (permalink / raw)
  To: Nameer Yarkon; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 3467 bytes --]

Hi Nameer,

> Unfortunately they use utterly different letter abbreviations. It is
> so different

*sigh* You are right and I am wrong.  I really should have checked the output 
of the two programs before writing my original reply.

Oh well, I am attaching a patch to add some documentation about objdump --sym's 
output.  What do you think of it ?  Does it help ?

To save you some time, here is the relevant section from the objdump manpage:

        -t
        --syms
            Print the symbol table entries of the file.  This is similar to the
            information provided by the nm program, although the display format
            is different.  The format of the output depends upon the format  of
            the  file  being  dumped,  but there are two main types.  One looks
            like this:

                    [  4](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
                    [  6](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 fred

            where the number inside the square brackets is the  number  of  the
            entry  in  the  symbol table, the sec number is the section number,
            the fl value are the symbol's flag bits, the ty number is the  sym-
            bol's type, the scl number is the symbol's storage class and the nx
            value is the number of auxiliary entries associated with  the  sym-
            bol.  The last two fields are the symbol's value and its name.

            The  other common output format, usually seen with ELF based files,
            looks like this:

                    00000000 l    d  .bss   00000000 .bss
                    00000000 g       .text  00000000 fred

            Here the first number is the symbol's value (sometimes  referred  to
            as  its  address).   The next field is actually a set of characters
            and spaces indicating the flag bits that are  set  on  the  symbol.
            These  characters  are  described below.  The next field is another
            number associated with the symbol, which for common symbols is  the
            alignment  and  for other symbol is the size.  Finally the symbol's
            name is displayed.

            The flag characters are divided into 7 groups as follows:

            "l"
            "g"
            "!" The symbol is local (l), global (g), neither (a space) or  both
                (!).   A symbol can be neither local or global for a variety of
                reasons, eg because it is used for debugging, but it is  proba-
                bly an indication of a bug if it is ever both local and global.
          "w" The symbol is weak (w) or strong (a space).

            "C" The symbol denotes a constructor (C) or an ordinary  symbol  (a
                space).

            "W" The  symbol  is  a warning (W) or a normal symbol (a space).  A
                warning symbol's name is a message to be displayed if the  sym-
                bol following the warning symbol is ever referenced.

            "I" The  symbol is an indirect reference to another symbol (I) or a
                normal symbol (a space).

            "d"
            "D" The symbol is a debugging symbol (d) or a dynamic symbol (D) or
                a normal symbol (a space).

            "F"
            "f"
            "O" The  symbol  is  the name of a function (f) or a file (F) or an
                object (O) or just a normal symbol (a space).

Cheers
   Nick

[-- Attachment #2: binutils.texi.patch.bz2 --]
[-- Type: application/x-bzip2, Size: 2161 bytes --]

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

* Re: objdump --syms output
  2007-09-07 16:54     ` Nick Clifton
@ 2007-09-07 18:56       ` Nameer Yarkon
  2007-09-17 11:40         ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Nameer Yarkon @ 2007-09-07 18:56 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick,

On 9/7/07, Nick Clifton <nickc@redhat.com> wrote:
> Oh well, I am attaching a patch to add some documentation about objdump --sym's
> output.  What do you think of it ?  Does it help ?

Wow, Of course it does, thank you so much !

a few comments:

>            The  other common output format, usually seen with ELF based files,
>            looks like this:
>
>                    00000000 l    d  .bss   00000000 .bss
>                    00000000 g       .text  00000000 fred
>
>            Here the first number is the symbol's value (sometimes  referred  to
>            as  its  address).   The next field is actually a set of characters
>            and spaces indicating the flag bits that are  set  on  the  symbol.
>            These  characters  are  described below.  The next field is another

before that, there is the section name field. about that field, btw,
can you please
tell what does "*ABS*" stands for ?

>            number associated with the symbol, which for common symbols is  the
>            alignment  and  for other symbol is the size.  Finally the symbol's
>            name is displayed.
>
>            The flag characters are divided into 7 groups as follows:
>
>            "l"
>            "g"
>            "!" The symbol is local (l), global (g), neither (a space) or  both
>                (!).   A symbol can be neither local or global for a variety of
>                reasons, eg because it is used for debugging, but it is  proba-
>                bly an indication of a bug if it is ever both local and global.
>          "w" The symbol is weak (w) or strong (a space).
>
>            "C" The symbol denotes a constructor (C) or an ordinary  symbol  (a
>                space).
>
>            "W" The  symbol  is  a warning (W) or a normal symbol (a space).  A
>                warning symbol's name is a message to be displayed if the  sym-
>                bol following the warning symbol is ever referenced.
>
>            "I" The  symbol is an indirect reference to another symbol (I) or a
>                normal symbol (a space).
>
>            "d"
>            "D" The symbol is a debugging symbol (d) or a dynamic symbol (D) or
>                a normal symbol (a space).
>
>            "F"
>            "f"
>            "O" The  symbol  is  the name of a function (f) or a file (F) or an
>                object (O) or just a normal symbol (a space).

I'm not sure about that. compiling that empty-main program yields the main
symbol with an "F" flag (obviously main is the name of a function, not
a file). btw,
the empty symbol whose section is *ABS* is marked with "f". I really can't
tell what that is.

Thank you so much for this help, really. I hope it gets into the next version
of binutils, too !

nameer
>
> Cheers
>   Nick
>
>

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

* Re: objdump --syms output
  2007-09-07 18:56       ` Nameer Yarkon
@ 2007-09-17 11:40         ` Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2007-09-17 11:40 UTC (permalink / raw)
  To: Nameer Yarkon; +Cc: binutils

Hi Nameer,

  [Sorry for the delay in replying.  I have been on holiday].

> before that, there is the section name field. about that field, 

Oops, yes, good point.

 > btw, can you please tell what does "*ABS*" stands for ?

*ABS* means that the symbol is absolute, ie it is not assigned to a particular 
section.  Most symbols are associated with a section, and their value should be 
interpreted as being relative to the start of that section.  Absolute symbols 
have no section associated with them and their value is not biased by the start 
address of any section.

The other fake section name that can occur here is *UND* which means that the 
symbol is referenced in the file being dumped, but not defined there.  Hence 
the section associated with the symbol (or its absolute-ness) is not known.

>>            "F"
>>            "f"
>>            "O" The  symbol  is  the name of a function (f) or a file (F) or an
>>                object (O) or just a normal symbol (a space).
> 
> I'm not sure about that. compiling that empty-main program yields the main
> symbol with an "F" flag (obviously main is the name of a function, not
> a file).

Ah, this would be what is known as a typo.  I had the 'F' and 'f' descriptions 
swapped around.  Doh!

I will apply the patch with both of these problems fixed.  Thanks very much for 
raising this point.

Cheers
   Nick

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-05 16:18 objdump --syms output Nameer Yarkon
2007-09-07 14:42 ` Nick Clifton
2007-09-07 14:59   ` Nameer Yarkon
2007-09-07 16:54     ` Nick Clifton
2007-09-07 18:56       ` Nameer Yarkon
2007-09-17 11:40         ` Nick Clifton

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