Amiga Hunk

From Just Solve the File Format Problem
Revision as of 13:09, 10 May 2018 by Kyz (Talk | contribs)

Jump to: navigation, search
File Format
Name Amiga Hunk
Ontology
Extension(s) (none), .library, .device, .datatype, .o, .lib

The Amiga Hunk format is the native file format of AmigaOS for loadable files (including all executable files), object code and link libraries.

Identification

Loadable files begin with the magic ID 00 00 03 F3. "Loadable" includes all directly executable files, as well as shared libraries, device drivers, filesystem handlers, datatypes and other "plugins".

Object code and link libraries begin with the magic ID 00 00 03 E7. These files have to be combined into a loadable file using a linker to get an executable program.

Structure

The loadable format begins with a fixed header, followed by a series of hunks. each one of which is considered an independent segment by AmigaDOS. These hunks can either be code, data, or uninitialised memory (BSS).

Hunks themselves can contain optional blocks, including code relocations and debug symbols.

All Amiga programs share the same address space and are loaded to wherever there is free memory. They cannot be loaded to specific absolute addresses. This means code must either be written in a position-independent fashion, or it can use relocation blocks to specify where the loader has to fix up absolute address references to other parts of the code.

Amiga programs do their own dynamic linking with OS functions such as OpenLibrary, which loads and returns a pointer to a shared library, whose functions can then be executed by jumping to specific offsets from the pointer. This is unlike Windows and UNIX where the loader is expected to fetch and link in other libraries while loading the program.

Format specification

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox