System V Application Binary Interface

Total Page:16

File Type:pdf, Size:1020Kb

System V Application Binary Interface SYSTEM V APPLICATION BINARY INTERFACE Edition 4.1 Copyright 1990−1996 The Santa Cruz Operation, Inc. All rights reserved. Copyright 1990−1992 AT&T. All rights reserved. No part of this publication may be reproduced, transmitted, stored in a retrieval system, nor translated into any human or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual, or otherwise, without the prior written permission of the copyright owner, The Santa Cruz Operation, Inc., 400 Encinal Street, Santa Cruz, California, 95060, USA. Copyright infringement is a serious matter under the United States and foreign Copyright Laws. Information in this document is subject to change without notice and does not represent a commitment on the part of The Santa Cruz Operation, Inc. SCO, the SCO logo, The Santa Cruz Operation, and UnixWare are trademarks or registered trademarks of The Santa Cruz Operation, Inc. in the USA and other countries. UNIX is a registered trademark in the USA and other countries, licensed exclusively through X/Open Company Limited. NeWS is a registered trademark of Sun Microsystems, Inc. X11 and X Window System are trademarks of Massachusetts Institute of Technology All other brand and product names are or may be trademarks of, and are used to identify products or services of, their respective owners. SCO UnixWare is commercial computer software and, together with any related documentation, is subject to the restrictions on US Government use as set forth below. If this procurement is for a DOD agency, the following DFAR Restricted Rights Legend applies: RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of Rights in Technical Data and Computer Software Clause at DFARS 252.227-7013. Contractor/Manufacturer is The Santa Cruz Operation, Inc., 400 Encinal Street, Santa Cruz, CA 95060. If this procurement is for a civilian government agency, this FAR Restricted Rights Legend applies: RESTRICTED RIGHTS LEGEND: This computer software is submitted with restricted rights under Government Contract No. _________ (and Subcontract No. ________, if appropriate). It may not be used, reproduced, or disclosed by the Government except as provided in paragraph (g)(3)(i) of FAR Clause 52.227-14 alt III or as otherwise expressly stated in the contract. Contractor/Manufacturer is The Santa Cruz Operation, Inc., 400 Encinal Street, Santa Cruz, CA 95060. If any copyrighted software accompanies this publication, it is licensed to the End User only for use in strict accordance with the End User License Agreement, which should be read carefully before commencing use of the software. ACKNOWLEDGEMENTS "We acknowledge the contributions of the 88OPEN Consortium Ltd., portions of whose System V ABI Implementation Guide for the M88000 Processor and the System V ABI M88000 Processor Networking Supplement have been incorporated in this section of the ABI with permission." DRAFT COPY March 18, 1997 File: copyright 386:adm.book:sum Page: 2 Contents Table of Contents INTRODUCTION SOFTWARE INSTALLATION LOW-LEVEL SYSTEM INFORMATION OBJECT FILES PROGRAM LOADING AND DYNAMIC LINKING LIBRARIES FORMATS AND PROTOCOLS SYSTEM COMMANDS EXECUTION ENVIRONMENT WINDOWING AND TERMINAL INTERFACES DEVELOPMENT ENVIRONMENTS FOR AN ABI SYSTEM NETWORKING Index INTRODUCTION 1 System V Application Binary Interface 1-1 Foundations and Structure of the ABI 1-2 How to Use the System V ABI 1-4 De®nitions of Terms 1-8 SOFTWARE INSTALLATION 2 Software Installation and Packaging 2-1 File Formats 2-7 File Tree for Add-on Software 2-15 Commands That Install, Remove and Access Packages 2-16 Table of Contents i DRAFT COPY March 18, 1997 File: MasterToc 386:adm.book:sum Page: 3 LOW-LEVEL SYSTEM INFORMATION 3 Introduction 3-1 Character Representations 3-2 Machine Interface (Processor-Speci®c) 3-3 Function Calling Sequence (Processor-Speci®c) 3-4 Operating System Interface (Processor-Speci®c) 3-5 Coding Examples (Processor-Speci®c) 3-6 OBJECT FILES 4 Introduction 4-1 ELF Header 4-4 Sections 4-10 String Table 4-21 Symbol Table 4-22 Relocation 4-27 PROGRAM LOADING AND DYNAMIC 5 LINKING Introduction 5-1 Program Header 5-2 Program Loading (Processor-Speci®c) 5-11 Dynamic Linking 5-12 LIBRARIES 6 Introduction 6-1 C Library 6-5 Threads Library 6-15 Dynamic Linking Library 6-17 Network Services Library 6-18 Socket Library 6-21 Curses Library 6-22 X Window System Library 6-26 X11 Nonrectangular Window Shape Extension Library 6-33 ii Table of Contents DRAFT COPY March 18, 1997 File: MasterToc 386:adm.book:sum Page: 4 X Toolkit Intrinsics Library 6-34 Motif Libraries 6-38 System Data Interfaces 6-46 FORMATS AND PROTOCOLS 7 Introduction 7-1 Archive File 7-2 Other Archive Formats 7-6 Terminfo Data Base 7-7 Formats and Protocols for Networking 7-10 SYSTEM COMMANDS 8 Commands for Application Programs 8-1 EXECUTION ENVIRONMENT 9 Application Environment 9-1 File System Structure and Contents 9-3 WINDOWING AND TERMINAL INTERFACES 10 The System V Window System 10-1 System V Window System Components 10-3 DEVELOPMENT ENVIRONMENTS FOR AN 11 ABI SYSTEM Development Environments 11-1 NETWORKING 12 Networking 12-1 Table of Contents iii DRAFT COPY March 18, 1997 File: MasterToc 386:adm.book:sum Page: 5 Required STREAMS Devices and Modules 12-2 Required Interprocess Communication Support 12-3 Required Transport Layer Support 12-4 Required Transport Loopback Support 12-7 Optional Internet Transport Support 12-8 Index IN Index IN-1 iv Table of Contents DRAFT COPY March 18, 1997 File: MasterToc 386:adm.book:sum Page: 6 Figures and Tables Figure 2-1: Package File Tree Organization 2-2 Figure 2-2: Data Stream File Layout for Distribution Media 2-4 Figure 4-1: Object File Format 4-1 Figure 4-2: 32-Bit Data Types 4-3 Figure 4-3: ELF Header 4-4 Figure 4-4: e_ i d e n t [ ] Identi®cation Indexes 4-7 Figure 4-5: Data Encoding EL F D A T A 2 L S B 4-9 Figure 4-6: Data Encoding EL F D A T A 2 M S B 4-9 Figure 4-7: Special Section Indexes 4-10 Figure 4-8: Section Header 4-12 Figure 4-9: Section Types, sh _ t y p e 4-13 Figure 4-10: Section Header Table Entry: Index 0 4-15 Figure 4-11: Section Attribute Flags, sh _ f l a g s 4-16 Figure 4-12: sh _ l i n k and sh _ i n f o Interpretation 4-17 Figure 4-13: Special Sections 4-17 Figure 4-14: String Table Indexes 4-21 Figure 4-15: Symbol Table Entry 4-22 Figure 4-16: Symbol Binding, EL F 3 2 _ S T _ B I N D 4-23 Figure 4-17: Symbol Types, EL F 3 2 _ S T _ T Y P E 4-24 Figure 4-18: Symbol Table Entry: Index 0 4-26 Figure 4-19: Relocation Entries 4-27 Figure 5-1: Program Header 5-2 Figure 5-2: Segment Types, p_ t y p e 5-3 Figure 5-3: Segment Flag Bits, p_ f l a g s 5-6 Figure 5-4: Segment Permissions 5-6 Figure 5-5: Text Segment 5-7 Figure 5-6: Data Segment 5-7 Figure 5-7: Note Information 5-8 Figure 5-8: Example Note Segment 5-9 Figure 5-9: Dynamic Structure 5-15 Figure 5-10: Dynamic Array Tags, d_ t a g 5-15 Figure 5-11: Symbol Hash Table 5-21 Figure 5-12: Hashing Function 5-22 Figure 5-13: Initialization Ordering Example 5-25 Figure 6-1: Shared Library Names 6-3 Table of Contents v DRAFT COPY March 18, 1997 File: MasterToc 386:adm.book:sum Page: 7 Figure 6-2: li b c Contents, Names without Synonyms 6-5 Figure 6-3: li b c Contents, Names with Synonyms 6-6 Figure 6-4: li b c Contents from XSH4.2, Names with Synonyms 6-8 Figure 6-5: li b c Contents, Internal Names without Synonyms 6-9 Figure 6-6: li b c Contents, Additional Services 6-11 Figure 6-7: li b c Contents, Global External Data Symbols 6-12 Figure 6-8: li b t h r e a d Contents *, Part 1 of 2 6-15 Figure 6-9: li b t h r e a d Contents *, Part 2 of 2 6-16 Figure 6-10: li b d l Contents * 6-17 Figure 6-11: li b n s l Contents, Part 1 of 3 6-18 Figure 6-12: li b n s l Contents *, Part 2 of 3 6-18 Figure 6-13: li b n s l Contents, Part 3 of 3 6-19 Figure 6-14: li b n s l Contents, Global External Data Symbols 6-20 Figure 6-15: li b s o c k e t Contents, Part 1 of 2 6-21 Figure 6-17: li b s o c k e t Contents, Part 2 of 2 6-21 Figure 6-18: li b c u r s e s Contents 6-22 Figure 6-19: li b c u r s e s Contents, Global External Data Symbols 6-25 Figure 6-20: li b X Contents 6-27 Figure 6-21: li b X Contents, Callback Function Names 6-32 Figure 6-22: li b X Contents *, Global External Data Symbols 6-32 Figure 6-23: li b X e x t Contents * 6-33 Figure 6-24: li b X t Contents 6-35 Figure 6-25: li b X t Contents, Global External Data Symbols 6-37 Figure 6-26: li b X m Contents * 6-39 Figure 6-27: li b X m Contents *, Global External Data Symbols 6-44 Figure 6-28: li b M r m Contents * 6-45 Figure 6-29: Minimum Sizes of Fundamental Data Objects 6-47 Figure 7-1: <a r .
Recommended publications
  • Linkers and Loaders Hui Chen Department of Computer & Information Science CUNY Brooklyn College
    CISC 3320 MW3 Linkers and Loaders Hui Chen Department of Computer & Information Science CUNY Brooklyn College CUNY | Brooklyn College: CISC 3320 9/11/2019 1 OS Acknowledgement • These slides are a revision of the slides by the authors of the textbook CUNY | Brooklyn College: CISC 3320 9/11/2019 2 OS Outline • Linkers and linking • Loaders and loading • Object and executable files CUNY | Brooklyn College: CISC 3320 9/11/2019 3 OS Authoring and Running a Program • A programmer writes a program in a programming language (the source code) • The program resides on disk as a binary executable file translated from the source code of the program • e.g., a.out or prog.exe • To run the program on a CPU • the program must be brought into memory, and • create a process for it • A multi-step process CUNY | Brooklyn College: CISC 3320 9/11/2019 4 OS CUNY | Brooklyn College: CISC 3320 9/11/2019 5 OS Compilation • Source files are compiled into object files • The object files are designed to be loaded into any physical memory location, a format known as an relocatable object file. CUNY | Brooklyn College: CISC 3320 9/11/2019 6 OS Relocatable Object File • Object code: formatted machine code, but typically non-executable • Many formats • The Executable and Linkable Format (ELF) • The Common Object File Format (COFF) CUNY | Brooklyn College: CISC 3320 9/11/2019 7 OS Examining an Object File • In Linux/UNIX, $ file main.o main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped $ nm main.o • Also use objdump, readelf, elfutils, hexedit • You may need # apt-get install hexedit # apt-get install elfutils CUNY | Brooklyn College: CISC 3320 9/11/2019 8 OS Linking • During the linking phase, other object files or libraries may be included as well • Example: $ g++ -o main -lm main.o sumsine.o • A program consists of one or more object files.
    [Show full text]
  • 6 Boot Loader
    BootBoot LoaderLoader 66 6.1 INTRODUCTION The Boot Loader is a utility program supplied with the ADSP-21000 Family Development Software. The loader converts an ADSP-21xxx executable program, generated by the linker, into a format which can be used to boot a target hardware system and initialize its memory. The loader’s invocation command is LDR21K. The boot loader replaces the MEM21K memory initializer used with the ADSP-21020 processor. Any executable file to be processed with the LDR21K boot loader must not be processed by MEM21K. The -nomem switch of the C compiler should be used when compiling any C source files—this switch prevents the compiler from running MEM21K. The following naming conventions are used throughout this chapter: The loader refers to LDR21K contained in the software release. The boot loader refers to the executable file that performs the memory initialization on the target. The boot file refers to the output of the loader that contains the boot loader and the formatted system configurations. Booting refers to the process of loading the boot loader, initialization system memory, and starting the application on the target. Memory is referred to as being either data memory, program memory, or internal memory. Remember that the ADSP-21020 processor has separate external program and data memories, but does not have any internal memory. The ADSP-2106x SHARC has both internal and external memory. 6 – 1 66 BootBoot LoaderLoader To use the loader, you should be familiar with the hardware requirements of booting an ADSP-21000 target. See Chapter 11 of the ADSP-2106x SHARC User’s Manual or Chapter 9 of the ADSP-21020 User’s Manual for further information.
    [Show full text]
  • Caldera Systems to Acquire Sco Server Software
    CALDERA SYSTEMS TO ACQUIRE SCO SERVER SOFTWARE AND PROFESSIONAL SERVICESDIVISIONS, PROVIDING WORLD'S LARGEST LINUX /UNIX CHANNEL Submitted by: Archetype (Text100) Wednesday, 2 August 2000 Offers First Open Internet Platform, Embracing Open Access to Linux and UNIX Technologies OREM, UT - August 2, 2000 - Caldera Systems, Inc., (Nasdaq: CALD), a "Linux for Business" leader and The Santa Cruz Operation, Inc., (SCO) (Nasdaq: SCOC), the world's leading provider of UNIX operating systems, today announced that Caldera Systems has entered into an agreement to acquire the SCO Server Software Division and the Professional Services Division. The Professional Services Division will operate as a separate business unit of Caldera, to provide services to meet the Internet and eBusiness infrastructure needs of customers. The new company will offer the industry's first comprehensive Open Internet Platform (OIP) combining Linux and UNIX server solutions and services globally. The OIP provides commercial customers and developers with a single platform that can scale from the thinnest of clients to the clustering needs of the largest data center. The Open Internet Platform combines the robust scalability of the UNIX system with the low-cost, developer-accepted Linux operating system. The products, solutions, and services developed for the Open Internet Platform will be available through more than 15,000 partners worldwide. Details of the Agreement Caldera Systems, Inc. will form a new holding company, Caldera, Inc., to acquire assets from the SCO Server Software Division plus the SCO Professional Services Division, including a highly skilled workforce, products and channel resources. Caldera, Inc. will have exclusive distribution rights for the SCO OpenServer product line, and is fully committed to servicing and supporting the SCO OpenServer customer base.
    [Show full text]
  • The Santa Cruz Operation, Inc. Products and Services
    THE SANTA CRUZ OPERATION, INC. PRODUCTS AND SERVICES PRICE LIST December 1984 sea 500 CHESTNUT STREET, P.O. BOX 1900, SANTA CRUZ, CA 95061 • (408) 425-7222 • TWX: 910-598-4510 sca SACZ TABLE of CONTENTS IBM PC, PC XT, PC Compatibles and Apple Lisa 2 1 Tandy Machines 2 AT&T Machines 3 Standard Software Products 4 DEC Systems 5 Macro Assemblers 6 SoftCare Support Services 7 The UNIX System Tutorials 8 Documentation 9 © 1984 The Santa Cruz Operation. Inc. UNIX is a trademark of AT&T Bell Laboratories. DEC is a registered trademark and PDP. Professional 350 and VAX are trademarb of Digital Equipment Corporation. IBM is a registered trademark of In:ternational Business Machines Corporation. Apple and Lisa are registered trademarks of Apple Computer. Inc. LEVEL II COBOL. FORM5-2 and ANIMATOR are trademarks of Micro Focus. Ltd. Informix is a registered trademark and Ace. ~rfonn. and C-ISAM are trademarks of Relational Database Systems. Inc. Lyrix is a trademark of The Santa Cruz Operation. Inc. Multiplan and XENIX are registered trademarks of Microsoft Corporation. ZOO, Z8001 and ZS002are registered trademarks of Zilog. Inc. Audiodigital is a trademark of User Training Corporation. TR5-80 is a registered trademark of Tandy Corporation. Sunol is a trademark of Sunol Corporation. Tecmar and MassFile are trademarks of Tecmar. Inc. Priam is a registered trademark and DataTower is a trademark of Priam Corporation. Tallgrass is a registered trademark of Tallgrass Technologies Corporation. IOMEGA is a trademark of IOMEGA Corporation. SoftCare is a service mark of The Santa Cruz Operation. Inc. seo PRODUCTS AND SERVICES PRICE LIST for the IBM PC.
    [Show full text]
  • Virtual Table Hijacking Protection Enhancement for CFG
    Liberation Guard: Virtual Table Hijacking Protection Enhancement for CFG Eyal Itkin [email protected] eyalitkin.wordpress.com Abstract—Control Flow Guard (CFG) is an advanced defense mechanism by Microsoft, that aims to mitigate exploiting tech- niques using control flow integrity checks. In this paper we1 present a proposed enhancement of CFG, that adds virtual table integrity checks which will mitigate most virtual table hijacking exploits. The proposed defense creates a strong differentiation between ordinary and virtual functions, thus significantly nar- rowing the exploit options available when controlling an indirect virtual call. This differentiation will impose strong restrictions over current virtual table hijacking exploits, thus significantly raising the protection CFG can offer to protected programs2. I. PRELIMINARIES Fig. 1. Example of address translation for an unaligned address (at the top) and an aligned address (at the bottom). A. Control Flow Guard Overview Control Flow Guard (CFG) is an advanced control flow integrity (CFI) defense mechanism introduced by Microsoft in In order to use this CFI knowledge, the compiler adds Windows 8.1 and Windows 10 [4]. CFG aims to significantly a validation check prior to each indirect call (only call restrict the allowed control flow in the cases of indirect calls, assembly opcode, and not jump opcodes). This function is and is supported in Visual Studio 2015. stored in ntdll.dll, and exported to the rest of the DLLs. This defense mechanism is based on the fact that during The function verifies the requested address against the stored compilation time the compiler ”learns” where ”legitimate” bitmap, while acting as a NOP in case the bit is ”1” and crashes functions start, and records these addresses in the compiled the program in case the bit is ”0”.
    [Show full text]
  • The UNIX Time- Sharing System
    1. Introduction There have been three versions of UNIX. The earliest version (circa 1969–70) ran on the Digital Equipment Cor- poration PDP-7 and -9 computers. The second version ran on the unprotected PDP-11/20 computer. This paper describes only the PDP-11/40 and /45 [l] system since it is The UNIX Time- more modern and many of the differences between it and older UNIX systems result from redesign of features found Sharing System to be deficient or lacking. Since PDP-11 UNIX became operational in February Dennis M. Ritchie and Ken Thompson 1971, about 40 installations have been put into service; they Bell Laboratories are generally smaller than the system described here. Most of them are engaged in applications such as the preparation and formatting of patent applications and other textual material, the collection and processing of trouble data from various switching machines within the Bell System, and recording and checking telephone service orders. Our own installation is used mainly for research in operating sys- tems, languages, computer networks, and other topics in computer science, and also for document preparation. UNIX is a general-purpose, multi-user, interactive Perhaps the most important achievement of UNIX is to operating system for the Digital Equipment Corpora- demonstrate that a powerful operating system for interac- tion PDP-11/40 and 11/45 computers. It offers a number tive use need not be expensive either in equipment or in of features seldom found even in larger operating sys- human effort: UNIX can run on hardware costing as little as tems, including: (1) a hierarchical file system incorpo- $40,000, and less than two man years were spent on the rating demountable volumes; (2) compatible file, device, main system software.
    [Show full text]
  • History of Unix.Pdf
    History of Unix In order to define UNIX, it helps to look at its history. In 1969, Ken Thompson, Dennis Ritchie and others started work on what was to become UNIX on a "little-used PDP-7 in a corner" at AT&T Bell Labs. For ten years, the development of UNIX proceeded at AT&T in numbered versions. V4 (1974) was re-written in C -- a major milestone for the operating system's portability among different systems. V6 (1975) was the first to become available outside Bell Labs -- it became the basis of the first version of UNIX developed at the University of California Berkeley. Bell Labs continued work on UNIX into the 1980s, culminating in the release of System V (as in "five," not the letter) in 1983 and System V, Release 4 (abbreviated SVR4) in 1989. Meanwhile, programmers at the University of California hacked mightily on the source code AT&T had released, leading to many a master thesis. The Berkeley Standard Distribution (BSD) became a second major variant of "UNIX." It was widely deployed in both university and corporate computing environments starting with the release of BSD 4.2 in 1984. Some of its features were incorporated into SVR4. As the 1990s opened, AT&T's source code licensing had created a flourishing market for hundreds of UNIX variants by different manufacturers. AT&T sold its UNIX business to Novell in 1993, and Novell sold it to the Santa Cruz Operation two years later. In the meantime, the UNIX trademark had been passed to the X/Open consortium, which eventually merged to form The Open Group.1 While the stewardship of UNIX was passing from entity to entity, several long- running development efforts started bearing fruit.
    [Show full text]
  • UNIX History Page 1 Tuesday, December 10, 2002 7:02 PM
    UNIX History Page 1 Tuesday, December 10, 2002 7:02 PM CHAPTER 1 UNIX Evolution and Standardization This chapter introduces UNIX from a historical perspective, showing how the various UNIX versions have evolved over the years since the very first implementation in 1969 to the present day. The chapter also traces the history of the different attempts at standardization that have produced widely adopted standards such as POSIX and the Single UNIX Specification. The material presented here is not intended to document all of the UNIX variants, but rather describes the early UNIX implementations along with those companies and bodies that have had a major impact on the direction and evolution of UNIX. A Brief Walk through Time There are numerous events in the computer industry that have occurred since UNIX started life as a small project in Bell Labs in 1969. UNIX history has been largely influenced by Bell Labs’ Research Editions of UNIX, AT&T’s System V UNIX, Berkeley’s Software Distribution (BSD), and Sun Microsystems’ SunOS and Solaris operating systems. The following list shows the major events that have happened throughout the history of UNIX. Later sections describe some of these events in more detail. 1 UNIX History Page 2 Tuesday, December 10, 2002 7:02 PM 2 UNIX Filesystems—Evolution, Design, and Implementation 1969. Development on UNIX starts in AT&T’s Bell Labs. 1971. 1st Edition UNIX is released. 1973. 4th Edition UNIX is released. This is the first version of UNIX that had the kernel written in C. 1974. Ken Thompson and Dennis Ritchie publish their classic paper, “The UNIX Timesharing System” [RITC74].
    [Show full text]
  • Who Owns UNIX? Caldera Paid Just $36 Million for Two Divisions Of
    Who Owns UNIX? Caldera paid just $36 million for two divisions of the Santa Cruz Operation and their assets1. They claim that billions have been spent developing UNIX, without explaining that most of that funding was provided by the general public. SCO has even threatened Government users with litigation unless they purchase the “SCO Intellectual Property Licenses”.2 Unix was collaboratively developed by it's end-users (the public) and Bell Labs as an essential public facility for many years. In just one example, AT&T licensed-back publicly funded Berkeley Software Distribution (BSD) enhancements for use in their products as early as 1979. By 1993, The Regents of California claimed that as much as 50% of USL's System VR4 source code had been developed by Berkeley.3 The Berkeley CSRG was part of a public trust whose source code was developed with funding supplied via gifts, grants, or contracts provided by the NSF, DARPA, DOE, NASA and others4. Under the terms of a 1956 DOJ Consent Decree, and the FCC Computer Inquiry I and II regulations, neither AT&T nor Western Electric could legally market UNIX as a product or service. AT&T was restricted to the common carrier business. UNIX was offered "as is" to universities and businesses with no technical support or bug fixes. Organizations could obtain a copy of the UNIX source code and a royalty-free license to produce derivative works by paying a $99 administration fee. Under the decree, Bell Labs was limited to doing research for AT&T or contract work for the federal government.
    [Show full text]
  • Symbol Table Relocation Table Object File Format Where Are We Now
    inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Symbol Table Lecture 19 – Running a Program II . List of “items” in this file that may be used by other files. (Compiling, Assembling, Linking, Loading) Hello to . What are they? Lecturer SOE 2008-03-05 Neil Sharma Labels: function calling Dan Garcia from the 3rd row! Data: anything in the .data section; variables which may be accessed across files Researchers at Princeton have developed a flexible electricity-producing sheet of rubber that can use body movements into electricity. Breathing generates 1 W, walking around the room generates 70 W. Shoes may be the best place, to power/recharge cell phones & iPods. www.nytimes.com/2010/03/02/science/02obribbon.html CS61C L19 : Running a Progam II … Compiling, Assembling, Linking, and Loading (3) Garcia, Spring 2010 © UCB Relocation Table Object File Format . List of “items” this file needs the address later. object file header: size and position of the other . What are they? pieces of the object file Any label jumped to: j or jal . text segment: the machine code internal . data segment: binary representation of the data in external (including lib files) the source file Any piece of data connected with an address . relocation information: identifies lines of code that such as the la instruction need to be “handled” . symbol table: list of this file’s labels and data that can be referenced . debugging information . A standard format is ELF (except MS) http://www.skyfree.org/linux/references/ELF_Format.pdf CS61C L19 : Running a Progam II … Compiling, Assembling, Linking, and Loading (4) Garcia, Spring 2010 © UCB CS61C L19 : Running a Progam II … Compiling, Assembling, Linking, and Loading (5) Garcia, Spring 2010 © UCB Where Are We Now? Linker (1/3) .
    [Show full text]
  • Linkers and Loaders Do?
    Linkers & Loaders by John R. Levine Table of Contents 1 Table of Contents Chapter 0: Front Matter ........................................................ 1 Dedication .............................................................................................. 1 Introduction ............................................................................................ 1 Who is this book for? ......................................................................... 2 Chapter summaries ............................................................................. 3 The project ......................................................................................... 4 Acknowledgements ............................................................................ 5 Contact us ........................................................................................... 6 Chapter 1: Linking and Loading ........................................... 7 What do linkers and loaders do? ............................................................ 7 Address binding: a historical perspective .............................................. 7 Linking vs. loading .............................................................................. 10 Tw o-pass linking .............................................................................. 12 Object code libraries ........................................................................ 15 Relocation and code modification .................................................... 17 Compiler Drivers .................................................................................
    [Show full text]
  • Assemblers, Linkers & Loaders
    Assemblers, Linkers & Loaders C program Translation Hierarchy Compiler Assembly language program Assembler Object: Machine language module Object: Library routine (machine language) Linker Executable: Machine language program Loader Memory 1 Translation Hierarchy • Compiler – Translates high-level language program into assembly language (CS 440) • Assembler – Converts assembly language programs into object files • Object files contain a combination of machine instructions, data, and information needed to place instructions properly in memory Assemblers • Assemblers need to – translate assembly instructions and pseudo-instructions into machine instructions – Convert decimal numbers, etc. specified by programmer into binary • Typically, assemblers make two passes over the assembly file – First pass: reads each line and records labels in a symbol table – Second pass: use info in symbol table to produce actual machine code for each line 2 Object file format Object file Text Data Relocation Symbol Debugging header segment segment information table information • Object file header describes the size and position of the other pieces of the file • Text segment contains the machine instructions • Data segment contains binary representation of data in assembly file • Relocation info identifies instructions and data that depend on absolute addresses • Symbol table associates addresses with external labels and lists unresolved references • Debugging info Process for producing an executable file Source Object Assembler file file Source Object Executable Assembler file file Linker file Source Object Program Assembler file file library 3 Object file sub: · Object file · Executable file · Instructions main: main: jal ??? jal printf · · · · · · jal ??? jal sub printf: call, sub Linker · Relocation call, printf · records · sub: · C library · · print: · · · Linker • Tool that merges the object files produced by separate compilation or assembly and creates an executable file • Three tasks – Searches the program to find library routines used by program, e.g.
    [Show full text]