I defxk denote that the linker will associate an

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ond, a single copy of the .text section of a shared library in memory can be shared by different running processes. We will explore this in more detail when we study virtual memory in Chapter 10. Figure 7.15 summarizes the dynamic linking process for the example program in Figure 7.6. To build a shared library libvector.so of our example vector arithmetic routines in Figure 7.5, we would invoke the compiler driver with a special directive to the linker: unix> gcc -shared -fPIC -o libvector.so addvec.c multvec.c The -fPIC flag directs the compiler to generate position independent code (more on this in the next section). The -shared flag directs the linker to create a shared object file. main2.c vector.h Translators (cpp, cc1, as) libc.so libvector.so relocatable main2.o Linker (ld) relocation and symbol table info partially linked executable object file p2 Loader (execve) libc.so libvector.so code and data fully linked executable in memory Dynamic linker (ld-linux.so) Figure 7.15: Dynam...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online