objdump -r a.o not giving static function call - Unix

This is a discussion on objdump -r a.o not giving static function call - Unix ; $ cat a.c #include static void abc() { printf("hi"); } extern void pqr() { printf("hello"); } void f_called() { printf("df"); } void f_not_called() { printf("\nnt"); } void Func_calling_static() { abc(); } int main() { abc(); pqr(); f_called(); return 0; } ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: objdump -r a.o not giving static function call

  1. objdump -r a.o not giving static function call

    $ cat a.c
    #include

    static void abc()
    {
    printf("hi");
    }

    extern void pqr()
    {
    printf("hello");
    }
    void f_called()
    {
    printf("df");
    }
    void f_not_called()
    {
    printf("\nnt");
    }

    void Func_calling_static()
    {
    abc();
    }

    int main()
    {
    abc();
    pqr();
    f_called();
    return 0;
    }
    -------------
    $ objdump -r a.o

    a.o: file format elf32-i386

    RELOCATION RECORDS FOR [.text]:
    OFFSET TYPE VALUE
    0000000a R_386_32 .rodata
    0000000f R_386_PC32 printf
    00000022 R_386_32 .rodata
    00000027 R_386_PC32 printf
    0000003a R_386_32 .rodata
    0000003f R_386_PC32 printf
    00000052 R_386_32 .rodata
    00000057 R_386_PC32 printf
    0000008f R_386_PC32 pqr
    00000094 R_386_PC32 f_called

    abc() being a static function is not included in the ouptut of objdump
    ....I need to find out all the functions that are called..included
    static ones..Is there any way?


  2. Re: objdump -r a.o not giving static function call

    "jeniffer" writes:

    > $ objdump -r a.o


    > abc() being a static function is not included in the ouptut of objdump
    > ...I need to find out all the functions that are called..included
    > static ones..Is there any way?


    objdump -r shows relocation info. And function calls to static
    functions don't need to be relocated on i386, since there is a fixed,
    compile-time-known offset from the caller to the callee. There is now
    way to list all function calls in an object file. You may use nm(1)
    to see all the symbols defined in the object file. May that helps you
    in what you're trying to do.

    urs

+ Reply to Thread