ARM Object Library Format ========================= Introduction ------------ This document defines a file format called , or , which is used by the ARM linker, , and the ARM object librarian, . A library file contains a number of separate but related pieces of data. In order to simplify access to these data, and to provide for a degree of extensibility, the library file format is itself layered on another format called . This provides a simple and efficient means of accessing and updating distinct chunks of data within a single file. For a description of the Chunk File Format, see "" starting on page19. The Library format defines four chunk classes: and . There may be many chunks in a library. The Object Library Format defines two additional chunks: and These chunks are described in detail later in this document. Terminology ----------- The terms , and are used to mean: 8 bits, considered unsigned unless otherwise stated, usually used to store flag bits or characters; 16 bits, or 2 bytes, usually considered unsigned; 32 bits, or 4 bytes, usually considered unsigned; a sequence of bytes terminated by a NUL (0x00) byte. The NUL byte is part of the string but is not counted in the string's length. Byte Sex or Endian-ness ----------------------- There are two sorts of ALF: and . In little-endian ALF, the least significant byte of a word or half-word has the lowest address of any byte in the (half-)word. This is used by DEC, Intel and Acorn, amongst others. In big-endian ALF, the most significant byte of a (half-)word has the lowest address. This byte sex is used by IBM, Motorola and Apple, amongst others. For data in a file,
means . There is no guarantee that the endian-ness of an ALF file will be the same as the endian-ness of the system used to process it, (the endian-ness of the file is always the same as the endian-ness of the target ARM system). The two sorts of ALF cannot, meaningfully, be mixed (the target system cannot have mixed endian-ness: it must have one or the other). Thus the ARM linker will accept inputs of either sex and produce an output of the same sex, but will reject inputs of mixed endian-ness. Alignment --------- Strings and bytes may be aligned on any byte boundary. ALF fields defined in this document do not use half-words, and align words on 4-byte boundaries. Within the contents of an ALF file (within the data contained in OBJ_AREA chunks - see below), the alignment of words and half-words is defined by the use to which ALF is being put. For all current ARM-based systems, alignment is strict, as described immediately above. Library File Format ------------------- For library files, the first part of each chunk's name is "LIB_"; for object libraries, the names of the additional two chunks begin with "OFL_". Each piece of a library file is stored in a separate, identifiable chunk, named as follows: Chunk Chunk Name Directory LIB_DIRY Time stamp LIB_TIME Version LIB_VSRN Data LIB_DATA Symbol table OFL_SYMT object code libraries only Time stamp OFL_TIME object code libraries only There may be many LIB_DATA chunks in a library, one for each library member. In all chunks, word values are stored with the same byte order as the target system; strings are stored in ascending address order, which is independent of target byte order. LIB_DIRY ........ The LIB_DIRY chunk contains a directory of the modules in the library, each of which is stored in a LIB_DATA chunk. The directory size is fixed when the library is created. The directory consists of a sequence of variable length entries, each an integral number of words long. The number of directory entries is determined by the size of the LIB_DIRY chunk. Pictorially: ChunkIndex EntryLength the size of this LIB_DIRY chunk (an integral number of words) DataLength the size of the Data (an integral number of words) Data is a word containing the 0-origin index within the chunk file header of the corresponding LIB_DATA chunk. Conventionally, the first 3 chunks of an OFL file are LIB_DIRY, LIB_TIME and LIB_VSRN, so is at least 3. A ChunkIndex of 0 means the directory entry is unused. The corresponding LIB_DATA chunk entry gives the offset and size of the library module in the library file. is a word containing the number of bytes in this LIB_DIRY entry, always a multiple of 4. is a word containing the number of bytes used in the data section of this LIB_DIRY entry, also a multiple of 4. The section consists of, in order: * a 0-terminated string (the name of the library member); * any other information relevant to the library module (often empty); * a 2-word, word-aligned time stamp. Strings should contain only ISO-8859 non-control characters (codes [0-31], 127 and 128+[0-31] are excluded). The string field is the name used to identify this library module. Typically it is the name of the file from which the library member was created. The format of the time stamp is described in "