C void p2void int main p2 return 0 1 2 3 4 5

This is the end of the preview. Sign up
to
access the rest of the document.

Unformatted text preview: ic linking with shared libraries. Once we have created the library, we would then link it into our example program in Figure 7.6.
unix&gt; gcc -o p2 main2.c ./libvector.so This creates an executable object ﬁle p2 in a form that can be linked with libvector.so at run time. The basic idea is to do some of the linking statically when the executable ﬁle is created, and then complete the linking process dynamically when the program is loaded. It is important to realize that none of the code or data sections from libvector.so are actually copied into the executable p2 at this point. Instead, the linker copies some relocation and symbol table information that will allow references to code and data in libvector.so to be resolved at run time. When the loader loads and runs the executable p2, it loads the partially linked executable p2, using the techniques discussed in Section 7.9. Next, it notices that p2 contains a .interp section, which contains the path name of the dynamic linker, which is itself a shared object (e.g., L...
View Full
Document