Skip to main content

IAR Embedded Workbench for Arm 9.70.x

The IAR Archive Tool—iarchive

In this section:

The IAR Archive Tool, iarchive, can create a library (an archive) file from several ELF object files. You can also use iarchive to manipulate ELF libraries.

A library file contains several relocatable ELF object modules, each of which can be independently used by a linker. In contrast with object modules specified directly to the linker, each module in a library is only included if it is needed.

For information about how to build a library in the IDE, see the IDE Project Management and Building documentation.

Invocation syntax

The invocation syntax for the archive builder is:

iarchive [command] [libraryfile] [objectfiles] [options]
Parameters

The parameters are:

Parameter

Description

command

A command line option that defines the operation to be performed. If the command is omitted, ‑‑create is used by default. You can specify the command anywhere on the command line.

libraryfile

The library file to be operated on. If specified like this, it must appear before the first object file, if any. You can also specify the library file using the option -o.

objectfiles

One or more object files as arguments to the command. Note that some commands take no object file arguments.

options

Optional command line options that modify the behavior of the archive tool. These options can be placed anywhere on the command line.

Table 111. iarchive parameters 


Examples

This example creates a library file called mylibrary.a from the source object files module1.o, module.2.o, and module3.o:

iarchive mylibrary.a module1.o module2.o module3.o.

This example lists the contents of mylibrary.a:

iarchive ‑‑toc mylibrary.a

This example replaces module3.o in the library with the content in the module3.o file and appends module4.o to mylibrary.a:

iarchive ‑‑replace mylibrary.a module3.o module4.o

Summary of iarchive commands

This table summarizes the iarchive commands:

Command line option

Description

‑‑create

Creates a library that contains the listed object files.

‑‑delete, -d

Deletes the listed object files from the library.

‑‑extract, -x

Extracts the listed object files from the library.

‑‑replace, -r

Replaces or appends the listed object files to the library.

‑‑symbols

Lists all symbols defined by files in the library.

‑‑toc, -t

Lists all files in the library.

Table 112. iarchive commands summary 


For more information, see Descriptions of utilities options.

Summary of iarchive options

This table summarizes the iarchive command line options:

Command line option

Description

-f

Extends the command line.

‑‑f

Extends the command line, optionally with a dependency.

‑‑fake_time

Generates library files with identical timestamps.

‑‑no_bom

Omits the byte order mark from UTF-8 output files.

‑‑output, -o

Specifies the library file.

‑‑silent

Sets silent operation.

‑‑text_out

Specifies the encoding for text output files.

‑‑utf8_text_in

Uses the UTF-8 encoding for text input files.

‑‑verbose, -V

Reports all performed operations.

‑‑version

Sends tool output to the console and then exits.

‑‑vtoc

Produces a verbose list of files in the library.

Table 113. iarchive options summary 


For more information, see Descriptions of utilities options.

Diagnostic messages

This section lists the messages produced by iarchive:

La001: could not open file filename

iarchive failed to open an object file.

La002: illegal path pathname

The path pathname is not a valid path.

La006: too many parameters to cmd command

A list of object modules was specified as parameters to a command that only accepts a single library file.

La007: too few parameters to cmd command

A command that takes a list of object modules was issued without the expected modules.

La008: lib is not a library file

The library file did not pass a basic syntax check. Most likely the file is not the intended library file.

La009: lib has no symbol table

The library file does not contain the expected symbol information. The reason might be that the file is not the intended library file, or that it does not contain any ELF object modules.

La010: no library parameter given

The tool could not identify which library file to operate on. The reason might be that a library file has not been specified.

La011: file file already exists

The file could not be created because a file with the same name already exists.

La013: file confusions, lib given as both library and object

The library file was also mentioned in the list of object modules.

La014: module module not present in archive lib

The specified object module could not be found in the archive.

La015: internal error

The invocation triggered an unexpected error in iarchive.

Ms003: could not open file filename for writing

iarchive failed to open the archive file for writing. Make sure that it is not write protected.

Ms004: problem writing to file filename

An error occurred while writing to file filename. A possible reason for this is that the volume is full.

Ms005: problem closing file filename

An error occurred while closing the file filename.