Utente:LiukSkin/SandBox2

Da Wikipedia, l'enciclopedia libera.
Vai alla navigazione Vai alla ricerca

Template:Ref improve Template:Lowercase

Template:Infobox file format


In informatica a.out (assembler output) è un formato di file utilizzato nelle prime versioni di Unix e dei sistemi operativi Unix-like, per eseguibili, codice oggetto, e (in sistemi più moderni) per librerie condivise.

a.out è ancora il nome di default dei file eseguibili creati da alcuni compilatori/assemblatori quando non viene specificato nessun nome tramite l'opzione -o, anche se il contenuto di a.out generato da essi non è più nel formato a.out[1]. Ad esempio, il compilatore gcc si adegua a questa convenzione, pur adottando come formato di output predefinito il formato ELF.


Storia[modifica | modifica wikitesto]

Un formato per file esegubili simile ad a.out (poi utilizzato nel PDP-11) fece la sua comparsa nella prima edizione di UNIX per il PDP-7[2]. È stato sostituito dal formato COFF in AT&T Unix System V, che è stato a sua volta sostituito dal formato ELF in System V Release 4.

Sebbene Berkeley Unix abbia continuato a supportare a.out per un po' di tempo, i moderni sistemi BSD hanno effettuato tutti la migrazione ad ELF. NetBSD/i386 è passato formalmente da a.out ad ELF nella sua release 1.5. FreeBSD/i386 è passato ad ELF durante la transizione dalla versione 2.2 alla versione to 3.0. Anche Linux ha usato a.out fino alla versione del kernel 1.2 [3], per poi passare anch'esso ad ELF.

Le informazioni di debug vengono supportate tramite l'utilizzo di entry speciali nella tabella dei simboli chiamata stabs. Il formato degli stabs è stato utilizzato in molte varianti dei formati COFF ed ELF.

Anche Linux ha usato a.out fino alla versione del kernel 1.2[3], per poi passare anch'esso ad ELF[4]. Il supporto al formato ELF era stato tuttavia aggiunto in via sperimentale già dalla versione 1.1.52. Il passaggio di Linux al formato ELF è stato più o meno obbligato, a causa della natura complessa della costruzione di librerie condivise su quella piattaforma. Infatti, per poter sviluppare oggetti di questo tipo, era necessario registrare lo spazio di indirizzamento virtuale all'interno del quale la libreria doveva essere caricata da un'autorità centrare, dal momento che il caricatore ld.so di Linux non era in grado di rilocare le librerie condivise nel formato a.out[5]. Le varie versioni di BSD sono state in grado di continuare ad utilizzare gli eseguibili in formato a.out per molto tempo, rispetto a quando Linux è dovuto passare al formato ELF, grazie alla natura in qualche modo più flessibile del formato a.out di BSD, rispetto a quello di Linux[6]. MINIX 3 still uses a.out as its binary format, but it does not support shared libraries.

Formato[modifica | modifica wikitesto]

Un eseguibile a.out ha di solito alcune varianti: OMAGIC, NMAGIC, QMAGIC, or ZMAGIC.

OMAGIC
The OMAGIC format had contiguous segments after the header, with no separation of text and data. This format was also used as object file format.
NMAGIC
The NMAGIC format was similar to OMAGIC, however the data segment was loaded on the immediate next page after the end of the text segment, and the text segment was marked read-only.
ZMAGIC
The ZMAGIC format added support for demand paging. The length of the code and data segments in the file had to be multiples of the page size.
QMAGIC
QMAGIC binaries were typically loaded one page above the bottom of the virtual address space, in order to permit trapping of null pointer dereferences via a segmentation fault. The a.out header was merged with the first page of the text segment, typically saving a page worth of memory
CMAGIC
Old versions of Linux use this format for core dumps.

An a.out file consists of up to seven sections, in the following order:

exec header
Contains parameters used by the kernel to load a binary file into memory and execute it, and by the link editor ld to combine a binary file with other binary files. This section is the only mandatory one.
text segment
Contains machine code and related data that are loaded into memory when a program executes. May be loaded read-only.
data segment
Contains initialized data; always loaded into writable memory.
text relocations
Contains records used by the link editor to update pointers in the text segment when combining binary files.
data relocations
Like the text relocation section, but for data segment pointers.
symbol table
Contains records used by the link editor to cross-reference the addresses of named variables and functions (symbols) between binary files.
string table
Contains the character strings corresponding to the symbol names.

Voci Correlate[modifica | modifica wikitesto]

Bibliografia[modifica | modifica wikitesto]

  1. ^ Template:Cita newsgroup
  2. ^ Dennis Ritchie, a.out — assembler and link editor output (PDF), Bell Labs, 3 novembre 1971. URL consultato il 24 novembre 2006.
  3. ^ a b Formato degli Eseguibili e Strumenti Avanzati di Compilazione (PDF), su dis.uniroma1.it. URL consultato il 14 gennaio 2012.
  4. ^ Daniel Barlow, The Linux ELF HOWTO (v1.29), su ibiblio.org, 14 July 1996. URL consultato il 28 marzo 2008.
  5. ^ Ulrich Drepper, How To Write Shared Libraries (PDF), 11 dicembre 2011. URL consultato il 14 gennaio 2012.
  6. ^ BSD Myths: BSD uses the a.out executable format, which is outdated technology, su people.freebsd.org. URL consultato il 10 aprile 2007.

Collegamenti Esterni[modifica | modifica wikitesto]

Template:Executables it:A.out