Nm tool mess - Unix

This is a discussion on Nm tool mess - Unix ; Problem 1: I am trying nm with object files and i get gcc2_compiled. in the third column in many files its like : nm -r objfile : .. .. .. 00000000 t gcc2_compiled. ... .. (although thr is no gcc2_compiled. ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: Nm tool mess

  1. Nm tool mess

    Problem 1:
    I am trying nm with object files and i get gcc2_compiled. in the
    third column in many files
    its like :
    nm -r objfile :
    ..
    ..
    ..
    00000000 t gcc2_compiled.
    ...
    ..
    (although thr is no gcc2_compiled. func in the source file)

    i also get entries like :

    00000080 t .label.0.00002.00000.00001

    with these exceptions i am getting all the undefined and defined
    functions when i grep T or t or U

    Problem 2:
    although functions are say A ,B ,C , in the nm ouput with -r option
    (and in other options also) i get an _ before the function name ..as in
    _A,_B,_C .Why this comes with some C files ?And how do i differentiate
    if a func is of the form _A in the source C file versus A in the source
    file?


  2. Re: Nm tool mess

    "jeniffer" writes:

    > Problem 1:
    > I am trying nm with object files and i get gcc2_compiled. in the
    > third column in many files


    Why is this a problem?
    You may wish to read this:
    http://www.catb.org/~esr/faqs/smart-questions.html

    > (although thr is no gcc2_compiled. func in the source file)


    The *object* itself is compiled with gcc (or g++), and gcc inserts
    that symbol.

    > Problem 2:
    > although functions are say A ,B ,C , in the nm ouput with -r option
    > (and in other options also) i get an _ before the function name ..as in
    > _A,_B,_C


    Why is this a problem?

    > Why this comes with some C files?


    It should either be the case for all C files, or for none.

    Traditionally, C symbols had _ prepended to them, so they could be
    distinguished from (and called from) functions defined in assembly.

    COFF platforms (such as Wi32) continue that tradition, but ELF
    platforms abandoned it.

    > And how do i differentiate
    > if a func is of the form _A in the source C file


    It will be named __A in the nm output.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

  3. Re: Nm tool mess


    Paul Pluzhnikov wrote:

    > "jeniffer" writes:
    >
    > > Problem 1:
    > > I am trying nm with object files and i get gcc2_compiled. in the
    > > third column in many files

    >
    > Why is this a problem?
    > You may wish to read this:
    > http://www.catb.org/~esr/faqs/smart-questions.html
    >
    > > (although thr is no gcc2_compiled. func in the source file)

    >
    > The *object* itself is compiled with gcc (or g++), and gcc inserts
    > that symbol.
    >
    > > Problem 2:
    > > although functions are say A ,B ,C , in the nm ouput with -r option
    > > (and in other options also) i get an _ before the function name ..as in
    > > _A,_B,_C

    >
    > Why is this a problem?
    >
    > > Why this comes with some C files?

    >
    > It should either be the case for all C files, or for none.
    >
    > Traditionally, C symbols had _ prepended to them, so they could be
    > distinguished from (and called from) functions defined in assembly.
    >
    > COFF platforms (such as Wi32) continue that tradition, but ELF
    > platforms abandoned it.
    >
    > > And how do i differentiate
    > > if a func is of the form _A in the source C file

    >
    > It will be named __A in the nm output.
    >
    > Cheers,
    > --
    > In order to understand recursion you must first understand recursion.
    > Remove /-nsp/ for email.





    The corresponding source code of the object files is in C and in
    assembly..Is this because of this that I get functions some functions
    that have _ pre appended and some which have not ? Also I have symbols
    like _ksymtab_ , _kstrtab and other symbols pre-appended to the
    function names .How do i extract pure function names from nm output?


  4. Re: Nm tool mess

    "jeniffer" writes:

    > The corresponding source code of the object files is in C and in
    > assembly..Is this because of this that I get functions some functions
    > that have _ pre appended and some which have not ?


    Probably.

    > Also I have symbols
    > like _ksymtab_ , _kstrtab and other symbols pre-appended to the
    > function names .


    And your question about _ksymtab and _kstrtab is?

    > How do i extract pure function names from nm output?


    What is a "pure function name" ?

    If you are on COFF platform (would it kill you to actually *say*
    which platform you are on?), and if the function came from "C" file,
    then you strip one underscore to get the name of the function as
    it appears in the C source.

    You really ought to read the "smart-questions" reference I gave you.
    You may also wish to describe the problem you are actually trying
    to solve, rather then asking a sequence of seemingly pointless
    questions. And please don't multi-post.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread