64-Bit Powerpc ELF Application Binary Interface Supplement 1.7
Total Page:16
File Type:pdf, Size:1020Kb
64-bit PowerPC ELF Application Binary Interface Supplement 1.7 Ian Lance Taylor Zembu Labs 64-bit PowerPC ELF Application Binary Interface Supplement 1.7 by Ian Lance Taylor 1.7 Edition Published Sep 15, 2003 Copyright © 1999, 2004 IBM Corporation Copyright © 2003, 2004 Free Standards Group Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available from http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/gfdl.html. The following terms are trademarks or registered trademarks of International Business Machines Corporation in the United States and/or other countires: AIX, PowerPC. A full list U.S. trademarks owned by IBM may be found at http://www.ibm.com/legal/copytrade.shtml. Revision History Revision 1.1 Revised by: David Edelsohn, IBM Research Revision 1.2 Revised by: Torbjorn Granlund, Swox AB Revision 1.3 Revised by: David Edelsohn and Mark Mendell, IBM Revision 1.4 Revised by: Alan Modra, IBM Revision 1.4.1 Revised by: Kristin Thomas, IBM Revision 1.5 Revised by: Alan Modra, IBM Revision 1.6 Revised by: Alan Modra, IBM Revision 1.7 Revised by: Alan Modra, David Edelsohn and Steven Munroe, IBM Table of Contents 1. Introduction........................................................................................................................................................1 1.1. How to Use the 64-bit PowerPC ELF ABI Supplement .........................................................................1 2. Software Installation..........................................................................................................................................2 2.1. Physical Distribution Media and Formats ...............................................................................................2 3. Low Level System Information.........................................................................................................................3 3.1. Machine Interface....................................................................................................................................3 3.1.1. Processor Architecture................................................................................................................3 3.1.2. Data Representation....................................................................................................................3 3.1.3. Byte Ordering .............................................................................................................................3 3.1.4. Fundamental Types.....................................................................................................................5 3.1.5. Extended Precision .....................................................................................................................6 3.1.6. Aggregates and Unions...............................................................................................................6 3.1.7. Bit-fields .....................................................................................................................................9 3.2. Function Calling Sequence....................................................................................................................14 3.2.1. Registers ...................................................................................................................................15 3.2.2. The Stack Frame.......................................................................................................................16 3.2.3. Parameter Passing.....................................................................................................................18 3.2.4. Return Values............................................................................................................................21 3.2.5. Function Descriptors.................................................................................................................21 3.3. Traceback Tables ...................................................................................................................................22 3.3.1. Mandatory Fields......................................................................................................................22 3.3.2. Optional Fields..........................................................................................................................24 3.4. Process Initialization .............................................................................................................................26 3.4.1. Registers ...................................................................................................................................26 3.4.2. Process Stack ............................................................................................................................27 3.5. Coding Examples ..................................................................................................................................29 3.5.1. Code Model Overview..............................................................................................................30 3.5.2. The TOC section.......................................................................................................................30 3.5.3. TOC Assembly Language Syntax ............................................................................................31 3.5.4. Function Prologue and Epilogue ..............................................................................................33 3.5.5. Register Saving and Restoring Functions.................................................................................33 3.5.6. Saving General Registers Only.................................................................................................34 3.5.7. Saving General Registers and Floating Point Registers ...........................................................34 3.5.8. Saving Floating Point Registers Only.......................................................................................35 3.5.9. Save and Restore Services ........................................................................................................35 3.5.10. Data Objects............................................................................................................................39 3.5.11. Function Calls.........................................................................................................................41 3.5.12. Branching................................................................................................................................43 3.5.13. Dynamic Stack Space Allocation ...........................................................................................44 3.6. DWARF Definition................................................................................................................................46 3.6.1. DWARF Release Number.........................................................................................................46 3.6.2. DWARF Register Number Mapping.........................................................................................46 4. Object Files.......................................................................................................................................................50 4.1. ELF Header ...........................................................................................................................................50 4.2. Special Sections.....................................................................................................................................50 4.3. TOC.......................................................................................................................................................51 4.4. Symbol Table.........................................................................................................................................52 4.4.1. Symbol Values ..........................................................................................................................52 4.5. Relocation..............................................................................................................................................52 iii 4.5.1. Relocation Types.......................................................................................................................52 5. Program Loading and Dynamic Linking.......................................................................................................61 5.1. Program Loading...................................................................................................................................61 5.1.1. Program Interpreter...................................................................................................................63 5.2. Dynamic Linking...................................................................................................................................63 5.2.1. Dynamic Section.......................................................................................................................63 5.2.2. Global Offset Table...................................................................................................................64 5.2.3. Function Addresses...................................................................................................................64