Kenwood HP 9000 User manual

Category
Software manuals
Type
User manual
HP-UX Linker and Libraries User's Guide
HP 9000 Computers
B2355-90655
November 1997
© Copyright 1997 Hewlett-Packard Company. All rights reserved.
2
Legal Notices
The information contained in this document is subject to change without
notice.
Hewlett-Packard makes no warranty of any kind with regard to this
manual, including, but not limited to, the implied warranties of
merchantability and fitness for a particular purpose. Hewlett-Packard
shall not be liable for errors contained herein or direct, indirect, special,
incidental or consequential damages in connection with the furnishing,
performance, or use of this material.
Copyright © 1997 Hewlett-Packard Company.
This document contains information which is protected by copyright. All
rights are reserved. Reproduction, adaptation, or translation without
prior written permission is prohibited, except as allowed under the
copyright laws.
Corporate Offices:
Hewlett-Packard Co.
3000 Hanover St.
Palo Alto, CA 94304
Use, duplication or disclosure by the U.S. Government Department of
Defense is subject to restrictions as set forth in paragraph (b)(3)(ii) of the
Rights in Technical Data and Software clause in FAR 52.227-7013.
Rights for non-DOD U.S. Government Departments and Agencies are as
set forth in FAR 52.227-19(c)(1,2).
Use of this manual and flexible disc(s), compact disc(s), or tape
cartridge(s) supplied for this pack is restricted to this product only.
Additional copies of the programs may be made for security and back-up
purposes only. Resale of the programs in their present form or with
alterations, is expressly prohibited.
A copy of the specific warranty terms applicable to your Hewlett-Packard
product and replacement parts can be obtained from your local Sales and
Service Office.
© Copyright 1980, 1984, 1986 AT&T Technologies, Inc. UNIX and
System V are registered trademarks of AT&T in the USA and other
countries.
3
UNIX is a registered trademark in the United States and other
countries, licensed exclusively through X/Open Company Limited.
© Copyright 1979, 1980, 1983, 1985-1990 Regents of the University of
California. This software is based in part on the Fourth Berkeley
Software Distribution under license from the Regents of the University
of California.
Copyright © The Regents of the University of Colorado, a body corporate
1979
This document has been reproduced and modified with the permission of
the Regents of the University of Colorado, a body corporate.
PostScript is a trademark of Adobe Systems, Inc.
Intel is a registered trademark and Intel 80386 is a trademark of Intel
Corporation.
Ethernet is a trademark of Xerox Corporation.
© Copyright 1985-1986, 1988 Massachussetts Institute of Technology. X
Window System is a trademark of the Massachussetts Institute of
Technology.
MS-DOS and Microsoft are U.S. registered trademarks of Microsoft
Corporation.
OSF/Motif is a trademark of the Open Software Foundation, Inc. in the
U.S. and other countries. Certification for conformance with OSF/Motif
user environment pending.
4
Contents
5
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Printing History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
1. What's New in Recent Releases
PA-RISC Changes in Hardware Compatibility . . . . . . . . . . . . . . . . . . . .21
PA-RISC 2.0 Compatibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
PA-RISC Architectures and Their System Models. . . . . . . . . . . . . . . .22
64-bit Mode Linker Toolset Compatibility with De Facto Industry
Standards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
64-bit Mode ELF Object File Format . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
New Features for 64-bit Mode Linking. . . . . . . . . . . . . . . . . . . . . . . . . . .25
64-bit Mode Linker Options. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
64-bit Mode Linker-defined Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . .26
64-bit Mode Link-time Differences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
64-bit Mode Run Time Differences. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
Changes in Future Releases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .32
Online Help for Linker and Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Accessing Help with ld +help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33
Accessing Help with the HP CDE Front Panel. . . . . . . . . . . . . . . . . . .33
Accessing Help with the dthelpview Command . . . . . . . . . . . . . . . . . .33
Accessing Help with the charhelp Command. . . . . . . . . . . . . . . . . . . .33
2. What Happens When You Compile and Link a Program
Compiling Programs on HP-UX:
An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
Looking “inside” a Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .38
What is an Object File? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
Local Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40
6
Contents
Global Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
External References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Compiler-Linker Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Linking Programs on HP-UX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
The crt0.o Startup File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
The a.out File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
File Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Linking with Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Library Naming Conventions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Default Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
The Default Library Search Path. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Link Order. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Running the Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Loading Programs: exec . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Binding Routines to a Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Deferred Binding is the Default. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Linker Thread-Safe Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3. Linker Tasks
Using the Compiler to Link. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Changing the Default Library Search Path with -Wl, -L . . . . . . . . . . 53
Getting Verbose Output with -v . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Passing Linker Options from the Compiler Command with -Wl . . . . 54
Renaming the Output File with -o. . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Specifying Libraries with -l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Suppressing the Link-Edit Phase with -c . . . . . . . . . . . . . . . . . . . . . . 55
Using Linker commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Linking with the 32-bit crt0.o Startup File. . . . . . . . . . . . . . . . . . . . . 57
Changing the Default Library Search Path with -L and LPATH. . . . 57
Contents
7
Changing the Default Shared Library Binding with -B. . . . . . . . . . . .58
Improving Shared Library Performance with -B symbolic . . . . . . . . .60
Choosing Archive or Shared Libraries with -a . . . . . . . . . . . . . . . . . . .63
Dynamic Linking with -A and -R. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .65
Exporting Symbols with +e . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79
Exporting Symbols with +ee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
Exporting Symbols from main with -E . . . . . . . . . . . . . . . . . . . . . . . . .81
Hiding Symbols with -h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81
Moving Libraries after Linking with +b . . . . . . . . . . . . . . . . . . . . . . . .84
Moving Libraries After Linking with +s and SHLIB_PATH. . . . . . . .86
Passing Linker Options in a file with -c . . . . . . . . . . . . . . . . . . . . . . . .86
Passing Linker Options with LDOPTS. . . . . . . . . . . . . . . . . . . . . . . . .87
Specifying Libraries with -l and l:. . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Stripping Symbol Table Information from the Output File with -s and
-x . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89
Using 64-bit Mode Linker Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90
Using the 64-bit Mode Linker with +compat or +std. . . . . . . . . . . . . .90
Linking Shared Libraries with -dynamic . . . . . . . . . . . . . . . . . . . . . . .93
Linking Archived Libraries with -noshared . . . . . . . . . . . . . . . . . . . . .93
Controlling Archive Library Loading with +[no]forceload. . . . . . . . . .93
Flagging Unsatisfied Symbols with +[no]allowunsats. . . . . . . . . . . . .94
Hiding Symbols from export with +hideallsymbols . . . . . . . . . . . . . . .95
Changing Mapfiles with -k and +nodefaultmap. . . . . . . . . . . . . . . . . .95
Ignoring Dynamic Path Environment Variables with +noenvvar. . . .96
Linking in 64-bit Mode with +std . . . . . . . . . . . . . . . . . . . . . . . . . . . . .96
Linking in 32-bit Mode Style with +compat . . . . . . . . . . . . . . . . . . . . .96
Controlling Output from the Unwind Table with +stripwind . . . . . . .96
Selecting Verbose Output with +vtype . . . . . . . . . . . . . . . . . . . . . . . . .97
Linking with the 64-bit crt0.o Startup File . . . . . . . . . . . . . . . . . . . . .98
Linker Compatibility Warnings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .99
Linking to Archive Libraries with Unsatisfied Symbols . . . . . . . . . .100
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
Contents
9
Summary of Keys to the ar(1) Command . . . . . . . . . . . . . . . . . . . . . .135
crt0.o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136
Archive Library Location. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136
Creating Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .138
Creating Position-Independent Code (PIC). . . . . . . . . . . . . . . . . . . . .138
Creating the Shared Library with ld. . . . . . . . . . . . . . . . . . . . . . . . . .139
Shared Library Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .140
Updating a Shared Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
Shared Library Location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .144
Improving Shared Library Performance. . . . . . . . . . . . . . . . . . . . . . .145
Version Control with Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . .149
When to Use Shared Library Versioning . . . . . . . . . . . . . . . . . . . . . .149
Maintaining Old Versions of Library Modules . . . . . . . . . . . . . . . . . .150
Library-Level Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .150
Intra-Library Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .154
Switching from Archive to Shared Libraries . . . . . . . . . . . . . . . . . . . . .158
Library Path Names. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .158
Relying on Undocumented Linker Behavior. . . . . . . . . . . . . . . . . . . .158
Absolute Virtual Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .159
Stack Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
Version Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .160
Debugger Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
Using the chroot Command with Shared Libraries . . . . . . . . . . . . . .161
Profiling Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .161
Summary of HP-UX Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .162
Caution When Mixing Shared and Archive Libraries. . . . . . . . . . . . . .164
Example 1: Unsatisfied Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . .164
Example 2: Using shl_load(3X) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .167
Example 3: Hidden Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .171
Summary of Mixing Shared and Archive Libraries . . . . . . . . . . . . . .175
10
Contents
Using Shared Libraries in 64-bit mode. . . . . . . . . . . . . . . . . . . . . . . . . 176
Internal Name Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
Dynamic Path Searching for Shared Libraries . . . . . . . . . . . . . . . . . 177
Shared Library Symbol Binding Semantics . . . . . . . . . . . . . . . . . . . 178
Mixed Mode Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
64-bit Mode Library Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
6. Shared Library Management Routines
Shared Library Management Routine Summaries . . . . . . . . . . . . . . . 196
The shl_load Routine Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
The dlopen Routines Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
Related Files and Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
Shared Library Header Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Using Shared Libraries with cc and ld Options . . . . . . . . . . . . . . . . . . 200
Initializers for Shared Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
Styles of Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
32-bit Mode Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
64-bit Mode Initializers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
The shl_load Shared Library Management Routines . . . . . . . . . . . . . 215
The shl_load and cxxshl_load Routines. . . . . . . . . . . . . . . . . . . . . . . 215
The shl_findsym Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
The shl_get and shl_get_r Routines. . . . . . . . . . . . . . . . . . . . . . . . . . 226
The shl_gethandle and shl_gethandle_r Routines . . . . . . . . . . . . . . 230
The shl_definesym Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
The shl_getsymbols Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
The shl_unload and cxxshl_unload Routines . . . . . . . . . . . . . . . . . . 238
The dlopen Shared Library Management Routines. . . . . . . . . . . . . . . 240
The dlopen Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
The dlerror Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
Contents
11
The dlsym Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .245
The dlget Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .248
The dlmodinfo Routine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .249
The dlgetname Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .252
The dlclose Routine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
Dynamic Loader Compatibility Warnings . . . . . . . . . . . . . . . . . . . . . . .256
Unsupported Shared Library Management Routines . . . . . . . . . . . .256
Unsupported Shared Library Management Flags . . . . . . . . . . . . . . .256
7. Position-Independent Code
What Is Relocatable Object Code? . . . . . . . . . . . . . . . . . . . . . . . . . . . . .260
What is Absolute Object Code?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261
What Is Position-Independent Code? . . . . . . . . . . . . . . . . . . . . . . . . . . .262
Generating Position-Independent Code . . . . . . . . . . . . . . . . . . . . . . . . .263
For More Information: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .264
PIC Requirements for Compilers and Assembly Code. . . . . . . . . . . .264
Long Calls. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .265
Long Branches and Switch Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . .265
Assigned GOTO Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .266
Literal References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .266
Global and Static Variable References . . . . . . . . . . . . . . . . . . . . . . . .267
Procedure Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .267
8. Ways to Improve Performance
Linker Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .270
Invoking Linker Optimizations from the Compile Line. . . . . . . . . . .270
Incompatibilities with other Options . . . . . . . . . . . . . . . . . . . . . . . . .271
Unused Procedure Elimination with +Oprocelim. . . . . . . . . . . . . . . .271
Options to Improve TLB Hit Rates. . . . . . . . . . . . . . . . . . . . . . . . . . . . .273
12
Contents
Profile-Based Optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
General Information about PBO . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Using PBO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
When to Use PBO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
How to Use PBO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
Instrumenting (+I/-I). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
Profiling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Optimizing Based on Profile Data (+P/-P). . . . . . . . . . . . . . . . . . . . . 283
Selecting an Optimization Level with PBO. . . . . . . . . . . . . . . . . . . . 285
Using PBO to Optimize Shared Libraries . . . . . . . . . . . . . . . . . . . . . 286
Using PBO with ld -r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Restrictions and Limitations of PBO. . . . . . . . . . . . . . . . . . . . . . . . . 288
Compatibility with 9.0 PBO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
Improving Shared Library Start-Up Time with fastbind . . . . . . . . . . 293
Using fastbind. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Invoking the fastbind Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
Invoking fastbind from the Linker. . . . . . . . . . . . . . . . . . . . . . . . . . . 294
How to Tell if fastbind Information is Current . . . . . . . . . . . . . . . . . 294
Removing fastbind Information from a File . . . . . . . . . . . . . . . . . . . 294
Turning off fastbind at Run Time . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
For More Information: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
A. Using Mapfiles
Controlling Mapfiles with the -k Option. . . . . . . . . . . . . . . . . . . . . . . . 296
Mapfile Example: Using -k filename (without +nodefaultmap Option)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Changing Mapfiles with -k filename and +nodefaultmap . . . . . . . . . . 298
Mapfile Example: Using -k mapfile and +nodefaultmap . . . 298
Simple Mapfile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
Default HP-UX Release 11.0 Mapfile . . . . . . . . . . . . . . . . . . . . . . . . . . 301
Contents
13
Defining Syntax for Mapfile Directives . . . . . . . . . . . . . . . . . . . . . . . . .303
Defining Mapfile Segment Declarations. . . . . . . . . . . . . . . . . . . . . . . . .304
Segment Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .304
Mapfile Segment Declaration Examples. . . . . . . . . . . . . . . . . . . . . . .306
Defining Mapfile Section Mapping Directives . . . . . . . . . . . . . . . . . . . .307
Internal Map Structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .309
Placement of Segments in an Executable. . . . . . . . . . . . . . . . . . . . . .309
Mapping Input Sections to Segments . . . . . . . . . . . . . . . . . . . . . . . . .309
Interaction between User-defined and Default Mapfile Directives. .312
Mapfile Option Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Fatal Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Warnings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .313
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
14
Contents
15
Preface
This Guide covers the following topics:
Chapter 1, “What's New in Recent Releases,” lists new features added
in recent releases.
Chapter 2, “What Happens When You Compile and Link a Program,
provides details on compiling and linking programs.
Chapter 3, “Linker Tasks,” lists many ways you can specify how you
want your program linked.
Chapter 4, “Linker Tools,” list the tools available in the linker toolset.
Chapter 5, “Creating and Using Libraries,” discusses all aspects of
both archive and shared libraries.
Chapter 6, “Shared Library Management Routines,” explains how to
explicitly load libraries at run time using shared library management
routines.
Chapter 7, “Position-Independent Code,” describes how to write
position-independent assembly code.
Chapter 8, “Ways to Improve Performance,” discusses several ways to
optimize your program.
Appendix A, “Using Mapfiles,” describes mapfiles.
Glossary contains definitions of important terms in this manual.
Printing History
New editions of this manual will incorporate all material updated since
the previous edition. The manual printing date and part number indicate
its current edition. The printing date changes when a new edition is
printed. The manual part number changes when extensive technical
changes are incorporated.
November 1997, Edition 1, part number B2355-90655. This manual
supersedes HP-UX Linker and Libraries User’s Guide part number
B2355-90655. The main reason for this new edition is to document
new functionality for the HP-UX 11.00 release:
16
Add the +ee linker option to export symbols.
Add 64-bit linker toolset support for linker options.
Add 64-bit mode linker tools and describe the enhancements to the
32-bit mode toolset.
Describe 32-bit and 64-bit mode behavior differences.
Add 64-bit mode dynamic path searching mechanisms.
Add 64-bit mode symbol binding semantics.
Add the dl* shared library management routines for 64-bit mode
support and describe enhancement to the shl_load routines for
shared libraries.
Add init/fini style initializers for 64-bit mode support for shared
libraries.
Add the BIND_BREADTH_FIRST flag to the shl_load routine to
control search path behavior.
Add description of support for ELF object file format.
April 1997, Edition 1, part number B2355-90654. This manual
supersedes Programming on HP-UX part number B2355-90652. The
main reason for this new edition is to document new functionality for
the HP-UX 10.30 release:
Announce linker thread-safe features for ld, dld.sl, crt0.o,
and libdld.sl.
Add the +pd size linker option to set the virtual memory page size
for program data.
Add the +pi size linker option to set the virtual memory page size
for program instructions.
Add the +k linker option (see ld(1)) to only create an executable if
no errors are found at link time.
Add the chatr +k option to enable or disable kernel-assisted
branch prediction.
Add the chatr +pd size and +pi size virtual memory page setting
options.
17
July 1996, Edition 1, part number B2355-90653. This manual
supersedes Programming on HP-UX part number B2355-90652. The
main reason for this new edition is to document new functionality for
the HP-UX 10.20 release and to describe what's ahead in a future
release of the linker toolset:
Add a -B symbolic option to help improve shared library
performance.
Introduce the fastbind tool to improve the start up time of
programs that use shared libraries.
Introduce the Linker and Libraries Online User Guide.
Announce changes in PA-RISC hardware compatibility—PA-RISC
1.1 systems, by default, generate PA-RISC 1.1 code; PA-RISC 2.0
systems generate 2.0 code.
Describe compatibility warnings generated by the linker and
dynamic loader for HP 9000 architecture issues and linker toolset
features that may change in a future release.
Describe what's changing in a future release of the linker toolset.
Add the +Ostaticprediction option to use with profile-based
optimization.
January 1995, Edition 1, part number B2355-90652. This manual
supersedes Programming on HP-UX part number B2355-90026. The
main reason for this new edition is to document new functionality for
the HP-UX 10.0 release:
Update path names to reflect the new System V Release 4 file
system. Some of the changes are:
Most files in /lib are now in /usr/lib.
Most optional products are in /opt. For example, HP C is in
/opt/ansic, HP C is in /opt/CC, HP FORTRAN/9000 is in
/opt/fortran, and HP/DDE is in /opt/langtools/dde.
Caution against mixing shared and archive libraries.
Describe a new library-level versioning scheme for shared
libraries.
Update the chapter on profile-based optimization.
Describe changes in optimization levels 3 and 4.
18
Describe thread-safe interfaces shl_get_r and
shl_gethandle_r.
Add a new BIND_TOGETHER flag to the shl_load routine.
Add a new chapter "Porting Applications to HP-UX."
Chapter 1 19
What's New in Recent Releases
1 What's New in Recent Releases
This section contains information about recent releases of the HP-UX
linker toolset:
For This Release
The HP-UX 11.00 linker toolset contains new features:
If you use the 32-bit mode linker toolset, see the following items:
“PA-RISC Changes in Hardware Compatibility” updated in this
chapter.
“Exporting Symbols with +ee” on page 81.
“Changes in Future Releases” updated in this chapter.
If you use the 64-bit mode linker toolset, see the following items:
“PA-RISC Changes in Hardware Compatibility” updated in this
chapter.
“64-bit Mode Linker Toolset Compatibility with De Facto Industry
Standards” described in this chapter.
“64-bit Mode ELF Object File Format” described in this chapter.
“Dynamic Path Searching for Shared Libraries” on page 177
describes differences in the run time searching of shared libraries.
“Shared Library Symbol Binding Semantics” on page 178 describes
differences in shared library binding semantics.
New 64-bit mode linker options, symbols, and features, described
in“New Features for 64-bit Mode Linking” in this chapter.
Unsupported 32-bit mode features, behavior, and linker options,
described in “64-bit Mode Link-time Differences” and“64-bit Mode
Run Time Differences” in this chapter.
“64-bit Mode Initializers” on page 210 describes the init/fini support
for 64-bit mode shared libraries.
20 Chapter 1
What's New in Recent Releases
“The dlopen Shared Library Management Routines” on page 240
describes the dl* family of shared library management routines for
64-bit mode.
“BIND_BREADTH_FIRST Modifier” on page 222 describes the flag
added to the shl_load routine to modify search behavior.
“Changes in Future Releases” updated in this chapter.
For Previous Releases
The following items were added in the HP-UX 10.30 release:
“Linker Thread-Safe Features” on page 50.
“Options to Improve TLB Hit Rates” on page 273.
The +k linker option (see ld(1)) to remove an executable if the link
fails.
The +k chatr option (see chatr(1)) to improve branch prediction on
PA-RISC 2.0.
The following items were added in the HP-UX 10.20 release:
“Improving Shared Library Performance with -B symbolic” on page
60.
“Improving Shared Library Start-Up Time with fastbind” on page
293.
“Online Help for Linker and Libraries” described in this chapter.
“PA-RISC Changes in Hardware Compatibility” described in this
chapter.
“Linker Compatibility Warnings” on page 99.
“Dynamic Loader Compatibility Warnings” on page 256.
The +Ostaticprediction linker option described in the ld(1) man
page to use with profile-based optimization
  • Page 1 1
  • Page 2 2
  • Page 3 3
  • Page 4 4
  • Page 5 5
  • Page 6 6
  • Page 7 7
  • Page 8 8
  • Page 9 9
  • Page 10 10
  • Page 11 11
  • Page 12 12
  • Page 13 13
  • Page 14 14
  • Page 15 15
  • Page 16 16
  • Page 17 17
  • Page 18 18
  • Page 19 19
  • Page 20 20
  • Page 21 21
  • Page 22 22
  • Page 23 23
  • Page 24 24
  • Page 25 25
  • Page 26 26
  • Page 27 27
  • Page 28 28
  • Page 29 29
  • Page 30 30
  • Page 31 31
  • Page 32 32
  • Page 33 33
  • Page 34 34
  • Page 35 35
  • Page 36 36
  • Page 37 37
  • Page 38 38
  • Page 39 39
  • Page 40 40
  • Page 41 41
  • Page 42 42
  • Page 43 43
  • Page 44 44
  • Page 45 45
  • Page 46 46
  • Page 47 47
  • Page 48 48
  • Page 49 49
  • Page 50 50
  • Page 51 51
  • Page 52 52
  • Page 53 53
  • Page 54 54
  • Page 55 55
  • Page 56 56
  • Page 57 57
  • Page 58 58
  • Page 59 59
  • Page 60 60
  • Page 61 61
  • Page 62 62
  • Page 63 63
  • Page 64 64
  • Page 65 65
  • Page 66 66
  • Page 67 67
  • Page 68 68
  • Page 69 69
  • Page 70 70
  • Page 71 71
  • Page 72 72
  • Page 73 73
  • Page 74 74
  • Page 75 75
  • Page 76 76
  • Page 77 77
  • Page 78 78
  • Page 79 79
  • Page 80 80
  • Page 81 81
  • Page 82 82
  • Page 83 83
  • Page 84 84
  • Page 85 85
  • Page 86 86
  • Page 87 87
  • Page 88 88
  • Page 89 89
  • Page 90 90
  • Page 91 91
  • Page 92 92
  • Page 93 93
  • Page 94 94
  • Page 95 95
  • Page 96 96
  • Page 97 97
  • Page 98 98
  • Page 99 99
  • Page 100 100
  • Page 101 101
  • Page 102 102
  • Page 103 103
  • Page 104 104
  • Page 105 105
  • Page 106 106
  • Page 107 107
  • Page 108 108
  • Page 109 109
  • Page 110 110
  • Page 111 111
  • Page 112 112
  • Page 113 113
  • Page 114 114
  • Page 115 115
  • Page 116 116
  • Page 117 117
  • Page 118 118
  • Page 119 119
  • Page 120 120
  • Page 121 121
  • Page 122 122
  • Page 123 123
  • Page 124 124
  • Page 125 125
  • Page 126 126
  • Page 127 127
  • Page 128 128
  • Page 129 129
  • Page 130 130
  • Page 131 131
  • Page 132 132
  • Page 133 133
  • Page 134 134
  • Page 135 135
  • Page 136 136
  • Page 137 137
  • Page 138 138
  • Page 139 139
  • Page 140 140
  • Page 141 141
  • Page 142 142
  • Page 143 143
  • Page 144 144
  • Page 145 145
  • Page 146 146
  • Page 147 147
  • Page 148 148
  • Page 149 149
  • Page 150 150
  • Page 151 151
  • Page 152 152
  • Page 153 153
  • Page 154 154
  • Page 155 155
  • Page 156 156
  • Page 157 157
  • Page 158 158
  • Page 159 159
  • Page 160 160
  • Page 161 161
  • Page 162 162
  • Page 163 163
  • Page 164 164
  • Page 165 165
  • Page 166 166
  • Page 167 167
  • Page 168 168
  • Page 169 169
  • Page 170 170
  • Page 171 171
  • Page 172 172
  • Page 173 173
  • Page 174 174
  • Page 175 175
  • Page 176 176
  • Page 177 177
  • Page 178 178
  • Page 179 179
  • Page 180 180
  • Page 181 181
  • Page 182 182
  • Page 183 183
  • Page 184 184
  • Page 185 185
  • Page 186 186
  • Page 187 187
  • Page 188 188
  • Page 189 189
  • Page 190 190
  • Page 191 191
  • Page 192 192
  • Page 193 193
  • Page 194 194
  • Page 195 195
  • Page 196 196
  • Page 197 197
  • Page 198 198
  • Page 199 199
  • Page 200 200
  • Page 201 201
  • Page 202 202
  • Page 203 203
  • Page 204 204
  • Page 205 205
  • Page 206 206
  • Page 207 207
  • Page 208 208
  • Page 209 209
  • Page 210 210
  • Page 211 211
  • Page 212 212
  • Page 213 213
  • Page 214 214
  • Page 215 215
  • Page 216 216
  • Page 217 217
  • Page 218 218
  • Page 219 219
  • Page 220 220
  • Page 221 221
  • Page 222 222
  • Page 223 223
  • Page 224 224
  • Page 225 225
  • Page 226 226
  • Page 227 227
  • Page 228 228
  • Page 229 229
  • Page 230 230
  • Page 231 231
  • Page 232 232
  • Page 233 233
  • Page 234 234
  • Page 235 235
  • Page 236 236
  • Page 237 237
  • Page 238 238
  • Page 239 239
  • Page 240 240
  • Page 241 241
  • Page 242 242
  • Page 243 243
  • Page 244 244
  • Page 245 245
  • Page 246 246
  • Page 247 247
  • Page 248 248
  • Page 249 249
  • Page 250 250
  • Page 251 251
  • Page 252 252
  • Page 253 253
  • Page 254 254
  • Page 255 255
  • Page 256 256
  • Page 257 257
  • Page 258 258
  • Page 259 259
  • Page 260 260
  • Page 261 261
  • Page 262 262
  • Page 263 263
  • Page 264 264
  • Page 265 265
  • Page 266 266
  • Page 267 267
  • Page 268 268
  • Page 269 269
  • Page 270 270
  • Page 271 271
  • Page 272 272
  • Page 273 273
  • Page 274 274
  • Page 275 275
  • Page 276 276
  • Page 277 277
  • Page 278 278
  • Page 279 279
  • Page 280 280
  • Page 281 281
  • Page 282 282
  • Page 283 283
  • Page 284 284
  • Page 285 285
  • Page 286 286
  • Page 287 287
  • Page 288 288
  • Page 289 289
  • Page 290 290
  • Page 291 291
  • Page 292 292
  • Page 293 293
  • Page 294 294
  • Page 295 295
  • Page 296 296
  • Page 297 297
  • Page 298 298
  • Page 299 299
  • Page 300 300
  • Page 301 301
  • Page 302 302
  • Page 303 303
  • Page 304 304
  • Page 305 305
  • Page 306 306
  • Page 307 307
  • Page 308 308
  • Page 309 309
  • Page 310 310
  • Page 311 311
  • Page 312 312
  • Page 313 313
  • Page 314 314
  • Page 315 315
  • Page 316 316
  • Page 317 317
  • Page 318 318
  • Page 319 319
  • Page 320 320
  • Page 321 321
  • Page 322 322
  • Page 323 323
  • Page 324 324
  • Page 325 325
  • Page 326 326
  • Page 327 327
  • Page 328 328
  • Page 329 329
  • Page 330 330
  • Page 331 331
  • Page 332 332
  • Page 333 333

Kenwood HP 9000 User manual

Category
Software manuals
Type
User manual

Ask a question and I''ll find the answer in the document

Finding information in a document is now easier with AI