This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Shared libraries and PLT using GCC toolchain

Hi all,

I am trying to understand how shared libraries and PLT works. As per my current understanding linking a shared library should output code that calls a function (function from the shared library) by going through the PLT. And the function itself should not be present in the linked output.

For example.

fun.c (Compiled into a shared library)

so.c (main executable)

I am compiling using the following steps.

Complete code is at: https://github.com/rgujju/STM32-projects/tree/master/got_plt

question 1) The output of the above code should not have the function <fun> right? But the output elf file <so.elf> has the function <fun> in it. The call to <fun> and <centry> both go through the plt which I think is correct and the dynamic linker will patch these entries. But why does it contain the function <fun>?

question 2) In the disassembly of the PLT there are instructions which contain a register <ip>. As per my understanding there isnt any register called <ip> in cortex M4. see line 9 and 10 below.

Thank you for your help.

0