refspecs.linuxfoundation.org... gabi41.pdf | 402 ... 4226 unsigned long uc ... UT_HOSTSIZE 256 4415 #define UT_LINESIZE 32 4416 #define UT

  • Upload
    vokien

  • View
    222

  • Download
    3

Embed Size (px)

Citation preview

1Linux Standard Base Specification 1.2 2 3Copyright 2000, 2001, 2002 by Free Standards Group 4 5Permission is granted to copy, distribute and/or modify this document under the 6terms of the GNU Free Documentation License, Version 1.1; with no Invariant 7Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of 8the license is included in the section entitled "GNU Free Documentation 9License". 10 11Portions of the text were taken from other copyrighted documents in accordance 12with the respective licenses of those documents. 13 14Linux is a trademark of Linus Torvalds. 15 16UNIX a registered trademark of the Open Group in the United States and other 17countries. 18 19Intel386 and Itanium are trademarks of Intel Corporation. 20 21OpenGL is a registered trademark of Silicon Graphics, Inc. 22 23------------------------------------------------------------------------------- 24 25Table of Contents 26I. Introduction 27 28 1. Introduction 29 30 Introduction 31 Purpose 32 Related Standards 33 Relevant Libraries 34 How to Use this Standard 35 Definitions 36 Terminology 37 38II. Object Format 39 40 2. Object Files 41 3. Sections 42 43 Sections Types 44 45 4. Special Sections 46 47 Special Sections 48 49 5. Symbol Mapping 50 51 Symbol Mapping 52 53 6. Symbol Versioning 54 55 Symbol Version Table 56 Version Definitions 57 Version Requirements 58 Startup Sequence 59 Symbol Resolution 60 61 7. ABI note tag 62 63III. Dynamic Linking 64 65 8. Program Loading and Dynamic Linking 66 9. Dynamic Entries 67 68 Dynamic Entries 69 70 10. Program Interpreter 71 72 73 74IV. Base Libraries 75 76 11. Libraries 77 78 Interfaces for libc 79 Data Definitions for libc 80 Interfaces Definitions for libc 81 Interfaces for libm 82 Data Definitions for libm 83 Interfaces for libpthread 84 Data Definitions for libpthread 85 Interfaces Definitions for libpthread 86 Interfaces for libdl 87 Data Definitions for libdl 88 Interfaces Definitions for libdl 89 Interfaces for libcrypt 90 Data Definitions for libcrypt 91 92V. Utility Libraries 93 94 12. Libraries 95 96 Interfaces for libz 97 Data Definitions for libz 98 Interfaces for libncurses 99 Data Definitions for libncurses 100 Interfaces for libutil 101 Data Definitions for libutil 102 Interfaces Definitions for libutil 103 104VI. Graphic Libraries 105 106 13. Libraries 107 108 Interfaces for libX11 109 Data Definitions for libX11 110 Interfaces for libXext 111 Data Definitions for libXext 112 Interfaces for libSM 113 Data Definitions for libSM 114 Interfaces for libICE 115 Data Definitions for libICE 116 Interfaces for libXt 117 Data Definitions for libXt 118 Interfaces Definitions for libXt 119 Interfaces for libGL 120 Data Definitions for libGL 121 122VII. Package Format and Installation 123 124 14. Software Installation 125 126 Package Format 127 Package Tools 128 Package Naming 129 Package Dependencies 130 Package Architecture Considerations 131 132VIII. Commands and Utilities 133 134 15. Command and Utilities 135 136 Command and Utilities 137 Command Behavior 138 139IX. Standard Shell 140 141 16. Standard Shell 142 143 Introduction 144 Standard Shell Exceptions 145 Standard Shell Rationale 146 147X. Users & Groups 148 149 17. Users & Groups 150 151 User and Group Database 152 User & Group Names 153 UID Ranges 154 Rationale 155 156XI. Execution Environment 157 158 18. File System Hierarchy 159 160 /dev 161 162 19. Additional Recommendations 163 164 Minimal granted Directory and File permissions 165 Recommendations for applications on ownership and permissions 166 167 20. Additional Behaviors 168 21. Localization 169 170XII. System Initialization 171 172 22. System Initialization 173 174 Cron Jobs 175 Init Script Actions 176 Comment conventions for init scripts 177 Installation and removal of init.d files 178 Run Levels 179 Facility names 180 Script names 181 Init script Functions 182 183A. Alphabetical Listing of Interfaces 184 185 libX11 186 libXt 187 libm 188 libGL 189 libXext 190 libICE 191 libSM 192 libdl 193 libcrypt 194 libz 195 libncurses 196 libutil 197 libc 198 libpthread 199 200B. GNU Free Documentation License 201 202 PREAMBLE 203 APPLICABILITY AND DEFINITIONS 204 VERBATIM COPYING 205 COPYING IN QUANTITY 206 MODIFICATIONS 207 COMBINING DOCUMENTS 208 COLLECTIONS OF DOCUMENTS 209 AGGREGATION WITH INDEPENDENT WORKS 210 TRANSLATION 211 TERMINATION 212 FUTURE REVISIONS OF THIS LICENSE 213 How to use this License for your documents 214 215List of Tables 2161-1. Related Standards 2171-2. Standard Libraries Names 2181-3. Standard Library Names defined in the Architecture Specific Supplement 2193-1. ELF Section Types 2203-2. Additional Section Types 2214-1. ELF Special Sections 2224-2. Additional Special Sections 22311-1. libc Definition 22411-2. libc - RPC Function Interfaces 22511-3. libc - System Calls Function Interfaces 22611-4. libc - Standard I/O Function Interfaces 22711-5. libc - Standard I/O Data Interfaces 22811-6. libc - Signal Handling Function Interfaces 22911-7. libc - Signal Handling Data Interfaces 23011-8. libc - Standard Library Function Interfaces 23111-9. libc - Standard Library Data Interfaces 23211-10. libc - Localization Functions Function Interfaces 23311-11. libc - Localization Functions Data Interfaces 23411-12. libc - Socket Interface Function Interfaces 23511-13. libc - Wide Characters Function Interfaces 23611-14. libc - String Functions Function Interfaces 23711-15. libc - IPC Functions Function Interfaces 23811-16. libc - Regular Expressions Function Interfaces 23911-17. libc - Regular Expressions Data Interfaces 24011-18. libc - Character Type Functions Function Interfaces 24111-19. libc - Character Type Functions Data Interfaces 24211-20. libc - Time Manipulation Function Interfaces 24311-21. libc - Time Manipulation Data Interfaces 24411-22. libc - Terminal Interface Functions Function Interfaces 24511-23. libc - System Database Interface Function Interfaces 24611-24. libc - Language Support Function Interfaces 24711-25. libc - Large File Support Function Interfaces 24811-26. libm Definition 24911-27. libm - Math Function Interfaces 25011-28. libm - Math Data Interfaces 25111-29. libpthread Definition 25211-30. libpthread - Posix Threads Function Interfaces 25311-31. libdl Definition 25411-32. libdl - Dynamic Loader Function Interfaces 25511-33. libcrypt Definition 25611-34. libcrypt - Encryption Function Interfaces 25712-1. libz Definition 25812-2. libz - Compression Library Function Interfaces 25912-3. libncurses Definition 26012-4. libncurses - Curses Function Interfaces 26112-5. libncurses - Curses Data Interfaces 26212-6. libutil Definition 26312-7. libutil - Utility Functions Function Interfaces 26413-1. libX11 Definition 26513-2. libX11 - X Windows System Interface Function Interfaces 26613-3. libXext Definition 26713-4. libXext - X Shape Extension Function Interfaces 26813-5. libXext - X Display Power Management Signaling Extension Function 269 Interfaces 27013-6. libXext - X Shared Memory Extensions Function Interfaces 27113-7. libXext - X Synchronization Extension Function Interfaces 27213-8. libXext - X Security Extension Function Interfaces 27313-9. libXext - X Double Buffer Extension Function Interfaces 27413-10. libSM Definition 27513-11. libSM - Session Management Functions Function Interfaces 27613-12. libICE Definition 27713-13. libICE - ICE Functions Function Interfaces 27813-14. libXt Definition 27913-15. libXt - X Toolkit Function Interfaces 28013-16. libXt - X Toolkit Data Interfaces 28113-17. libGL Definition 28213-18. libGL - GL X interface Function Interfaces 28313-19. libGL - OpenGL Function Interfaces 28415-1. Commands and Utilities 28517-1. Required User & Group Names 28617-2. Optional User & Group Names 287A-1. libX11 Function Interfaces 288A-2. libXt Function Interfaces 289A-3. libXt Data Interfaces 290A-4. libm Function Interfaces 291A-5. libm Data Interfaces 292A-6. libGL Function Interfaces 293A-7. libXext Function Interfaces 294A-8. libICE Function Interfaces 295A-9. libSM Function Interfaces 296A-10. libdl Function Interfaces 297A-11. libcrypt Function Interfaces 298A-12. libz Function Interfaces 299A-13. libncurses Function Interfaces 300A-14. libncurses Data Interfaces 301A-15. libutil Function Interfaces 302A-16. libc Function Interfaces 303A-17. libc Data Interfaces 304A-18. libpthread Function Interfaces 305 306List of Figures 3076-1. Version Definition Entries 3086-2. Version Definition Auxiliary Entries 3096-3. Version Needed Entries 3106-4. Version Needed Auxiliary Entries 311 312I. Introduction 313 314Table of Contents 3151. Introduction 316 317------------------------------------------------------------------------------- 318 319Chapter 1. Introduction 320 321Introduction 322 323This is version 1.2 of the Linux Standard Base Specification. An implementation 324of this version of the specification may not claim to be an implementation of 325the Linux Standard Base unless it has successfully completed the compliance 326process as defined by the Free Standards Group. 327 328------------------------------------------------------------------------------- 329 330Purpose 331 332The Linux Standard Base (LSB) defines a system interface for compiled 333applications and a minimal environment for support of installation scripts. Its 334purpose is to enable a uniform industry standard environment for high-volume 335applications conforming to the LSB. 336 337The LSB defines a binary interface for application programs that are compiled 338and packaged for LSB-conforming implementations on many different hardware 339architectures. Since a binary specification must include information specific 340to the computer processor architecture for which it is intended, it is not 341possible for a single document to specify the interface for all possible 342LSB-conforming implementations. Therefore, the LSB is a family of 343specifications, rather than a single one. 344 345The LSB is composed of two basic parts: A common specification ("generic LSB" 346or "gLSB") describing those parts of the interface that remain constant across 347all implementations of the LSB, and an architecture-specific specification 348("archLSB") describing the parts of the interface that vary by processor 349architecture. Together, the generic LSB and the architecture-specific 350supplement for a single hardware architecture provide a complete interface 351specification for compiled application programs on systems that share a common 352hardware architecture. 353 354This document is the generic LSB. It must be used in conjunction with an 355architecture-specific supplement. Whenever a section of this specification must 356be supplemented by architecture-specific information, this document includes a 357reference to the architecture supplement. Architecture supplements may also 358contain additional information that is not referenced here. 359 360This document should be used in conjunction with the documents it references. 361This document enumerates the system components it includes, but descriptions of 362those components may be included entirely or partly in this document, partly in 363other documents, or entirely in other reference documents. For example, the 364section that describes system service routines includes a list of the system 365routines supported in this interface, formal declarations of the data 366structures they use that are visible to applications, and a pointer to the 367underlying referenced specification for information about the syntax and 368semantics of each call. Only those routines not described in standards 369referenced by this document, or extensions to those standards, are described in 370the detail. Information referenced in this way is as much a part of this 371document as is the information explicitly included here. 372 373------------------------------------------------------------------------------- 374 375Related Standards 376 377The specifications listed below are referenced in whole or in part by the Linux 378Standard Base. When a specification is referenced in a way that imposes a 379requirement (for example, "foo must behave as specified in the XyzzySpec"), 380then the relevant requirements of that specification apply as if they were part 381of the LSB itself. However, if the LSB refers to a specification without 382imposing a requirement, then it is merely a reference and does not add 383additional requirements. The LSB may refer to a portion of a specification (for 384example, to define a specific function or group of functions); in such cases, 385only the explicitly referenced portion of the specification applies. 386 387Table 1-1. Related Standards 388 389+-----------------------------------------------------------------------------+ 390|System V Application Binary Interface - DRAFT - |http://www.caldera.com/ | 391|22 June 2000 |developers/gabi/2000-07-17/ | 392| |contents.html | 393|------------------------------------------------+----------------------------| 394|Filesystem Hierarchy Standard (FHS) 2.2 |http://www.pathname.com/fhs/| 395|------------------------------------------------+----------------------------| 396|IEEE Standard for Binary Floating-Point |http://www.ieee.org/ | 397|Arithmetic | | 398|------------------------------------------------+----------------------------| 399|System V Application Binary Interface, Edition |http://www.caldera.com/ | 400|4.1 |developers/devspecs/ | 401| |gabi41.pdf | 402|------------------------------------------------+----------------------------| 403|ISO/IEC 9899: 1990, Programming Languages --C | | 404|------------------------------------------------+----------------------------| 405|ISO/IEC 9899: 1999, Programming Languages --C | | 406|------------------------------------------------+----------------------------| 407|Linux Assigned Names And Numbers Authority |http://www.lanana.org/ | 408|------------------------------------------------+----------------------------| 409|Large File Support |http://www.UNIX-systems.org/| 410| |version2/whatsnew/ | 411| |lfs20mar.html | 412|------------------------------------------------+----------------------------| 413|LI18NUX 2000 Globalization Specification, |http://www.li18nux.org/docs/| 414|Version 1.0 with Amendment 4 |html/LI18NUX-2000-amd4.htm | 415|------------------------------------------------+----------------------------| 416|Linux Standard Base |http://www.linuxbase.org/ | 417| |spec/ | 418|------------------------------------------------+----------------------------| 419|OpenGL Application Binary Interface for Linux |http://oss.sgi.com/projects/| 420| |ogl-sample/ABI/ | 421|------------------------------------------------+----------------------------| 422|IEEE Std POSIX 1003.2-1992 (ISO/IEC 9945-2:1993)|http://www.ieee.org/ | 423|------------------------------------------------+----------------------------| 424|System V Application Binary Interface PowerPC |http://www.esofta.com/pdfs/ | 425|Processor Supplement |SVR4abippc.pdf | 426|------------------------------------------------+----------------------------| 427|POSIX 1003.1c |http://www.ieee.org/ | 428|------------------------------------------------+----------------------------| 429|CAE Specification, May 1996, X/Open Curses, |http://www.opengroup.org/ | 430|Issue 4, Version 2 (ISBN: 1-85912-171-3, C610), | | 431|plus Corrigendum U018 | | 432|------------------------------------------------+----------------------------| 433|CAE Specification, January 1997, System |http://www.opengroup.org/ | 434|Interface Definitions (XBD), Issue 5 (ISBN: | | 435|1-85912-186-1, C605) | | 436|------------------------------------------------+----------------------------| 437|CAE Specification, January 1997, Commands and |http://www.opengroup.org/ | 438|Utilities (XCU), Issue 5 (ISBN: 1-85912-191-8, | | 439|C604) | | 440|------------------------------------------------+----------------------------| 441|CAE Specification, February 1997, Networking |http://www.opengroup.org/ | 442|Services (XNS), Issue 5 (ISBN: 1-85912-165-9, | | 443|C523) | | 444|------------------------------------------------+----------------------------| 445|CAE Specification, January 1997, System |http://www.opengroup.org/ | 446|Interfaces and Headers (XSH), Issue 5 (ISBN: | | 447|1-85912-181-0, C606) | | 448|------------------------------------------------+----------------------------| 449|The Single UNIX Specification(SUS) Version 1 |http://www.opengroup.org/ | 450|(UNIX 95) System Interfaces & Headers | | 451|------------------------------------------------+----------------------------| 452|System V Interface Definition, Issue 3 (ISBN | | 453|0201566524) | | 454|------------------------------------------------+----------------------------| 455|System V Interface Definition,Fourth Edition | | 456|------------------------------------------------+----------------------------| 457|Double Buffer Extension Library |http://www.x.org/ | 458|------------------------------------------------+----------------------------| 459|X Display Power Management Signaling (DPMS) |http://www.x.org/ | 460|Extension, Library Specification | | 461|------------------------------------------------+----------------------------| 462|X Record Extension Library |http://www.x.org/ | 463|------------------------------------------------+----------------------------| 464|Security Extension Specification, Version 7.1 |http://www.x.org/ | 465|------------------------------------------------+----------------------------| 466|X Nonrectangular Window Shape Extension Library |http://www.x.org/ | 467|Version 1.0 | | 468|------------------------------------------------+----------------------------| 469|MIT-SHM--The MIT Shared Memory Extension |http://www.x.org/ | 470|------------------------------------------------+----------------------------| 471|X Synchronization Extension Library |http://www.x.org/ | 472|------------------------------------------------+----------------------------| 473|XTEST Extension Library |http://www.x.org/ | 474|------------------------------------------------+----------------------------| 475|X11R6.4 X Inter-Client Exchange (ICE) Protocol |http://www.x.org/ | 476|------------------------------------------------+----------------------------| 477|X11R6.4 X11 Input Extension Library |http://www.x.org/ | 478|------------------------------------------------+----------------------------| 479|X11R6.4 Xlib - C library |http://www.x.org/ | 480|------------------------------------------------+----------------------------| 481|X/Open Portability Guide, Issue 4 |http://www.opengroup.org/ | 482|------------------------------------------------+----------------------------| 483|X11R6.4 X Session Management Library |http://www.x.org/ | 484|------------------------------------------------+----------------------------| 485|X11R6.4 X Toolkit Intrinsics |http://www.x.org/ | 486|------------------------------------------------+----------------------------| 487|zlib 1.1.3 Manual |http://www.gzip.org/zlib/ | 488+-----------------------------------------------------------------------------+ 489------------------------------------------------------------------------------- 490 491Relevant Libraries 492 493The libraries listed here shall be available on a Linux Standard Base system. 494This list may be supplemented or amended by the architecture-specific 495specifications. 496 497Table 1-2. Standard Libraries Names 498 499+---------------------------+ 500|Library |Runtime Name | 501|----------+----------------| 502|libX11 |libX11.so.6 | 503|----------+----------------| 504|libXt |libXt.so.6 | 505|----------+----------------| 506|libGL |libGL.so.1 | 507|----------+----------------| 508|libXext |libXext.so.6 | 509|----------+----------------| 510|libICE |libICE.so.6 | 511|----------+----------------| 512|libSM |libSM.so.6 | 513|----------+----------------| 514|libdl |libdl.so.2 | 515|----------+----------------| 516|libcrypt |libcrypt.so.1 | 517|----------+----------------| 518|libz |libz.so.1 | 519|----------+----------------| 520|libncurses|libncurses.so.5 | 521|----------+----------------| 522|libutil |libutil.so.1 | 523|----------+----------------| 524|libpthread|libpthread.so.0 | 525+---------------------------+ 526 527Table 1-3. Standard Library Names defined in the Architecture Specific 528Supplement 529 530+------------------------+ 531|Library |Runtime Name | 532|----------+-------------| 533|libm |See archLSB | 534|----------+-------------| 535|libc |See archLSB | 536|----------+-------------| 537|proginterp|See archLSB | 538+------------------------+ 539 540These libraries will be in an implementation-dependent directory which the 541dynamic linker will search by default. 542 543------------------------------------------------------------------------------- 544 545How to Use this Standard 546 547The complete LSB specification is composed of this generic LSB specification 548and the supplemental processor-specific specification for a particular 549processor architecture. These two documents constitute a specification that 550should be used in conjunction with the publicly-available standards documents 551it references. The LSB enumerates the system components it includes, but 552descriptions of those components may be included entirely in the LSB, partly in 553the LSB and partly in other documents, or entirely in other reference 554documents. 555 556------------------------------------------------------------------------------- 557 558Definitions 559 560gLSB 561 562 The common part of the LSB Specification that describes those parts of the 563 interface that remain constant across all hardware implementations of the 564 LSB. 565 566archLSB 567 568 The architectural part of the LSB Specification which describes the 569 specific parts of the interface that are platform specific. The archLSB is 570 complementary to the gLSB. 571 572LSB Implementation Conformance 573 574 An implementation satisfying the following requirements: 575 576 1. The implementation shall implement fully the architecture described in 577 the hardware manual for the target processor architecture. 578 579 2. The implementation shall be capable of executing compiled applications 580 having the format and using the system interfaces described in this 581 document. 582 583 3. The implementation shall provide libraries containing the interfaces 584 specified by this document, and shall provide a dynamic linking 585 mechanism that allows these interfaces to be attached to applications 586 at runtime. All the interfaces shall behave as specified in this 587 document. 588 589 4. The map of virtual memory provided by the implementation shall conform 590 to the requirements of this document. 591 592 5. The implementation's low-level behavior with respect to function call 593 linkage, system traps, signals, and other such activities shall conform 594 to the formats described in this document. 595 596 6. The implementation shall provide all of the mandatory interfaces in 597 their entirety. 598 599 7. The implementation may provide one or more of the optional interfaces. 600 Each optional interface that is provided shall be provided in its 601 entirety. The product documentation shall state which optional 602 interfaces are provided. 603 604 8. The implementation shall provide all files and utilities specified as 605 part of this document in the format defined here and in other 606 referenced documents. All commands and utilities shall behave as 607 required by this document. The implementation shall also provide all 608 mandatory components of an application's runtime environment that are 609 included or referenced in this document. 610 611 9. The implementation, when provided with standard data formats and values 612 at a named interface, shall provide the behavior defined for those 613 values and data formats at that interface. However, a conforming 614 implementation may consist of components which are separately packaged 615 and/or sold. For example, a vendor of a conforming implementation might 616 sell the hardware, operating system, and windowing system as separately 617 packaged items. 618 619 10. The implementation may provide additional interfaces with different 620 names. It may also provide additional behavior corresponding to data 621 values outside the standard ranges, for standard named interfaces. 622 623LSB Application Conformance 624 625 An application with the following characteristics: 626 627 1. Its executable files are either shell scripts or object files in the 628 format defined for the Object File Format system interface. 629 630 2. Its object files participate in dynamic linking as defined in the 631 Program Loading and Linking System interface. 632 633 3. It employs only the instructions, traps, and other low-level facilities 634 defined in the Low-Level System interface as being for use by 635 applications. 636 637 4. If it requires any optional interface defined in this document in order 638 to be installed or to execute successfully, the requirement for that 639 optional interface is stated in the application's documentation. 640 641 5. It does not use any interface or data format that is not required to be 642 provided by a conforming implementation, unless: 643 644 o If such an interface or data format is supplied by another 645 application through direct invocation of that application during 646 execution, that application is in turn an LSB conforming 647 application. 648 649 o The use of that interface or data format, as well as its source, is 650 identified in the documentation of the application. 651 652 6. It must not use any values for a named interface that are reserved for 653 vendor extensions. 654 655 A strictly conforming application does not require or use any interface, 656 facility, or implementation-defined extension that is not defined in this 657 document in order to be installed or to execute successfully. 658 659Rationale 660 661 An LSB conforming application is expected to have no dependencies on any 662 vendor extensions to this document. The most common such extensions are 663 additional function entry points and additional libraries other than the 664 ones defined in this document. If an application requires such extensions, 665 it is not portable, since other LSB conforming implementations may not 666 provide those extensions. 667 668 An LSB conforming application is required to use system services on the 669 implementation on which it is running, rather than importing system 670 routines from some other implementation. Thus, it must link dynamically to 671 any routines in the implementation that perform system traps to kernel 672 services. 673 674 It is to be expected that some applications may be companion applications 675 to other applications. For example, a query application may be a companion 676 to a database application; a preprocessor may be an adjunct to one or more 677 compilers; a data reformatter may convert data from one document manager to 678 another. In such cases, the application may or may not be LSB conforming, 679 regardless of whether the other application on which it is dependent is LSB 680 conforming. If such an application merely uses data produced by another 681 application, the application's compliance is independent of the other 682 application's compliance. If such an application actually invokes another 683 application during execution (as, for example, a third-party math library), 684 the invoking application is LSB conforming only if it also constitutes a 685 LSB conforming application in combination with the invoked application. 686 687Shell Script 688 689 A file that is read by an interpreter (e.g., awk). The first line of the 690 shell script includes a reference to its interpreter binary. 691 692------------------------------------------------------------------------------- 693 694Terminology 695 696can 697 698 Describes a permissible optional feature or behavior available to the user 699 or application. The feature or behavior is mandatory for an implementation 700 that conforms to this document. An application can rely on the existence of 701 the feature or behavior. 702 703implementation-defined 704 705 Describes a value or behavior that is not defined by this document but is 706 selected by an implementor. The value or behavior may vary among 707 implementations that conform to this document. An application should not 708 rely on the existence of the value or behavior. An application that relies 709 on such a value or behavior cannot be assured to be portable across 710 conforming implementations. The implementor shall document such a value or 711 behavior so that it can be used correctly by an application. 712 713 Same as implementation-dependent. 714 715may 716 717 Describes a feature or behavior that is optional for an implementation that 718 conforms to this document. An application should not rely on the existence 719 of the feature or behavior. An application that relies on such a feature or 720 behavior cannot be assured to be portable across conforming 721 implementations. 722 723 To avoid ambiguity, the opposite of may is expressed as need not, instead 724 of may not. 725 726must 727 728 Describes a feature or behavior that is mandatory for an application or 729 user. An implementation that conforms to this document shall support this 730 feature or behavior. 731 732shall 733 734 Describes a feature or behavior that is mandatory for an implementation 735 that conforms to this document. An application can rely on the existence of 736 the feature or behavior. 737 738should 739 740 For an implementation that conforms to this document, describes a feature 741 or behavior that is recommended but not mandatory. An application should 742 not rely on the existence of the feature or behavior. An application that 743 relies on such a feature or behavior cannot be assured to be portable 744 across conforming implementations. 745 746 For an application, describes a feature or behavior that is recommended 747 programming practice for optimum portability. 748 749undefined 750 751 Describes the nature of a value or behavior not defined by this document 752 which results from use of an invalid program construct or invalid data 753 input. The value or behavior may vary among implementations that conform to 754 this document. An application should not rely on the existence or validity 755 of the value or behavior. An application that relies on any particular 756 value or behavior cannot be assured to be portable across conforming 757 implementations. 758 759unspecified 760 761 Describes the nature of a value or behavior not specified by this document 762 which results from use of a valid program construct or valid data input. 763 The value or behavior may vary among implementations that conform to this 764 document. An application should not rely on the existence or validity of 765 the value or behavior. An application that relies on any particular value 766 or behavior cannot be assured to be portable across conforming 767 implementations. 768 769will 770 771 Same meaning as shall; shall is the preferred term. 772 773II. Object Format 774 775Table of Contents 7762. Object Files 7773. Sections 7784. Special Sections 7795. Symbol Mapping 7806. Symbol Versioning 7817. ABI note tag 782 783------------------------------------------------------------------------------- 784 785Chapter 2. Object Files 786 787LSB-conforming implementations shall support the object file Executable and 788Linking Format (ELF), which is defined by the following documents: 789 790 * System V Application Binary Interface, Edition 4.1 791 792 * System V Application Binary Interface - DRAFT - April 29, 1998 793 794 * this document 795 796 * an architecture-specific LSB specification 797 798Conforming implementations may also support other unspecified object file 799formats. 800 801------------------------------------------------------------------------------- 802 803Chapter 3. Sections 804 805------------------------------------------------------------------------------- 806 807Sections Types 808 809A section header's sh_type member specifies the sections's semantics. 810 811------------------------------------------------------------------------------- 812 813ELF Section Types 814 815The following section types are defined in the System V Application Binary 816Interface, Edition 4.1. 817 818Table 3-1. ELF Section Types 819 820+-----------------------------------------------------------------------------+ 821| Name | Value | Description | 822|-----------------+----------+------------------------------------------------| 823|SHT_DYNAMIC |0x6 |The section holds information for dynamic | 824| | |linking. Currently, an object file may have only| 825| | |one dynamic section, but this restriction may be| 826| | |relaxed in the future. See `Dynamic Section' in | 827| | |Chapter 5 for details. | 828|-----------------+----------+------------------------------------------------| 829|SHT_DYNSYM |0xb | | 830|-----------------+----------+------------------------------------------------| 831|SHT_FINI_ARRAY |0xf |This section contains an array of pointers to | 832| | |termination functions, as described in | 833| | |`Initialization and Termination Functions' in | 834| | |Chapter 5. Each pointer in the array is taken as| 835| | |a parameterless procedure with a void return. | 836|-----------------+----------+------------------------------------------------| 837|SHT_HASH |0x5 |The section holds a symbol hash table. | 838| | |Currently, an object file may have only one hash| 839| | |table, but this restriction may be relaxed in | 840| | |the future. See `Hash Table' in the Chapter 5 | 841| | |for details. | 842|-----------------+----------+------------------------------------------------| 843|SHT_HIPROC |0x7fffffff|Values in this inclusive range are reserved for | 844| | |processor-specific semantics. | 845|-----------------+----------+------------------------------------------------| 846|SHT_HIUSER |0xffffffff|This value specifies the upper bound of the | 847| | |range of indexes reserved for application | 848| | |programs. Section types between SHT_LOUSER and | 849| | |SHT_HIUSER may be used by the application, | 850| | |without conflicting with current or future | 851| | |system-defined section types. | 852|-----------------+----------+------------------------------------------------| 853|SHT_INIT_ARRAY |0xe |This section contains an array of pointers to | 854| | |initialization functions, as described in | 855| | |`Initialization and Termination Functions' in | 856| | |Chapter 5. Each pointer in the array is taken as| 857| | |a parameterless procedure with a void return. | 858|-----------------+----------+------------------------------------------------| 859|SHT_LOPROC |0x70000000|Values in this inclusive range are reserved for | 860| | |processor-specific semantics. | 861|-----------------+----------+------------------------------------------------| 862|SHT_LOUSER |0x80000000|This value specifies the lower bound of the | 863| | |range of indexes reserved for application | 864| | |programs. | 865|-----------------+----------+------------------------------------------------| 866|SHT_NOBITS |0x8 |A section of this type occupies no space in the | 867| | |file but otherwise resembles SHT_PROGBITS. | 868| | |Although this section contains no bytes, the | 869| | |sh_offset member contains the conceptual file | 870| | |offset. | 871|-----------------+----------+------------------------------------------------| 872|SHT_NOTE |0x7 |The section holds information that marks the | 873| | |file in some way. See `Note Section' in Chapter | 874| | |5 for details. | 875|-----------------+----------+------------------------------------------------| 876|SHT_NULL |0x0 |This value marks the section header as inactive;| 877| | |it does not have an associated section. Other | 878| | |members of the section header have undefined | 879| | |values. | 880|-----------------+----------+------------------------------------------------| 881|SHT_PREINIT_ARRAY|0x10 |This section contains an array of pointers to | 882| | |functions that are invoked before all other | 883| | |initialization functions, as described in | 884| | |`Initialization and Termination Functions' in | 885| | |Chapter 5. Each pointer in the array is taken as| 886| | |a parameterless proceure with a void return. | 887|-----------------+----------+------------------------------------------------| 888|SHT_PROGBITS |0x1 |The section holds information defined by the | 889| | |program, whose format and meaning are determined| 890| | |solely by the program. | 891|-----------------+----------+------------------------------------------------| 892|SHT_REL |0x9 |The section holds relocation entries without | 893| | |explicit addends, such as type Elf32_Rel for the| 894| | |32-bit class of object files or type Elf64_Rel | 895| | |for the 64-bit class of object files. An object | 896| | |file may have multiple relocation sections. See | 897| | |"Relocation" | 898|-----------------+----------+------------------------------------------------| 899|SHT_RELA |0x4 |The section holds relocation entries with | 900| | |explicit addends, such as type Elf32_Rela for | 901| | |the 32-bit class of object files or type | 902| | |Elf64_Rela for the 64-bit class of object files.| 903| | |An object file may have multiple relocation | 904| | |sections. `Relocation' b | 905|-----------------+----------+------------------------------------------------| 906|SHT_SHLIB |0xa |This section type is reserved but has | 907| | |unspecified semantics. | 908|-----------------+----------+------------------------------------------------| 909|SHT_STRTAB |0x3 |The section holds a string table. An object file| 910| | |may have multiple string table sections. See | 911| | |`String Table' below for details. | 912|-----------------+----------+------------------------------------------------| 913|SHT_SYMTAB |0x2 |These sections hold a symbol table. Currently, | 914| | |an object file may have only one section of each| 915| | |type, but this restriction may be relaxed in the| 916| | |future. Typically, SHT_SYMTAB provides symbols | 917| | |for link editing, though it may also be used for| 918| | |dynamic linking. | 919+-----------------------------------------------------------------------------+ 920 921 922------------------------------------------------------------------------------- 923 924Additional Section Types 925 926The following additional section types are defined here. 927 928Table 3-2. Additional Section Types 929 930+-----------------------------------------------------------------------------+ 931| Name | Value | Description | 932|---------------+----------+--------------------------------------------------| 933|SHT_GNU_verdef |0x6ffffffd|This section contains the symbol versions that are| 934| | |provided. | 935|---------------+----------+--------------------------------------------------| 936|SHT_GNU_verneed|0x6ffffffe|This section contains the symbol versions that are| 937| | |required. | 938|---------------+----------+--------------------------------------------------| 939|SHT_GNU_versym |0x6fffffff|This section contains the Symbol Version Table. | 940+-----------------------------------------------------------------------------+ 941 942 943------------------------------------------------------------------------------- 944 945Chapter 4. Special Sections 946 947Special Sections 948 949Various sections hold program and control information. Sections in the lists 950below are used by the system and have the indicated types and attributes. 951 952------------------------------------------------------------------------------- 953 954ELF Special Sections 955 956The following sections are defined in the System V Application Binary 957Interface, Edition 4.1. 958 959Table 4-1. ELF Special Sections 960 961+--------------------------------------------------------+ 962| Name | Type | Attributes | 963|--------------+-----------------+-----------------------| 964|.bss |SHT_NOBITS |SHF_ALLOC+SHF_WRITE | 965|--------------+-----------------+-----------------------| 966|.comment |SHT_PROGBITS |0 | 967|--------------+-----------------+-----------------------| 968|.data |SHT_PROGBITS |SHF_ALLOC+SHF_WRITE | 969|--------------+-----------------+-----------------------| 970|.data1 |SHT_PROGBITS |SHF_ALLOC+SHF_WRITE | 971|--------------+-----------------+-----------------------| 972|.debug |SHT_PROGBITS |0 | 973|--------------+-----------------+-----------------------| 974|.dynamic |SHT_DYNAMIC |SHF_ALLOC+SHF_WRITE | 975|--------------+-----------------+-----------------------| 976|.dynstr |SHT_STRTAB |SHF_ALLOC | 977|--------------+-----------------+-----------------------| 978|.dynsym |SHT_DYNSYM |SHF_ALLOC | 979|--------------+-----------------+-----------------------| 980|.fini |SHT_PROGBITS |SHF_ALLOC+SHF_EXECINSTR| 981|--------------+-----------------+-----------------------| 982|.fini_array |SHT_FINI_ARRAY |SHF_ALLOC+SHF_WRITE | 983|--------------+-----------------+-----------------------| 984|.hash |SHT_HASH |SHF_ALLOC | 985|--------------+-----------------+-----------------------| 986|.init |SHT_PROGBITS |SHF_ALLOC+SHF_EXECINSTR| 987|--------------+-----------------+-----------------------| 988|.init_array |SHT_INIT_ARRAY |SHF_ALLOC+SHF_WRITE | 989|--------------+-----------------+-----------------------| 990|.interp |SHT_PROGBITS |SHF_ALLOC | 991|--------------+-----------------+-----------------------| 992|.line |SHT_PROGBITS |0 | 993|--------------+-----------------+-----------------------| 994|.note |SHT_NOTE |0 | 995|--------------+-----------------+-----------------------| 996|.preinit_array|SHT_PREINIT_ARRAY|SHF_ALLOC+SHF_WRITE | 997|--------------+-----------------+-----------------------| 998|.rodata |SHT_PROGBITS |SHF_ALLOC | 999|--------------+-----------------+-----------------------| 1000|.rodata1 |SHT_PROGBITS |SHF_ALLOC | 1001|--------------+-----------------+-----------------------| 1002|.shstrtab |SHT_STRTAB |0 | 1003|--------------+-----------------+-----------------------| 1004|.strtab |SHT_STRTAB |SHF_ALLOC | 1005|--------------+-----------------+-----------------------| 1006|.symtab |SHT_SYMTAB |SHF_ALLOC | 1007|--------------+-----------------+-----------------------| 1008|.text |SHT_PROGBITS |SHF_ALLOC+SHF_EXECINSTR| 1009+--------------------------------------------------------+ 1010 1011.bss 1012 1013 This section holds uninitialized data that contribute to the program's 1014 memory image. By definition, the system initializes the data with zeros 1015 when the program begins to run. The section occupies no file space, as 1016 indicated by the section type, SHT_NOBITS 1017 1018.comment 1019 1020 This section holds version control information. 1021 1022.data 1023 1024 This section holds initialized data that contribute to the program's memory 1025 image. 1026 1027.data1 1028 1029 This section holds initialized data that contribute to the program's memory 1030 image. 1031 1032.debug 1033 1034 This section holds information for symbolic debugging. The contents are 1035 unspecified. All section names with the prefix .debug are reserved for 1036 future use in the ABI. 1037 1038.dynamic 1039 1040 This section holds dynamic linking information. The section's attributes 1041 will include the SHF_ALLOC bit. Whether the SHF_WRITE bit is set is 1042 processor specific. See Chapter 5 for more information. 1043 1044.dynstr 1045 1046 This section holds strings needed for dynamic linking, most commonly the 1047 strings that represent the names associated with symbol table entries. See 1048 Chapter 5 for more information. 1049 1050.dynsym 1051 1052 This section holds the dynamic linking symbol table, as described in 1053 `Symbol Table'. See Chapter 5 for more information. 1054 1055.fini 1056 1057 This section holds executable instructions that contribute to the process 1058 termination code. That is, when a program exits normally, the system 1059 arranges to execute the code in this section. 1060 1061.fini_array 1062 1063 This section holds an array of function pointers that contributes to a 1064 single termination array for the executable or shared object containing the 1065 section. 1066 1067.hash 1068 1069 This section holds a symbol hash table. See `Hash Table' in Chapter 5 for 1070 more information. 1071 1072.init 1073 1074 This section holds executable instructions that contribute to the process 1075 initialization code. When a program starts to run, the system arranges to 1076 execute the code in this section before calling the main program entry 1077 point (called main for C programs) 1078 1079.init_array 1080 1081 This section holds an array of function pointers that contributes to a 1082 single initialization array for the executable or shared object containing 1083 the section. 1084 1085.interp 1086 1087 This section holds the path name of a program interpreter. If the file has 1088 a loadable segment that includes relocation, the sections' attributes will 1089 include the SHF_ALLOC bit; otherwise, that bit will be off. See Chapter 5 1090 for more information. 1091 1092.line 1093 1094 This section holds line number information for symbolic debugging, which 1095 describes the correspondence between the source program and the machine 1096 code. The contents are unspecified. 1097 1098.note 1099 1100 This section holds information in the format that `Note Section' in Chapter 1101 5 describes of the System V Application Binary Interface, Edition 4.1. 1102 1103.preinit_array 1104 1105 This section holds an array of function pointers that contributes to a 1106 single pre-initialization array for the executable or shared object 1107 containing the section. 1108 1109.rodata 1110 1111 This section holds read-only data that typically contribute to a 1112 non-writable segment in the process image. See `Program Header' in Chapter 1113 5 for more information. 1114 1115.rodata1 1116 1117 This section hold sread-only data that typically contribute to a 1118 non-writable segment in the process image. See `Program Header' in Chapter 1119 5 for more information. 1120 1121.shstrtab 1122 1123 This section holds section names. 1124 1125.strtab 1126 1127 This section holds strings, most commonly the strings that represent the 1128 names associated with symbol table entries. If the file has a loadable 1129 segment that includes the symbol string table, the section's attributes 1130 will include the SHF_ALLOC bit; otherwi 1131 1132.symtab 1133 1134 This section holds a symbol table, as `Symbol Table'. in this chapter 1135 describes. If the file has a loadable segment that includes the symbol 1136 table, the section's attributes will include the SHF_ALLOC bit; otherwise, 1137 that bit will be off. 1138 1139.text 1140 1141 This section holds the `text,' or executable instructions, of a program. 1142 1143 1144 1145------------------------------------------------------------------------------- 1146 1147Additional Special Sections 1148 1149The following additional sections are defined here. 1150 1151Table 4-2. Additional Special Sections 1152 1153+--------------------------------------------------+ 1154| Name | Type | Attributes | 1155|--------------+---------------+-------------------| 1156|.ctors |SHT_PROGBITS |SHF_ALLOC+SHF_WRITE| 1157|--------------+---------------+-------------------| 1158|.dtors |SHT_PROGBITS |SHF_ALLOC+SHF_WRITE| 1159|--------------+---------------+-------------------| 1160|.eh_frame |SHT_PROGBITS |SHF_ALLOC+SHF_WRITE| 1161|--------------+---------------+-------------------| 1162|.gnu.version |SHT_GNU_versym |SHF_ALLOC | 1163|--------------+---------------+-------------------| 1164|.gnu.version_d|SHT_GNU_verdef |SHF_ALLOC | 1165|--------------+---------------+-------------------| 1166|.gnu.version_r|SHT_GNU_verneed|SHF_ALLOC | 1167|--------------+---------------+-------------------| 1168|.note.ABI-tag |SHT_NOTE |SHF_ALLOC | 1169|--------------+---------------+-------------------| 1170|.stab |SHT_PROGBITS |0 | 1171|--------------+---------------+-------------------| 1172|.stabstr |SHT_STRTAB |0 | 1173+--------------------------------------------------+ 1174 1175.ctors 1176 1177 This section contains a list of global constructor function pointers. 1178 1179.dtors 1180 1181 This section contains a list of global destructor function pointers. 1182 1183.eh_frame 1184 1185 This section contains information necessary for frame unwinding during 1186 exception handling. The format is the same as for .debug_frame as described 1187 by DWARF2. 1188 1189.gnu.version 1190 1191 This section contains the Symbol Version Table. 1192 1193.gnu.version_d 1194 1195 This section contains the Version Definitions. 1196 1197.gnu.version_r 1198 1199 This section contains the Version Requirments. 1200 1201.note.ABI-tag 1202 1203 Specify ABI details. 1204 1205.stab 1206 1207 This section contains debugging information. The contents are not specified 1208 as part of the LSB. 1209 1210.stabstr 1211 1212 This section contains strings associated with the debugging infomation 1213 contained in the .stab section. 1214 1215 1216 1217------------------------------------------------------------------------------- 1218 1219Chapter 5. Symbol Mapping 1220 1221This chapter defines how names are mapped from the source symbol to the object 1222symbol. 1223 1224------------------------------------------------------------------------------- 1225 1226Symbol Mapping 1227 1228Symbols in a source program are translated by the compilation system into 1229symbols that exist in the object file. The rules for this translation are 1230defined here. 1231 1232------------------------------------------------------------------------------- 1233 1234C Language 1235 1236External C symbols have the same names in C and object files' symbol tables. 1237 1238------------------------------------------------------------------------------- 1239 1240C++ Language 1241 1242Because of the immaturity of the C++ ABI (for name mangling, exception 1243handling, and other such issues), we do not standardize any libraries for C++ 1244in this version of the Linux Standard Base. [1] 1245 1246In a future version of this specification, name mangling rules will be 1247specified so that C++ symbols can be mapped into symbol names in the object 1248file. 1249 1250------------------------------------------------------------------------------- 1251 1252Chapter 6. Symbol Versioning 1253 1254This chapter describes the Symbol Versioning mechanism. All ELF objects may 1255provide or depend on versioned symbols. Symbol Versioning is implemented by 3 1256section types: SHT_GNU_versym, SHT_GNU_verdef, and SHT_GNU_verneed. 1257 1258The term "Elfxx" means "Elf32" or "Elf64" depending on the architecture. 1259 1260Versions are described by strings. The structures that are used for symbol 1261versions also contain a member that holds the ELF hashing values of the 1262strings. This allows for more efficient processing. 1263 1264------------------------------------------------------------------------------- 1265 1266Symbol Version Table 1267 1268The Symbol Version Table is contained in the special section .gnu.version which 1269has a section type of SHT_GNU_versym. This section has the same number of 1270entries as the Dynamic Symbol Table. 1271 1272This section contains an array of elements of type Elfxx_Half. Each entry 1273specifies the version defined for or required by the corresponding symbol in 1274the Dynamic Symbol Table. 1275 1276The values in the Symbol Version Table are unique to the object in which they 1277are located. These values are identifiers that are provided by the the 1278vna_other member of the Elfxx_Vernaux structure or the vd_ndx member of the 1279Elfxx_Verdef structure. 1280 1281The values 0 and 1 are reserved. 1282 12830 1284 1285 The symbol is local, not available outside the object. 1286 12871 1288 1289 The symbol is defined in this object and is globally available. 1290 1291All other values are used to identify version strings located in one of the 1292other Symbol Version sections. The value itself is not the version associated 1293with the symbol. The string identified by the value defines the version of the 1294symbol. 1295 1296------------------------------------------------------------------------------- 1297 1298Version Definitions 1299 1300Symbol definitions are contained in the special section .gnu.version_d which 1301has a section type of SHT_GNU_verdef. The number of entries in this section is 1302contained in the DT_VERDEFNUM entry of the Dynamic Section. The sh_link member 1303of the section header points to the section that contains the strings 1304referenced by this section. 1305 1306Figure 6-1. Version Definition Entries 1307 1308typedef struct { 1309 Elfxx_Half vd_version; 1310 Elfxx_Half vd_flags; 1311 Elfxx_Half vd_ndx; 1312 Elfxx_Half vd_cnt; 1313 Elfxx_Word vd_hash; 1314 Elfxx_Word vd_aux; 1315 Elfxx_Word vd_next; 1316} Elfxx_Verdef; 1317 1318vd_version 1319 1320 Version revision. This value is currently set to 1, and will be reset if 1321 the versioning implementation is incompatibly altered. 1322 1323vd_flags 1324 1325 Version information flag bitmask. 1326 1327vd_ndx 1328 1329 Version index numeric value referencing the SHT_GNU_versym section. 1330 1331vd_cnt 1332 1333 Number of associated verdaux array entries. 1334 1335vd_hash 1336 1337 Version name hash value (ELF hash function). 1338 1339vd_aux 1340 1341 Offset to a corresponding entry in the verdaux array, in bytes. 1342 1343vd_next 1344 1345 Offset to the next verdef entry, in bytes. 1346 1347Figure 6-2. Version Definition Auxiliary Entries 1348 1349typedef struct { 1350 Elfxx_Word vda_name; 1351 Elfxx_Word vda_next; 1352} Elfxx_Verdaux; 1353 1354vda_name 1355 1356 Offset to the version or dependency name string in the section header, in 1357 bytes. 1358 1359vda_next 1360 1361 Offset to the next verdaux entry, in bytes. 1362 1363------------------------------------------------------------------------------- 1364 1365Version Requirements 1366 1367Symbol definitions are contained in the special section .gnu.version_r which 1368has a section type of SHT_GNU_verneed. The number of entries in this section is 1369contained in the DT_VERNEEDNUM entry of the Dynamic Section. The sh_link member 1370of the section header points to the section that contains the strings 1371referenced by this section. 1372 1373Figure 6-3. Version Needed Entries 1374 1375typedef struct { 1376 Elfxx_Half vn_version; 1377 Elfxx_Half vn_cnt; 1378 Elfxx_Word vn_file; 1379 Elfxx_Word vn_aux; 1380 Elfxx_Word vn_next; 1381} Elfxx_Verneed; 1382 1383vn_version 1384 1385 Version of structure. This value is currently set to 1, and will be reset 1386 if the versioning implementation is incompatibly altered. 1387 1388vn_cnt 1389 1390 Number of associated verneed array entries. 1391 1392vn_file 1393 1394 Offset to the file name string in the section header, in bytes. 1395 1396vn_aux 1397 1398 Offset to a corresponding entry in the vernaux array, in bytes. 1399 1400vn_next 1401 1402 Offset to the next verneed entry, in bytes. 1403 1404Figure 6-4. Version Needed Auxiliary Entries 1405 1406typedef struct { 1407 Elfxx_Word vna_hash; 1408 Elfxx_Half vna_flags; 1409 Elfxx_Half vna_other; 1410 Elfxx_Word vna_name; 1411 Elfxx_Word vna_next; 1412} Elfxx_Vernaux; 1413 1414vna_hash 1415 1416 Dependency name hash value (ELF hash function). 1417 1418vna_flags 1419 1420 Dependency information flag bitmask. 1421 1422vna_other 1423 1424 Object file version identifier used in the .gnu.version symbol version 1425 array. Bit number 15 controls whether or not the object is hidden; if this 1426 bit is set, the object cannot be used and the static linker will ignore the 1427 symbol's presence in the object. 1428 1429vna_name 1430 1431 Offset to the dependency name string in the section header, in bytes. 1432 1433vna_next 1434 1435 Offset to the next vernaux entry, in bytes. 1436 1437------------------------------------------------------------------------------- 1438 1439Startup Sequence 1440 1441When loading a sharable object, version definition data from the loaded object 1442is analyzed to assure that it meets the version requirements of the calling 1443object. The dynamic loader retrieves the entries in the caller's Elfxx_Verneed 1444array and attempts to find matching definition information in the loaded 1445Elfxx_Verdef table. 1446 1447Each object and dependency is tested in turn. If a symbol definition is 1448missing, the loader returns an error. A warning is issued instead of a hard 1449error when the vna_flags bit for VER_FLG_WEAK is set in the Elfxx_Vernaux 1450entry. 1451 1452When the versions referenced by undefined symbols in the loaded object are 1453found, version availability is certified. The test completes without error and 1454the object is made available. 1455 1456------------------------------------------------------------------------------- 1457 1458Symbol Resolution 1459 1460When symbol versioning is used in an object, relocations extend the performance 1461of definition testing beyond the simple match of symbol name strings: the 1462version of the reference must also equal the name of the definition. The same 1463index that is used in the symbol table can be referenced in the SHT_GNU_versym 1464section, and the value of this index is then used to acquire name data. The 1465corresponding requirement string is retrieved from the Elfxx_Verneed array, and 1466likewise, the corresponding definition string from the Elfxx_Verdef table. 1467 1468Bit number 15 of the version symbol controls whether or not the object is 1469hidden; if this bit is set, the object cannot be used and the static linker 1470will ignore the symbol's presence in the object. 1471 1472Results differ in the interaction of objects that variously use symbol 1473versioning. 1474 1475 * The object with the reference and the object with the definitions may both 1476 use versioning. All described matching is processed in this case. A fatal 1477 error is triggered when no matching definition can be found in the object 1478 whose name is the one referenced by the vn_name element in the 1479 Elfxx_Verneed entry. 1480 1481 * The object with the reference may not use versioning, while the object with 1482 the definitions does. In this instance, only the definition with index 1483 numbers 1 and 2 will be used in the reference match, the same identified by 1484 the static linker as the base definition. In infrequent cases where the 1485 static linker was not used, as in calls to dlopen(), a version that does 1486 not have the base definition index is acceptable as long as it is the only 1487 version for which the symbol is defined. 1488 1489 * The object with the reference may use versioning, but the object with the 1490 definitions specifies none. A matching symbol is accepted in this case. A 1491 fatal error is triggered in the unlikely event that a corruption in the 1492 required symbols list obscured an outdated object file and caused a match 1493 on the object filename in the Elfxx_Verneed entry. 1494 1495 * Finally, both the object with the reference and the object with the 1496 definitions may not use versioning. The behavior in this instance defaults 1497 to pre-existing symbol rules. 1498 1499------------------------------------------------------------------------------- 1500 1501Chapter 7. ABI note tag 1502 1503Every executable shall contain a section named .note.ABI-tag of type SHT_NOTE. 1504This section is structured as a note section as documented in the ELF spec. The 1505section must contain at least the following entry. The name field (namesz/name) 1506contains the string "GNU". The type field shall be 1. The descsz field shall be 1507at least 16, and the first 16 bytes of the desc field shall be as follows. 1508 1509The first 32-bit word of the desc field must be 0 (this signifies a Linux 1510executable). The second, third, and fourth 32-bit words of the desc field 1511contain the earliest compatible kernel version. For example, if the 3 words are 15122, 2, and 5, this signifies a 2.2.5 kernel. 1513 1514III. Dynamic Linking 1515 1516Table of Contents 15178. Program Loading and Dynamic Linking 15189. Dynamic Entries 151910. Program Interpreter 1520 1521------------------------------------------------------------------------------- 1522 1523Chapter 8. Program Loading and Dynamic Linking 1524 1525LSB-conforming implementations shall support the object file information and 1526system actions that create running programs as specified in the System V 1527Application Binary Interface, Edition 4.1 and the System V Application Binary 1528Interface - DRAFT - April 29, 1998 and as supplemented by this document and an 1529architecture-specific LSB specification. 1530 1531Any shared object that is loaded must contain sufficient DT_NEEDED records to 1532satisfy the symbols on the shared library. 1533 1534------------------------------------------------------------------------------- 1535 1536Chapter 9. Dynamic Entries 1537 1538A dynamic entry's d_tag member control the interpretation of d_un. 1539 1540------------------------------------------------------------------------------- 1541 1542Dynamic Entries 1543 1544------------------------------------------------------------------------------- 1545 1546ELF Dynamic Entries 1547 1548The following dynamic entries are defined in the System V Application Binary 1549Interface, Edition 4.1. 1550 1551DT_BIND_NOW 1552 1553 Process relocations of object 1554 1555DT_DEBUG 1556 1557 For debugging; unspecified 1558 1559DT_FINI 1560 1561 Address of termination function 1562 1563DT_HASH 1564 1565 Address of symbol hash table 1566 1567DT_HIPROC 1568 1569 End of processor-specific 1570 1571DT_INIT 1572 1573 Address of init function 1574 1575DT_JMPREL 1576 1577 Address of PLT relocs 1578 1579DT_LOPROC 1580 1581 Start of processor-specific 1582 1583DT_NEEDED 1584 1585 Name of needed library 1586 1587DT_NULL 1588 1589 Marks end of dynamic section 1590 1591DT_PLTREL 1592 1593 Type of reloc in PLT 1594 1595DT_PLTRELSZ 1596 1597 Size in bytes of PLT relocs 1598 1599DT_REL 1600 1601 Address of Rel relocs 1602 1603DT_RELA 1604 1605 Address of Rela relocs 1606 1607DT_RELAENT 1608 1609 Size of one Rela reloc 1610 1611DT_RELASZ 1612 1613 Total size of Rela relocs 1614 1615DT_RELENT 1616 1617 Size of one Rel reloc 1618 1619DT_RELSZ 1620 1621 Total size of Rel relocs 1622 1623DT_RPATH 1624 1625 Library search path 1626 1627DT_SONAME 1628 1629 Name of shared object 1630 1631DT_STRSZ 1632 1633 Size of string table 1634 1635DT_STRTAB 1636 1637 Address of string table 1638 1639DT_SYMBOLIC 1640 1641 Start symbol search here 1642 1643DT_SYMENT 1644 1645 Size of one symbol table entry 1646 1647DT_SYMTAB 1648 1649 Address of symbol table 1650 1651DT_TEXTREL 1652 1653 Reloc might modify .text 1654 1655 1656 1657------------------------------------------------------------------------------- 1658 1659Additional Dynamic Entries 1660 1661The following dynamic entries are defined here. 1662 1663DT_ADDRRNGHI 1664 1665 Values from DT_ADDRRNGLO through DT_ADDRRNGHI are reserved for definition 1666 by an archLSB. 1667 1668DT_ADDRRNGLO 1669 1670 Values from DT_ADDRRNGLO through DT_ADDRRNGHI are reserved for definition 1671 by an archLSB. 1672 1673DT_AUXILIARY 1674 1675 Shared object to load before self 1676 1677DT_FILTER 1678 1679 Shared object to get values from 1680 1681DT_FINI_ARRAY 1682 1683 The address of an array of pointers to termination functions. 1684 1685DT_FINI_ARRAYSZ 1686 1687 Size in bytes of DT_FINI_ARRAY 1688 1689DT_HIOS 1690 1691 Values from DT_LOOS through DT_HIOS are reserved for definition by specific 1692 operating systems. 1693 1694DT_INIT_ARRAY 1695 1696 The address of an array of pointers to initialization functions. 1697 1698DT_INIT_ARRAYSZ 1699 1700 Size in bytes of DT_INIT_ARRAY 1701 1702DT_LOOS 1703 1704 Values from DT_LOOS through DT_HIOS are reserved for definition by specific 1705 operating systems. 1706 1707DT_NUM 1708 1709 Number of dynamic entry tags defined (excepting reserved ranges). 1710 1711DT_RELCOUNT 1712 1713 All Elf32_Rel R_*_RELATIVE relocations have been placed into a single block 1714 and this entry specifies the number of entries in that block. This permits 1715 ld.so.1 to streamline the processing of RELATIVE relocations. 1716 1717DT_SYMINENT 1718 1719 Entry size of syminfo 1720 1721DT_SYMINFO 1722 1723 Address of the Syminfo table. 1724 1725DT_SYMINSZ 1726 1727 Size of syminfo table (in bytes) 1728 1729DT_VALRNGHI 1730 1731 Entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val 1732 field of the Elf*_Dyn structure. 1733 1734DT_VALRNGLO 1735 1736 Entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val 1737 field of the Elf*_Dyn structure. 1738 1739DT_VERDEF 1740 1741 Address of version definition table 1742 1743DT_VERDEFNUM 1744 1745 Number of version definitions 1746 1747DT_VERNEED 1748 1749 Address of table with needed versions 1750 1751DT_VERNEEDNUM 1752 1753 Number of needed versions 1754 1755DT_VERSYM 1756 1757 Address of the table provided by the .gnu.version section. 1758 1759 1760 1761------------------------------------------------------------------------------- 1762 1763Chapter 10. Program Interpreter 1764 1765------------------------------------------------------------------------------- 1766 1767The Program Interpreter is specified in the appropriate architecture-specific 1768LSB specification. 1769 1770IV. Base Libraries 1771 1772Table of Contents 177311. Libraries 1774 1775------------------------------------------------------------------------------- 1776 1777Chapter 11. Libraries 1778 1779An LSB-conforming implementation shall support some base libraries which 1780provide interfaces for accessing the operating system, processor and other 1781hardware in the system. 1782 1783------------------------------------------------------------------------------- 1784 1785Interfaces for libc 1786 1787Table 11-1. libc Definition 1788 1789+----------------------+ 1790|Library:|libc | 1791|--------+-------------| 1792|SONAME: |See archLSB. | 1793+----------------------+ 1794 1795The behavior of the interfaces in this library is specified by the following 1796standards. 1797 1798ISO/IEC 9899: 1999, Programming Languages --C[2] 1799Large File Support[3] 1800LI18NUX 2000 Globalization Specification, Version 1.0 with Amendment 4[4] 1801Linux Standard Base[5] 1802IEEE Std POSIX.1-1996 [ISO/IEC 9945-1:1996][6] 1803CAE Specification, February 1997, Networking Services (XNS), Issue 5 (ISBN: 18041-85912-165-9, C523)[7] 1805CAE Specification, January 1997, System Interfaces and Headers (XSH), Issue 5 1806(ISBN: 1-85912-181-0, C606)[8] 1807System V Interface Definition, Issue 3 (ISBN 0201566524)[9] 1808System V Interface Definition,Fourth Edition[10] 1809 1810------------------------------------------------------------------------------- 1811 1812RPC 1813 1814Table 11-2. libc - RPC Function Interfaces 1815 1816+-----------------------------------------------------------------------------------+ 1817|authnone_create |setdomainname[5] |xdr_array |xdr_int[9] |xdr_u_char[9] | 1818|[10] | |[9] | | | 1819|------------------+------------------+-----------+------------------+--------------| 1820|clnt_create[10] |svc_getreqset[9] |xdr_bool[9]|xdr_long[9] |xdr_u_long[9] | 1821|------------------+------------------+-----------+------------------+--------------| 1822|clnt_pcreateerror |svcerr_auth[9] |xdr_bytes |xdr_opaque[9] |xdr_u_short[9]| 1823|[10] | |[9] | | | 1824|------------------+------------------+-----------+------------------+--------------| 1825|clnt_perrno[10] |svcerr_decode[9] |xdr_callhdr|xdr_opaque_auth[9]|xdr_union[9] | 1826| | |[9] | | | 1827|------------------+------------------+-----------+------------------+--------------| 1828|clnt_perror[10] |svcerr_noproc[9] |xdr_callmsg|xdr_pointer[9] |xdr_vector[9] | 1829| | |[9] | | | 1830|------------------+------------------+-----------+------------------+--------------| 1831|clnt_spcreateerror|svcerr_noprog[9] |xdr_char[9]|xdr_reference[9] |xdr_void[9] | 1832|[10] | | | | | 1833|------------------+------------------+-----------+------------------+--------------| 1834|clnt_sperrno[10] |svcerr_progvers[9]|xdr_double |xdr_rejected_reply|xdr_wrapstring| 1835| | |[9] |[9] |[9] | 1836|------------------+------------------+-----------+------------------+--------------| 1837|clnt_sperror[10] |svcerr_systemerr |xdr_enum[9]|xdr_replymsg[9] |xdrmem_create | 1838| |[9] | | |[9] | 1839|------------------+------------------+-----------+------------------+--------------| 1840|getdomainname[5] |svcerr_weakauth[9]|xdr_float |xdr_short[9] |xdrrec_create | 1841| | |[9] | |[9] | 1842|------------------+------------------+-----------+------------------+--------------| 1843|key_decryptsession|xdr_accepted_reply|xdr_free[9]|xdr_string[9] |xdrrec_eof[9] | 1844|[9] |[9] | | | | 1845+-----------------------------------------------------------------------------------+ 1846------------------------------------------------------------------------------- 1847 1848System Calls 1849 1850Table 11-3. libc - System Calls Function Interfaces 1851 1852+-----------------------------------------------------------------------------+ 1853|__fxstat[5] |fchown[8] |ioctl[8] |readdir[8] |setsid[8] | 1854|------------+-------------+-------------+------------------------+-----------| 1855|__getpgid[5]|fcntl[8] |kill[5] |readdir_r[8] |setuid[8] | 1856|------------+-------------+-------------+------------------------+-----------| 1857|__lxstat[5] |fdatasync[8] |killpg[8] |readlink[8] |sleep[8] | 1858|------------+-------------+-------------+------------------------+-----------| 1859|__xmknod[5] |flock[5] |lchown[8] |readv[8] |statfs[5] | 1860|------------+-------------+-------------+------------------------+-----------| 1861|__xstat[5] |fork[8] |link[8] |rename[8] |statvfs[8] | 1862|------------+-------------+-------------+------------------------+-----------| 1863|access[8] |fstatfs[5] |lockf[8] |rmdir[8] |stime[5] | 1864|------------+-------------+-------------+------------------------+-----------| 1865|acct[5] |fsync[8] |lseek[8] |sbrk[8] |symlink[8] | 1866|------------+-------------+-------------+------------------------+-----------| 1867|alarm[8] |ftime[8] |mkdir[8] |sched_get_priority_max |sync[8] | 1868| | | |[8] | | 1869|------------+-------------+-------------+------------------------+-----------| 1870|brk[8] |ftruncate[8] |mkfifo[8] |sched_get_priority_min |sysconf[8] | 1871| | | |[8] | | 1872|------------+-------------+-------------+------------------------+-----------| 1873|chdir[8] |getcontext[8]|mlock[8] |sched_getparam[8] |time[8] | 1874|------------+-------------+-------------+------------------------+-----------| 1875|chmod[8] |getegid[8] |mlockall[8] |sched_getscheduler[8] |times[8] | 1876|------------+-------------+-------------+------------------------+-----------| 1877|chown[8] |geteuid[8] |mmap[8] |sched_rr_get_interval[8]|truncate[8]| 1878|------------+-------------+-------------+------------------------+-----------| 1879|chroot[8] |getgid[8] |mprotect[8] |sched_setparam[8] |ulimit[8] | 1880|------------+-------------+-------------+------------------------+-----------| 1881|clock[8] |getgroups[8] |msync[8] |sched_setscheduler[8] |umask[8] | 1882|------------+-------------+-------------+------------------------+-----------| 1883|close[8] |getitimer[8] |munlock[8] |sched_yield[8] |uname[8] | 1884|------------+-------------+-------------+------------------------+-----------| 1885|closedir[8] |getloadavg[5]|munlockall[8]|select[7] |unlink[5] | 1886|------------+-------------+-------------+------------------------+-----------| 1887|creat[8] |getpagesize |munmap[8] |setcontext[8] |utime[8] | 1888| |[8] | | | | 1889|------------+-------------+-------------+------------------------+-----------| 1890|dup[8] |getpgid[8] |nanosleep[8] |setegid[5] |utimes[8] | 1891|------------+-------------+-------------+------------------------+-----------| 1892|dup2[8] |getpgrp[8] |nice[8] |seteuid[5] |vfork[8] | 1893|------------+-------------+-------------+------------------------+-----------| 1894|execl[8] |getpid[8] |open[8] |setgid[8] |wait[8] | 1895|------------+-------------+-------------+------------------------+-----------| 1896|execle[8] |getppid[8] |opendir[8] |setitimer[8] |wait3[8] | 1897|------------+-------------+-------------+------------------------+-----------| 1898|execlp[8] |getpriority |pathconf[8] |setpgid[8] |wait4[5] | 1899| |[8] | | | | 1900|------------+-------------+-------------+------------------------+-----------| 1901|execv[8] |getrlimit[8] |pause[8] |setpgrp[8] |waitid[8] | 1902|------------+-------------+-------------+------------------------+-----------| 1903|execve[8] |getrusage[8] |pipe[8] |setpriority[8] |waitpid[8] | 1904|------------+-------------+-------------+------------------------+-----------| 1905|execvp[8] |getsid[8] |poll[8] |setregid[8] |write[8] | 1906|------------+-------------+-------------+------------------------+-----------| 1907|exit[8] |getuid[8] |pread[8] |setreuid[8] |writev[8] | 1908|------------+-------------+-------------+------------------------+-----------| 1909|fchdir[8] |getwd[8] |pwrite[8] |setrlimit[8] | | 1910|------------+-------------+-------------+------------------------+-----------| 1911|fchmod[8] |initgroups[5]|read[8] |setrlimit64[3] | | 1912+-----------------------------------------------------------------------------+ 1913------------------------------------------------------------------------------- 1914 1915Standard I/O 1916 1917Table 11-4. libc - Standard I/O Function Interfaces 1918 1919+------------------------------------------------------------------------------+ 1920|_IO_feof[5] |fgetpos[8] |fsetpos[8] |putc[8] |snprintf | 1921| | | | |[8] | 1922|----------------+----------------+----------------+----------------+----------| 1923|_IO_getc[5] |fgets[8] |fstatvfs[8] |putc_unlocked[8]|sprintf[8]| 1924|----------------+----------------+----------------+----------------+----------| 1925|_IO_putc[5] |fgetwc_unlocked |ftell[8] |putchar[8] |sscanf[8] | 1926| |[8] | | | | 1927|----------------+----------------+----------------+----------------+----------| 1928|_IO_puts[5] |fileno[8] |ftello[8] |putchar_unlocked|telldir[8]| 1929| | | |[8] | | 1930|----------------+----------------+----------------+----------------+----------| 1931|alphasort[5] |flockfile[8] |fwrite[8] |puts[8] |tempnam[8]| 1932|----------------+----------------+----------------+----------------+----------| 1933|clearerr[8] |fopen[8] |getc[8] |putw[8] |ungetc[8] | 1934|----------------+----------------+----------------+----------------+----------| 1935|ctermid[8] |fprintf[8] |getc_unlocked[8]|remove[8] |vasprintf | 1936| | | | |[5] | 1937|----------------+----------------+----------------+----------------+----------| 1938|fclose[8] |fputc[8] |getchar[8] |rewind[8] |vdprintf | 1939| | | | |[5] | 1940|----------------+----------------+----------------+----------------+----------| 1941|fdopen[8] |fputs[8] |getchar_unlocked|rewinddir[8] |vfprintf | 1942| | |[8] | |[8] | 1943|----------------+----------------+----------------+----------------+----------| 1944|feof[8] |fread[8] |gets[8] |scanf[8] |vprintf[8]| 1945|----------------+----------------+----------------+----------------+----------| 1946|ferror[8] |freopen[8] |getw[8] |seekdir[8] |vsnprintf | 1947| | | | |[8] | 1948|----------------+----------------+----------------+----------------+----------| 1949|fflush[8] |fscanf[8] |pclose[8] |setbuf[8] |vsprintf | 1950| | | | |[8] | 1951|----------------+----------------+------------