2 Determining How to Link Programs or Libraries (Linker Tasks)

You have a great deal of control over how the linker links your program or library by using ld command-line options. This chapter describes the tasks you can perform to determine how programs and libraries must link by using the Compiler commands and Linker commands.

“Using the Compiler to Link” (page 28)

“Changing the Default Library Search Path with -Wl,-L (page 28)

“Getting Verbose Output with -v” (page 29)

“Passing Linker Options from the Compiler Command with -Wl” (page 29)

“Renaming the Output File with -o” (page 29)

“Specifying Libraries with -l” (page 29)

“Suppressing the Link-Edit Phase with -c” (page 30)

“Using Linker Commands” (page 30)

“Linking with the crt0.o Startup File” (page 30)

“Changing the Default Library Search Path with -L, LPATH, and $ORIGIN” (page 30)

“Using $ORIGIN” (page 31)

“Changing the Default Shared Library Binding with -B” (page 32)

“Improving Shared Library Performance with -B symbolic” (page 34)

“Choosing Archive or Shared Libraries with -a” (page 36)

“Linking Shared Libraries with -dynamic” (page 36)

“Linking Archived Libraries with -noshared” (page 37)

“Exporting Symbols with +e” (page 37)

“Exporting Symbols with +ee” (page 38)

“Exporting Symbols from main with -E” (page 38)

“Hiding Symbols from Export with +hideallsymbols” (page 39)

“Hiding Symbols with -h” (page 39)

“ Not Recording Link Time Paths with +nodefaultrapth” (page 41)

“Moving Libraries after Linking with +b” (page 41)

“Moving Libraries After Linking with +s and SHLIB_PATH” (page 43)

“Ignoring Dynamic Path Environment Variables with +noenvvar” (page 43)

“Controlling Archive Library Loading with +[no]forceload” (page 44)

“Passing Linker Options in a file with -c” (page 44)

“Passing Linker Options with LDOPTS” (page 44)

27

Page 27
Image 27
HP UX Software Transition Kit (STK) manual Determining How to Link Programs or Libraries Linker Tasks