The IAR XLINK Linker™ and IAR XLIB Librarian™ Reference Guide

Total Page:16

File Type:pdf, Size:1020Kb

The IAR XLINK Linker™ and IAR XLIB Librarian™ Reference Guide IAR Linker and Library To o l s Reference Guide Version 4.60 XLINK-460G COPYRIGHT NOTICE © Copyright 1987–2007 IAR Systems. All rights reserved. No part of this document may be reproduced without the prior written consent of IAR Systems. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR, IAR Systems, IAR Embedded Workbench, IAR MakeApp, C-SPY, visualSTATE, From Idea To Target, IAR KickStart Kit and IAR PowerPac are trademarks or registered trademarks owned by IAR Systems AB. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE April 2007 Part number: XLINK-460G The IAR Linker and Library Tools Reference Guide replaces all versions of the IAR XLINK Linker™ and IAR XLIB Librarian™ Reference Guide. XLINK-460G Contents Tables ...................................................................................................................... vii Preface ..................................................................................................................... ix Who should read this guide ................................................................ix How to use this guide ............................................................................ix What this guide contains ....................................................................... x Document conventions ......................................................................... x Part 1: The IAR XLINK Linker ............................................. 1 Introduction to the IAR XLINK Linker ................................................. 3 Key features ................................................................................................ 3 MISRA C ............................................................................................. 4 The linking process ................................................................................. 4 Object format ....................................................................................... 5 XLINK functions ................................................................................. 5 Libraries .............................................................................................. 5 Output format ....................................................................................... 6 Input files and modules .......................................................................... 6 Libraries ............................................................................................... 7 Segments .............................................................................................. 8 Segment control ....................................................................................... 9 Address translation ............................................................................. 10 Allocation segment types ................................................................... 10 Memory segment types ...................................................................... 11 Overlap errors ................................................................................... 12 Range errors ...................................................................................... 12 Segment placement examples ............................................................ 13 Listing format ........................................................................................... 14 Header ................................................................................................ 14 Cross-reference .................................................................................. 15 Checksummed areas and memory usage ........................................... 22 iii XLINK-460G Contents XLINK options .................................................................................................. 23 Setting XLINK options ......................................................................... 23 Summary of options .............................................................................. 23 Descriptions of XLINK options ........................................................ 25 Splitting segments .............................................................................. 54 XLINK output formats .................................................................................. 55 Single output file ..................................................................................... 55 UBROF versions ............................................................................... 57 Two output files ...................................................................................... 58 Output format variants ........................................................................ 59 IEEE695 ............................................................................................. 60 ELF ..................................................................................................... 62 XCOFF78K ........................................................................................ 64 Restricting the output to a single address space ..................... 65 XLINK environment variables ................................................................... 67 Summary of XLINK environment variables ............................... 67 XLINK diagnostics ........................................................................................... 71 Introduction .............................................................................................. 71 XLINK warning messages ................................................................. 71 XLINK error messages ...................................................................... 71 XLINK fatal error messages .............................................................. 71 XLINK internal error messages ......................................................... 71 Error messages ........................................................................................ 72 Warning messages ................................................................................. 87 Part 2: The IAR Library Tools .............................................. 97 Introduction to the IAR Systems library tools ................................. 99 Libraries ...................................................................................................... 99 IAR XAR Library Builder and IAR XLIB Librarian ................. 99 Choosing which tool to use .............................................................. 100 Using libraries with C/C++ programs .......................................... 100 IAR Linker and Library Tools iv Reference Guide XLINK-460G Contents Using libraries with assembler programs .................................. 100 The IAR XAR Library Builder .................................................................. 103 Using XAR ............................................................................................... 103 Basic syntax .................................................................................... 103 Summary of XAR options ............................................................... 103 Descriptions of XAR options ........................................................... 104 XAR diagnostics .............................................................................................. 105 XAR messages ....................................................................................... 105 IAR XLIB Librarian options ....................................................................... 107 Using XLIB options .............................................................................. 107 Giving XLIB options from the command line ................................. 107 XLIB batch files ............................................................................... 107 Parameters ........................................................................................ 108 Module expressions .......................................................................... 108 List format ........................................................................................ 109 Using environment variables ........................................................... 109 Summary of XLIB options for all UBROF versions ............... 110 Descriptions of XLIB options for all UBROF versions ......... 111 Summary of XLIB options for older UBROF versions ........ 120 Descriptions of XLIB options for older UBROF versions ... 121 XLIB diagnostics .............................................................................................. 123 XLIB messages ...................................................................................... 123 Index ..................................................................................................................... 125 v XLINK-460G
Recommended publications
  • The “Stabs” Debug Format
    The \stabs" debug format Julia Menapace, Jim Kingdon, David MacKenzie Cygnus Support Cygnus Support Revision TEXinfo 2017-08-23.19 Copyright c 1992{2021 Free Software Foundation, Inc. Contributed by Cygnus Support. Written by Julia Menapace, Jim Kingdon, and David MacKenzie. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents 1 Overview of Stabs ::::::::::::::::::::::::::::::: 1 1.1 Overview of Debugging Information Flow ::::::::::::::::::::::: 1 1.2 Overview of Stab Format ::::::::::::::::::::::::::::::::::::::: 1 1.3 The String Field :::::::::::::::::::::::::::::::::::::::::::::::: 2 1.4 A Simple Example in C Source ::::::::::::::::::::::::::::::::: 3 1.5 The Simple Example at the Assembly Level ::::::::::::::::::::: 4 2 Encoding the Structure of the Program ::::::: 7 2.1 Main Program :::::::::::::::::::::::::::::::::::::::::::::::::: 7 2.2 Paths and Names of the Source Files :::::::::::::::::::::::::::: 7 2.3 Names of Include Files:::::::::::::::::::::::::::::::::::::::::: 8 2.4 Line Numbers :::::::::::::::::::::::::::::::::::::::::::::::::: 9 2.5 Procedures ::::::::::::::::::::::::::::::::::::::::::::::::::::: 9 2.6 Nested Procedures::::::::::::::::::::::::::::::::::::::::::::: 11 2.7 Block Structure
    [Show full text]
  • Packet Structure Definition
    xx Tektronix Logic Analyzer Online Help ZZZ PrintedHelpDocument *P077003206* 077-0032-06 Tektronix Logic Analyzer Online Help ZZZ PrintedHelpDocument www.tektronix.com 077-0032-06 Copyright © Tektronix. All rights reserved. Licensed software products are owned by Tektronix or its subsidiaries or suppliers, and are protected by national copyright laws and international treaty provisions. Tektronix products are covered by U.S. and foreign patents, issued and pending. Information in this publication supersedes that in all previously published material. Specifications and price change privileges reserved. TEKTRONIX and TEK are registered trademarks of Tektronix, Inc. D-Max, MagniVu, iView, iVerify, iCapture, iLink, PowerFlex, and TekLink are trademarks of Tektronix, Inc. 076-0113-06 077-0032-06 April 27, 2012 Contacting Tektronix Tektronix, Inc. 14150 SWKarlBraunDrive P.O. Box 500 Beaverton, OR 97077 USA For product information, sales, service, and technical support: In North America, call 1-800-833-9200. Worldwide, visit www.tektronix.com to find contacts in your area. Warranty Tektronix warrants that this product will be free from defects in materials and workmanship for a period of one (1) year from the date of shipment. If any such product proves defective during this warranty period, Tektronix, at its option, either will repair the defective product without charge for parts and labor, or will provide a replacement in exchange for the defective product. Parts, modules and replacement products used by Tektronix for warranty work may be new or reconditioned to like new performance. All replaced parts, modules and products become the property of Tektronix. In order to obtain service under this warranty, Customer must notify Tektronix of the defect before the expiration of the warranty period and make suitable arrangements for the performance of service.
    [Show full text]
  • IAR Linker and Library Tools Reference Guide
    IAR Linker and Library Tools Reference Guide XLINK-540 XLINK-540 COPYRIGHT NOTICE © 1987–2012 IAR Systems AB. No part of this document may be reproduced without the prior written consent of IAR Systems AB. The software described in this document is furnished under a license and may only be used or copied in accordance with the terms of such a license. DISCLAIMER The information in this document is subject to change without notice and does not represent a commitment on any part of IAR Systems. While the information contained herein is assumed to be accurate, IAR Systems assumes no responsibility for any errors or omissions. In no event shall IAR Systems, its employees, its contractors, or the authors of this document be liable for special, direct, indirect, or consequential damage, losses, costs, charges, claims, demands, claim for lost profits, fees, or expenses of any nature or kind. TRADEMARKS IAR Systems, IAR Embedded Workbench, C-SPY, visualSTATE, The Code to Success, IAR KickStart Kit, I-jet, IAR, and the logotype of IAR Systems are trademarks or registered trademarks owned by IAR Systems AB. Microsoft and Windows are registered trademarks of Microsoft Corporation. Adobe and Acrobat Reader are registered trademarks of Adobe Systems Incorporated. All other product names are trademarks or registered trademarks of their respective owners. EDITION NOTICE June 2012 Part number: XLINK-540 The IAR Linker and Library Tools Reference Guide replaces all versions of the IAR XLINK Linker™ and IAR XLIB Librarian™ Reference Guide. XLINK-540 Contents Tables ........................................................................................................................ 7 Preface ...................................................................................................................... 9 Who should read this guide ................................................................. 9 How to use this guide ............................................................................
    [Show full text]
  • Using Ld the GNU Linker
    Using ld The GNU linker ld version 2 January 1994 Steve Chamberlain Cygnus Support Cygnus Support [email protected], [email protected] Using LD, the GNU linker Edited by Jeffrey Osier (jeff[email protected]) Copyright c 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another lan- guage, under the above conditions for modified versions. Chapter 1: Overview 1 1 Overview ld combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run ld. ld accepts Linker Command Language files written in a superset of AT&T’s Link Editor Command Language syntax, to provide explicit and total control over the linking process. This version of ld uses the general purpose BFD libraries to operate on object files. This allows ld to read, combine, and write object files in many different formats—for example, COFF or a.out. Different formats may be linked together to produce any available kind of object file. See Chapter 5 [BFD], page 47, for more information. Aside from its flexibility, the gnu linker is more helpful than other linkers in providing diagnostic information.
    [Show full text]
  • Linker Script Guide Emprog
    Linker Script Guide Emprog Emprog ThunderBench™ Linker Script Guide Version 1.2 ©May 2013 Page | 1 Linker Script Guide Emprog 1 - Linker Script guide 2 -Arm Specific Options Page | 2 Linker Script Guide Emprog 1 The Linker Scripts Every link is controlled by a linker script. This script is written in the linker command language. The main purpose of the linker script is to describe how the sections in the input files should be mapped into the output file, and to control the memory layout of the output file. Most linker scripts do nothing more than this. However, when necessary, the linker script can also direct the linker to perform many other operations, using the commands described below. The linker always uses a linker script. If you do not supply one yourself, the linker will use a default script that is compiled into the linker executable. You can use the ‘--verbose’ command line option to display the default linker script. Certain command line options, such as ‘-r’ or ‘-N’, will affect the default linker script. You may supply your own linker script by using the ‘-T’ command line option. When you do this, your linker script will replace the default linker script. You may also use linker scripts implicitly by naming them as input files to the linker, as though they were files to be linked. 1.1 Basic Linker Script Concepts We need to define some basic concepts and vocabulary in order to describe the linker script language. The linker combines input files into a single output file. The output file and each input file are in a special data format known as an object file format.
    [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]
  • Interaktívny Disassembler Prohlášení
    VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ BRNO UNIVERSITY OF TECHNOLOGY FAKULTA INFORMAČNÍCH TECHNOLOGIÍ ÚSTAV INFORMAČNÝCH SYSTÉMŮ FACULTY OF INFORMATION TECHNOLOGY DEPARTMENT OF INFORMATION SYSTEMS INTERAKTÍVNY DISASSEMBLER BAKALÁŘSKÁ PRÁCE BACHELOR'S THESIS AUTOR PRÁCE Milan Mrva AUTHOR BRNO 2011 VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ BRNO UNIVERSITY OF TECHNOLOGY FAKULTA INFORMAČNÍCH TECHNOLOGIÍ ÚSTAV INFORMAČNÝCH SYSTÉMŮ FACULTY OF INFORMATION TECHNOLOGY DEPARTMENT OF INFORMATION SYSTEMS INTERAKTIVNÍ ZPĚTNÝ ASSEMBLER INTERACTIVE DISASSEMBLER BAKALÁŘSKÁ PRÁCE BACHELOR'S THESIS AUTOR PRÁCE Milan Mrva AUTHOR VEDOUCÍ PRÁCE Ing. Jakub Křoustek SUPERVISOR BRNO 2011 Abstrakt V práci jsou popsané postupy a nástroje zpětného inženýrství v rámci softwaru. Uvedené jsou techniky ochrany před rozkladem či zkoumáním obsahu spustitelného souboru. Představené jsou příklady programů zabývajících se zpětným překladem. Dále se práce zaobírá architekturou procesoru s důrazem na mikroprocesory Intel a Motorola. Jsou ukázané rozdílné formáty spustitelných souborů. Byl implementovaný generický modulovatelný zpětný assembler.V tomto textu je představená jak jeho struktura, tak zásuvné moduly, které prezentují tři různé techniky disassemblovaní. Jeden z modulů používa vícevláknový parser, který je vlastním návrhem autora. Tyto přístupy jsou v závěru porovnané a je nastíněn další vývoj. Abstract This thesis describes procedures and tools of reverse engineering in terms of software development. There are introduces different techniques of protection against decomposition of executables. The work also mentions some programs used for decomposition analysis. Furthermore it contains information about architecture of processing units, with emphasis on microprocessors Intel and Motorola. Variety of executable formats is shown. Generic retargetable disassembler was implemented. There is a description of its structure and plugins. These plugins represents three algorithms used for disassembling a program.
    [Show full text]
  • Developing and Porting C and C++ Applications on AIX
    IBM Front cover Developing and Porting C and C++ Applications on AIX Detailed explanations about 32- and 64-bit process models Effective management of shared objects and libraries Exploring parallel programming using OpenMP Keigo Matsubara Edison Kwok Inge Rodriguez Murali Paramasivam ibm.com/redbooks International Technical Support Organization Developing and Porting C and C++ Applications on AIX June 2003 SG24-5674-01 Note: Before using this information and the product it supports, read the information in “Notices” on page xvii. Second Edition (June 2003) This edition applies to C for AIX (program number 5765-F57) and VisualAge C++ for AIX Version 6.0 (product number 5765-F56) installed on AIX 5L Version 5.2 (product number 5765-E62). © Copyright International Business Machines Corporation 2000, 2003. All rights reserved. Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Figures . xiii Tables . xv Notices . xvii Trademarks . xviii Preface . xix The team that wrote this redbook. xix Become a published author . xx Comments welcome. xxi Summary of changes . xxiii June 2003, Second Edition . xxiii September 2000, First Edition . xxiv Chapter 1. C and C++ compilers . 1 1.1 C for AIX Version 6.0. 2 1.1.1 New or improved optimization features. 2 1.1.2 ISO C Standard conformance . 4 1.1.3 GNU C compatibility . 10 1.1.4 Enhanced language level support. 15 1.2 VisualAge C++ for AIX Version 6.0 . 16 1.2.1 New or improved optimization features. 16 1.2.2 OpenMP support .
    [Show full text]
  • Exe Fájlformátum Loader Linker Kód Visszafejtés
    | Linker és Loader COFF PE/COFF Exe fájlformátum loader linker Kód visszafejtés. Izsó Tamás 2016. december 1. Izsó Tamás Exe fájlformátum loader linker/ 1 | Linker és Loader COFF PE/COFF Section 1 Linker és Loader Izsó Tamás Exe fájlformátum loader linker/ 2 | Linker és Loader COFF PE/COFF Több modulból álló C program fordítása calc.c test.c cl -c calc.c cl -c test.c fordítás calc.obj test.obj link test.obj calc.obj /out:test.exe linkelés test.exe Izsó Tamás Exe fájlformátum loader linker/ 3 | Linker és Loader COFF PE/COFF Több modulból álló C program fordítás 1 // Inclusion guard 2 #ifndef _CALC_H_ 3 #define _CALC_H_ 4 5 6 int Add( int a, intb); 7 void Function( void ); 8 9 // End the inclusion guard 10 #endif calc.h header file Izsó Tamás Exe fájlformátum loader linker/ 4 | Linker és Loader COFF PE/COFF Több modulból álló C program fordítás 1 #include <stdio.h> 2 // Define 2 functions 3 4 // Add will return the sum of two numbers 5 int Add( int a, intb) 6 { 7 return a + b; 8 } 9 10 // Function will print out a text string 11 void Function( void ) 12 { 13 printf("Function called!\n"); 14 } calc.c rutinokat tartalmazó forrásfájl Izsó Tamás Exe fájlformátum loader linker/ 5 | Linker és Loader COFF PE/COFF Több modulból álló C program fordítás 1 #include <stdio.h> 2 #include"calc.h" 3 4 int main() 5 { 6 printf("65+44=%d\n", Add(65, 44) ); 7 Function(); 8 return(1); 9 } test.c foprogram˝ forrásfájl Izsó Tamás Exe fájlformátum loader linker/ 6 | Linker és Loader COFF PE/COFF Statikus linkelés *.lib lefordított tárgykódok (obj) gyüjteménye (archive, library); linkelésnél a futtatható program részévé válik .lib egy része; egyszer˝ua programot telepíteni; sok memóriát használ, mivel minden egyes futtatható fájl- ban azonos kódrészek találhatók; a javítás újralinkelést igényel (nehéz az sw.
    [Show full text]
  • Why Does My Program Not Link Or Not Execute Global Constructors
    Ns-3 Application Note Why Don’t Those #@(%!~& Libraries Work? Craig Dowell [email protected] Background Consider the following program int main(int argc, char **argv) { myprintf("Hello World\n"); } When you compile this program, the compiler determines that there is no function called myprintf in the compilation unit (the source file) and marks the function as an unresolved reference. When the executable is linked, the linker looks through its list of libraries looking for an implementation of the function myprintf. The linker handles providing an implementation in one of two ways depending on the kind of file providing the implementation. • If the implementation is found in a static library (e.g., libcore.a), the linker copies the implementation of myprintf into the executable. The linker must then recursively search for further unresolved references in the myprintf function and resolve them by (possibly) looking in other libraries. This continues until the executable contains all of the code required to execute myprintf (there are no unresolved references). • If the implementation of myprintf is found in a dynamic library (e.g., libcore.so), the linker adds a note to itself that the unresolved reference can be resolved by loading the dynamic library. The linker recursively searches for further unresolved references and continues until all references are resolved. What happens when you run the resulting program depends on the kind of library to which you linked. • If you linked to static libraries, your program is self-contained. It will be loaded into memory and executed, starting at a system-dependent entry point.
    [Show full text]
  • Gdb Internals a Guide to the Internals of the GNU Debugger
    gdb Internals A guide to the internals of the GNU debugger John Gilmore Cygnus Solutions Second Edition: Stan Shebs Cygnus Solutions Cygnus Solutions Revision TEXinfo 2007-09-03.05 Copyright c 1990-2013 Free Software Foundation, Inc. Contributed by Cygnus Solutions. Written by John Gilmore. Second Edition by Stan Shebs. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled \GNU Free Documentation License". i Table of Contents Scope of this Document :::::::::::::::::::::::::::: 1 1 Summary :::::::::::::::::::::::::::::::::::::::: 1 1.1 Requirements :::::::::::::::::::::::::::::::::::::::::::::::::: 1 1.2 Contributors ::::::::::::::::::::::::::::::::::::::::::::::::::: 1 2 Overall Structure ::::::::::::::::::::::::::::::: 2 2.1 The Symbol Side ::::::::::::::::::::::::::::::::::::::::::::::: 2 2.2 The Target Side :::::::::::::::::::::::::::::::::::::::::::::::: 2 2.3 Configurations ::::::::::::::::::::::::::::::::::::::::::::::::: 2 2.4 Source Tree Structure :::::::::::::::::::::::::::::::::::::::::: 3 3 Algorithms :::::::::::::::::::::::::::::::::::::: 4 3.1 Prologue Analysis :::::::::::::::::::::::::::::::::::::::::::::: 4 3.2 Breakpoint Handling ::::::::::::::::::::::::::::::::::::::::::: 6 3.3 Single Stepping ::::::::::::::::::::::::::::::::::::::::::::::::
    [Show full text]
  • Gdb Internals a Guide to the Internals of the GNU Debugger
    gdb Internals A guide to the internals of the GNU debugger John Gilmore Cygnus Solutions Second Edition: Stan Shebs Cygnus Solutions Cygnus Solutions Revision TEXinfo 2004-02-19.09 Copyright c 1990,1991,1992,1993,1994,1996,1998,1999,2000,2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”. i Table of Contents Scope of this Document ....................... 1 1 Requirements.............................. 1 2 Overall Structure .......................... 1 2.1 The Symbol Side ............................................ 2 2.2 The Target Side ............................................. 2 2.3 Configurations .............................................. 2 3 Algorithms ................................ 2 3.1 Frames ..................................................... 2 3.2 Breakpoint Handling ........................................ 3 3.3 Single Stepping ............................................. 4 3.4 Signal Handling ............................................. 4 3.5 Thread Handling ............................................ 4 3.6 Inferior Function Calls ....................................... 4 3.7 Longjmp Support ..........................................
    [Show full text]