Rodata unused loaded from the executable file

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: alls member functions in the static libvector.a library. 364 CHAPTER 7. LINKING any further linking at load time. When the linker runs, it determines that the addvec symbol defined by addvec.o is referenced by main.o, so it copies addvec.o into the executable. Since the program doesn’t reference any symbols defined by multvec.o, the linker does not copy this module into the executable. The linker also copies the printf.o module from libc.a, along with a number of other modules from the C run-time system. source files main2.c vector.h Translators (cpp, cc1, as) libvector.a libc.a static libraries relocatable object files main2.o addvec.o Linker (ld) printf.o and any other modules called by printf. o p2 fully linked executable object file Figure 7.7: Linking with static libraries. 7.6.3 How Linkers Use Static Libraries to Resolve References While static libraries are useful and essential tools, they are also a source of confusion to programmers because of the way the Unix linker uses them to resolve external references. During the symbol resolution phase, the linker scans the relocatable object files and archives left to right in the sam...
View Full Document

Ask a homework question - tutors are online