Linker and Libraries Guide

Linker and Libraries Guide

Linker and Libraries Guide Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054 U.S.A. Part No: 816–1386–10 May 2002 Copyright 2002 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. This product or document is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation. No part of this product or document may be reproduced in any form by any means without prior written authorization of Sun and its licensors, if any. Third-party software, including font technology, is copyrighted and licensed from Sun suppliers. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, docs.sun.com, AnswerBook, AnswerBook2, and Solaris are trademarks, registered trademarks, or service marks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. The OPEN LOOK and Sun™ Graphical User Interface was developed by Sun Microsystems, Inc. for its users and licensees. Sun acknowledges the pioneering efforts of Xerox in researching and developing the concept of visual or graphical user interfaces for the computer industry. Sun holds a non-exclusive license from Xerox to the Xerox Graphical User Interface, which license also covers Sun’s licensees who implement OPEN LOOK GUIs and otherwise comply with Sun’s written license agreements. Federal Acquisitions: Commercial Software–Government Users Subject to Standard License Terms and Conditions. DOCUMENTATION IS PROVIDED “AS IS” AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright 2002 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. Tous droits réservés Ce produit ou document est protégé par un copyright et distribué avec des licences qui en restreignent l’utilisation, la copie, la distribution, et la décompilation. Aucune partie de ce produit ou document ne peut être reproduite sous aucune forme, par quelque moyen que ce soit, sans l’autorisation préalable et écrite de Sun et de ses bailleurs de licence, s’il y en a. Le logiciel détenu par des tiers, et qui comprend la technologie relative aux polices de caractères, est protégé par un copyright et licencié par des fournisseurs de Sun. Des parties de ce produit pourront être dérivées du système Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux Etats-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd. Sun, Sun Microsystems, le logo Sun, docs.sun.com, AnswerBook, AnswerBook2, et Solaris sont des marques de fabrique ou des marques déposées, ou marques de service, de Sun Microsystems, Inc. aux Etats-Unis et dans d’autres pays. Toutes les marques SPARC sont utilisées sous licence et sont des marques de fabrique ou des marques déposées de SPARC International, Inc. aux Etats-Unis et dans d’autres pays. Les produits portant les marques SPARC sont basés sur une architecture développée par Sun Microsystems, Inc. L’interface d’utilisation graphique OPEN LOOK et Sun™ a été développée par Sun Microsystems, Inc. pour ses utilisateurs et licenciés. Sun reconnaît les efforts de pionniers de Xerox pour la recherche et le développement du concept des interfaces d’utilisation visuelle ou graphique pour l’industrie de l’informatique. Sun détient une licence non exclusive de Xerox sur l’interface d’utilisation graphique Xerox, cette licence couvrant également les licenciés de Sun qui mettent en place l’interface d’utilisation graphique OPEN LOOK et qui en outre se conforment aux licences écrites de Sun. CETTE PUBLICATION EST FOURNIE “EN L’ETAT” ET AUCUNE GARANTIE, EXPRESSE OU IMPLICITE, N’EST ACCORDEE, Y COMPRIS DES GARANTIES CONCERNANT LA VALEUR MARCHANDE, L’APTITUDE DE LA PUBLICATION A REPONDRE A UNE UTILISATION PARTICULIERE, OU LE FAIT QU’ELLE NE SOIT PAS CONTREFAISANTE DE PRODUIT DE TIERS. CE DENI DE GARANTIE NE S’APPLIQUERAIT PAS, DANS LA MESURE OU IL SERAIT TENU JURIDIQUEMENT NUL ET NON AVENU. 020116@3062 Contents Preface 13 1 Introduction to the Solaris Linkers 17 Link-Editing 18 Runtime Linking 19 Related Topics 20 Dynamic Linking 20 Application Binary Interfaces 20 32–Bit and 64–Bit Environments 20 Environment Variables 21 Support Tools 21 2 Link-Editor 23 Invoking the Link-Editor 24 Direct Invocation 24 Using a Compiler Driver 25 Specifying the Link-Editor Options 25 Input File Processing 26 Archive Processing 27 Shared Object Processing 28 Linking With Additional Libraries 29 Initialization and Termination Sections 34 Symbol Processing 36 Symbol Resolution 36 Undefined Symbols 40 3 Tentative Symbol Order Within the Output File 44 Defining Additional Symbols 44 Reducing Symbol Scope 49 External Bindings 53 Generating the Output File 53 Relocation Processing 55 Displacement Relocations 55 Debugging Aids 57 3 Runtime Linker 61 Shared Object Dependencies 62 Locating Shared Object Dependencies 62 Directories Searched by the Runtime Linker 62 Configuring the Default Search Paths 65 Dynamic String Tokens 65 Relocation Processing 66 Symbol Lookup 67 When Relocations Are Performed 68 Relocation Errors 70 Loading Additional Objects 71 Lazy Loading of Dynamic Dependencies 72 Initialization and Termination Routines 74 Security 76 Runtime Linking Programming Interface 77 Loading Additional Objects 78 Relocation Processing 80 Obtaining New Symbols 86 Feature Checking 89 Debugging Aids 89 Debugging Library 89 Debugger Module 92 4 Shared Objects 97 Naming Conventions 98 Recording a Shared Object Name 99 Shared Objects With Dependencies 101 Dependency Ordering 102 4 Linker and Libraries Guide • May 2002 Shared Objects as Filters 103 Generating a Standard Filter 103 Generating an Auxiliary Filter 106 Filtee Processing 107 Performance Considerations 107 Analyzing Files 108 Underlying System 109 Lazy Loading of Dynamic Dependencies 110 Position-Independent Code 110 Maximizing Shareability 113 Minimizing Paging Activity 115 Relocations 115 Using -Bsymbolic 120 Profiling Shared Objects 120 5 Application Binary Interfaces and Versioning 123 Interface Compatibility 124 Internal Versioning 125 Creating a Version Definition 125 Binding to a Version Definition 130 Specifying a Version Binding 134 Version Stability 138 Relocatable Objects 139 External Versioning 139 Coordination of Versioned Filenames 139 6 Support Interfaces 143 Link-Editor Support Interface 143 Invoking the Support Interface 144 Support Interface Functions 145 Support Interface Example 147 Runtime Linker Auditing Interface 149 Establishing a Namespace 150 Creating an Audit Library 150 Invoking the Auditing Interface 151 Recording Local Auditors 152 Audit Interface Functions 152 Contents 5 Audit Interface Example 157 Audit Interface Demonstrations 157 Audit Interface Limitations 158 Runtime Linker Debugger Interface 158 Interaction Between Controlling and Target Process 159 Debugger Interface Agents 161 Debugger Exported Interface 161 Debugger Import Interface 169 7 Object File Format 171 File Format 172 Data Representation 173 ELF Header 174 ELF Identification 178 Data Encoding 180 Sections 181 Section Groups 191 Special Sections 192 String Table 196 Symbol Table 197 Syminfo Table 204 Relocation 205 Comdat Section 215 Versioning Information 215 Note Section 220 Move Section 222 Dynamic Linking 224 Program Header 225 Program Loading (Processor-Specific) 230 Runtime Linker 236 Dynamic Section 237 Global Offset Table (Processor-Specific) 249 Procedure Linkage Table (Processor-Specific) 250 Hash Table 258 8 Mapfile Option 261 Mapfile Structure and Syntax 261 6 Linker and Libraries Guide • May 2002 Segment Declarations 262 Mapping Directives 266 Section-Within-Segment Ordering 267 Size-Symbol Declarations 268 File Control Directives 268 Mapping Example 268 Mapfile Option Defaults 270 Internal Map Structure 271 A Link-Editor Quick Reference 275 Static Mode 275 Creating a Relocatable Object 276 Creating a Static Executable 276 Dynamic Mode 276 Creating a Shared Object 276 Creating a Dynamic Executable 278 B Versioning Quick Reference 279 Naming Conventions 279 Defining a Shared Object’s Interface 281 Versioning a Shared Object 281 Versioning an Existing (Non-versioned) Shared Object 282 Updating a Versioned Shared Object 283 Adding New Symbols 283 Internal Implementation Changes 284 New Symbols and Internal Implementation Changes 284 Migrating Symbols to a Standard Interface 285 C Establishing Dependencies with Dynamic String Tokens 289 Instruction Set Specific Shared Objects 289 Reducing Auxiliary Searches 290 System Specific Shared Objects 291 Locating Associated Dependencies 292 Dependencies Between Unbundled Products 293 Security 295 Contents 7 D New Linker and Libraries Features and Updates 297 Solaris 9 Release 297 Solaris 8 07/01 Release 298 Solaris 8 01/01 Release 298 Solaris 8 10/00 Release 298 Solaris 8 Release 299 Solaris 7 Release 300 Solaris 2.6 Release 300 Index 303 8 Linker and Libraries Guide • May 2002 Tables TABLE 5–1 Interface Compatibility Examples 124 TABLE

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    312 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us