Amiga Hunk

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Structure)
Line 16: Line 16:
 
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'' hunks to specify where the loader has to fix up absolute address references to other parts of the code. Once loaded, they cannot be relocated again, only unloaded and reloaded.
 
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'' hunks to specify where the loader has to fix up absolute address references to other parts of the code. Once loaded, they cannot be relocated again, only unloaded and reloaded.
  
Amiga programs do their own dynamic linking with OS functions such as <tt>OpenLibrary</tt>, 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 at loading the program, and programs have "import" and "export" symbols. Amiga programs do not have to list any symbols or name any other libraries, even if they depend on them to run. Amiga programs can include a list of their own "symbols" for use by debuggers, but aren't required to do so.
+
Amiga programs do their own dynamic linking with OS functions such as <tt>OpenLibrary</tt>, 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, and programs have "import" and "export" symbols. Amiga programs do not have to list any symbols or name any other libraries, even if they depend on them to run. Amiga programs can include a list of their own "symbols" for use by debuggers, but aren't required to do so.
  
 
== Format specification ==
 
== Format specification ==

Revision as of 12:50, 10 May 2018

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 format begins with a fixed header, followed by a series of hunks which can contain different types of data, such as code, data, uninitialised memory reservations (BSS), code relocations, debug symbols and so on.

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 hunks to specify where the loader has to fix up absolute address references to other parts of the code. Once loaded, they cannot be relocated again, only unloaded and reloaded.

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, and programs have "import" and "export" symbols. Amiga programs do not have to list any symbols or name any other libraries, even if they depend on them to run. Amiga programs can include a list of their own "symbols" for use by debuggers, but aren't required to do so.

Format specification

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox