Callgraph

Asked by xol

Hi,
I'm compiling a project with wolfssl open source library. Due to my wrong configurations of the library compilation defines I get an undefined references to functions like _getpid, _abort and some others at the linking stage. I'm trying to get rid of it.

I can't find in source code direct calls to mentioned functions. More likely they are called from some stdlib functions that my code is calling. But to find out how do I reach calls to above functions I need some call tree.

I have found a --calgraph option but it seams not to be supported in GNU ARM, right?
What other options can you suggest to find out how these functions are reached and thus to understand how to eliminate it.

Thanks a lot.

Question information

Language:
English Edit question
Status:
Answered
For:
GNU Arm Embedded Toolchain Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#1

Hi Xol,

You can use arm-none-eabi-readlef -a on the library. You will have several blocks, one for each file in the library. This will already allow you to narrow down to a particular file. Then the entries with the name of interest (eg. _getpid) will have an offset that indicates where is the undefined reference in the object file. You can then just use arm-none-eabi-objdump -d to find what function is at this address.

Best regards.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#2

I meant arm-none-eabi-readelf

Revision history for this message
xol (dimax-main) said :
#3

Hi,
Thanks for help but this is still not complete.
Inside my library there are no direct calls to _getpid. More likely _getpid is called from one of the standard C libraries. So readelf provides no references to _getpid if I run it on my library file.

Is where any way to build and link my library together with standard C library so that all library calls to stdlib functions would be already linked into library file. In this case I hope to see calls to _getpid.

My other option is to make the whole project and provide some dummy file with body of _getpid to make linker satisfied and let him generate ELF file. After that run readelf and catch the references to my dummy _getpid.

What do you think?

Revision history for this message
xol (dimax-main) said :
#4

OK, I did what I sad and finally had found out that undefined references are coming from unwind functions. Adding -fno-unwind-tables elliminate that references. If you can please explain me what is the unwind-tables functionality?

But now I face another problem:

c:/arm_gcc/5.2_2015q4/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld.exe: section .ARM.exidx loaded at [08073010,08073017] overlaps section .data loaded at [08073010,08073643]

Can you please tell me what is the .ARM.exidx section and how to get rid of it. Temporary I have changed my linker script to discard this section.

Thanks.

Revision history for this message
xol (dimax-main) said :
#5

I have posted a number of comments and quest. Will they be addressed? Thanks.

Sent from my Brain

> On Oct 29, 2016, at 08:13, xol <email address hidden> wrote:
>
> Your question #403575 on GNU ARM Embedded Toolchain changed:
> https://answers.launchpad.net/gcc-arm-embedded/+question/403575
>
> Status: Answered => Open
>
> You are still having a problem:
> Hi,
> Thanks for help but this is still not complete.
> Inside my library there are no direct calls to _getpid. More likely _getpid is called from one of the standard C libraries. So readelf provides no references to _getpid if I run it on my library file.
>
> Is where any way to build and link my library together with standard C
> library so that all library calls to stdlib functions would be already
> linked into library file. In this case I hope to see calls to _getpid.
>
> My other option is to make the whole project and provide some dummy file
> with body of _getpid to make linker satisfied and let him generate ELF
> file. After that run readelf and catch the references to my dummy
> _getpid.
>
> What do you think?
>
> --
> You received this question notification because you asked the question.

Revision history for this message
Thomas Preud'homme (thomas-preudhomme) said :
#6

Hi Xol,

-fno-unwind-tables affects program that use exceptions so if you are building a C application or if you are building a C++ application that does not use any exception disabling unwind-tables should be safe. .ARM.exidx is related to exceptions as well: The ELF for the ARM architecture document says it contains index entries for section unwinding. Again, if you are not using exception discarding it should be safe.

Best regards.

Can you help with this problem?

Provide an answer of your own, or ask xol for more information if necessary.

To post a message you must log in.