b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/aout.h,v 1.7 2002/05/31 18:46:00 dawes Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Borrowed from NetBSD's exec_aout.h
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Copyright (c) 1993, 1994 Christopher G. Demetriou
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * All rights reserved.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Redistribution and use in source and binary forms, with or without
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * modification, are permitted provided that the following conditions
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 1. Redistributions of source code must retain the above copyright
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * notice, this list of conditions and the following disclaimer.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 2. Redistributions in binary form must reproduce the above copyright
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * notice, this list of conditions and the following disclaimer in the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * documentation and/or other materials provided with the distribution.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 3. All advertising materials mentioning features or use of this software
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * must display the following acknowledgement:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * This product includes software developed by Christopher G. Demetriou.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 4. The name of the author may not be used to endorse or promote products
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * derived from this software without specific prior written permission
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Get prototype for ntohl, per SuSv3. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* OS/2 EMX has ntohl in this file */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * a.out header
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long a_midmag; /* htonl(flags<<26 | mid<<16 | magic) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* a_magic */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define QMAGIC 0314 /* "compact" demand load format; deprecated */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * a_mid - keep sorted in numerical order for sanity's sake
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * ensure that: 0 < mid < 0x3ff
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_ZERO 0 /* unknown - implementation dependent */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_PC386 100 /* 386 PC binary. (so quoth BFD) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_HP200 200 /* hp200 (68010) BSD binary */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_M68K 135 /* m68k BSD binary with 8K page sizes */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_M68K4K 136 /* m68k BSD binary with 4K page sizes */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MID_HP300 300 /* hp300 (68020+68881) BSD binary */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Interpretation of the (a_flags & EX_DPMASK) bits:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 00 traditional executable or object file
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 01 object file contains PIC code (set by `as -k')
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 10 dynamic executable
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * 11 position independent executable image
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * (eg. a shared library)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The a.out structure's a_midmag field is a network-byteorder encoding
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * of this int
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * FFFFFFmmmmmmmmmmMMMMMMMMMMMMMMMM
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Where `F' is 6 bits of flag like EX_DYNAMIC,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * `m' is 10 bits of machine-id like MID_I386, and
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * `M' is 16 bits worth of magic number, ie. ZMAGIC.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * The macros below will set/get the needed fields.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( (((ex)->a_midmag)&0xffff0000U) ? (ntohl(((ex)->a_midmag))&0xffffU) : ((ex)->a_midmag))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( (((ex)->a_midmag)&0xffff0000U) ? (ntohl(((ex)->a_midmag))&0xffffU) : \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( (((ex)->a_midmag)&0xffff0000U) ? ((ntohl(((ex)->a_midmag))>>16)&0x03ffU) : MID_ZERO )
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( (((ex)->a_midmag)&0xffff0000U) ? ((ntohl(((ex)->a_midmag))>>26)&0x3fU) : 0 )
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( (ex)->a_midmag = htonl( (((flag)&0x3fU)<<26) | (((mid)&0x03ffU)<<16) | \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (AOUT_GETMAGIC(ex) == ZMAGIC || AOUT_GETMAGIC(ex) == QMAGIC ? \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Valid magic number check. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (AOUT_GETMAGIC(ex) != NMAGIC && AOUT_GETMAGIC(ex) != OMAGIC && \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync AOUT_GETMAGIC(ex) != ZMAGIC && AOUT_GETMAGIC(ex) != QMAGIC)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Address of the bottom of the text segment. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_TXTADDR(ex) (AOUT_GETMAGIC2(ex) == (ZMAGIC|0x10000) ? 0 : __LDPGSZ)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Address of the bottom of the data segment. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (AOUT_GETMAGIC(ex) == OMAGIC ? AOUT_TXTADDR(ex) + (ex)->a_text : \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (AOUT_TXTADDR(ex) + (ex)->a_text + __LDPGSZ - 1) & ~(__LDPGSZ - 1))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Address of the bottom of the bss segment. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Text segment offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ( AOUT_GETMAGIC2(ex)==ZMAGIC || AOUT_GETMAGIC2(ex)==(QMAGIC|0x10000) ? \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync 0 : (AOUT_GETMAGIC2(ex)==(ZMAGIC|0x10000) ? __LDPGSZ : \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync sizeof(struct AOUT_exec)) )
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Data segment offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Text relocation table offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Data relocation table offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Symbol table offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* String table offset. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* Relocation format. */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int r_address; /* offset in text or data segment */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned int r_symbolnum:24, /* ordinal number of add symbol */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * Symbol table entry format. The #ifdef's are so that programs including
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync * nlist.h can initialize nlist structures statically.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync long n_strx; /* file string table offset (on disk) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_SIZE 0x0c /* pseudo type, defines a symbol's size */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_WARN 0x1e /* warning message (AOUT_EXT off) */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_EXT 0x01 /* external (global) bit, OR'ed in */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_TYPE 0x1e /* mask for all the type bits */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define n_hash n_desc /* used internally by ld(1); XXX */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync unsigned long n_value; /* address/value of the symbol */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_FORMAT "%08x" /* namelist value format; XXX */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define AOUT_STAB 0x0e0 /* mask for debugger symbols -- stab(5) */