8
Contents
4. Linker Tools
Changing a Program's Attributes with chatr(1). . . . . . . . . . . . . . . . . . 104
Using chatr for 32-bit Program Attributes . . . . . . . . . . . . . . . . . . . . 104
Using chatr for 64-bit Program Attributes . . . . . . . . . . . . . . . . . . . . 105
Viewing Symbols in an Object file with nm(1) . . . . . . . . . . . . . . . . . . . 107
Viewing the Contents of an Object File with elfdump(1) . . . . . . . . . . . 111
Viewing library dependencies with ldd(1). . . . . . . . . . . . . . . . . . . . . . . 113
Viewing the Size of Object File Elements with size(1). . . . . . . . . . . . . 115
Reducing Storage Space with strip(1). . . . . . . . . . . . . . . . . . . . . . . . . . 116
Improving Program Start-up with fastbind(1) . . . . . . . . . . . . . . . . . . . 118
Finding Object Library Ordering Relationships with lorder(1). . . . . . 120
5. Creating and Using Libraries
Overview of Shared and Archive Libraries. . . . . . . . . . . . . . . . . . . . . . 122
What are Archive Libraries? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
What are Shared Libraries? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
The Dynamic Loader dld.sl. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Default Behavior When Searching for Libraries at Run Time. . . . . 127
Caution on Using Dynamic Library Searching . . . . . . . . . . . . . . . . . 127
Example Program Comparing Shared and Archive Libraries. . . . . . . 128
Shared Libraries with Debuggers, Profilers, and Static Analysis. . . . 130
Creating Archive Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Overview of Creating an Archive Library . . . . . . . . . . . . . . . . . . . . . 131
Contents of an Archive File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Example of Creating an Archive Library. . . . . . . . . . . . . . . . . . . . . . 133
Replacing, Adding, and Deleting an Object Module . . . . . . . . . . . . . 134