a.out.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
/*
* SunOS 4.x a.out format -- 32-bit sparc only
*/
#ifndef _A_OUT_H
#define _A_OUT_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/isa_defs.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__sparcv8)
/*
* format of the exec header
* known by kernel and by user programs
*/
struct exec {
unsigned char a_toolversion:7;
/* version of toolset used to create this file */
unsigned char a_machtype; /* machine type */
unsigned short a_magic; /* magic number */
unsigned int a_text; /* size of text segment */
unsigned int a_data; /* size of initialized data */
unsigned int a_bss; /* size of uninitialized data */
unsigned int a_syms; /* size of symbol table */
unsigned int a_entry; /* entry point */
unsigned int a_trsize; /* size of text relocation */
unsigned int a_drsize; /* size of data relocation */
};
/* machine types */
#define M_OLDSUN2 0 /* old sun-2 executable files */
#define TV_SUN2_SUN3 0
#define TV_SUN4 1
/*
* memory management parameters
*/
#define PAGSIZ 0x02000
/*
* returns 1 if an object file type is invalid, i.e., if the other macros
* defined below will not yield the correct offsets. Note that a file may
* have N_BADMAG(x) = 0 and may be fully linked, but still may not be
* executable.
*/
#define N_BADMAG(x) \
/*
* relocation parameters. These are architecture-dependent
* and can be deduced from the machine type. They are used
* to calculate offsets of segments within the object file;
* See N_TXTOFF(x), etc. below.
*/
#define N_PAGSIZ(x) \
#define N_SEGSIZ(x) \
/*
* offsets of various sections of an object file.
*/
#define N_TXTOFF(x) \
/* text segment */ \
((x).a_machtype == M_OLDSUN2 \
#define N_DATOFF(x) /* data segment */ \
#define N_TRELOFF(x) /* text reloc'n */ \
#define N_DRELOFF(x) /* data relocation */ \
#define N_SYMOFF(x) \
/* symbol table */ \
#define N_STROFF(x) \
/* string table */ \
/*
* Macros which take exec structures as arguments and tell where the
* various pieces will be loaded.
*/
#define _N_BASEADDR(x) \
0 : N_PAGSIZ(x))
#define N_TXTADDR(x) \
#define N_DATADDR(x) \
/*
* Format of a relocation datum.
*/
/*
* Sparc relocation types
*/
enum reloc_type
{
RELOC_JMP_TBL, /* jmp_tbl_rel in pic */
RELOC_SEGOFF16, /* ShLib offset-in-seg */
};
/*
* Format of a relocation datum.
*/
struct reloc_info_sparc /* used when header.a_machtype == M_SPARC */
{
unsigned int r_address;
/* relocation addr (offset in segment) */
int : 2; /* <unused> */
int r_addend; /* addend for relocation value */
};
/*
* Format of a symbol table entry
*/
struct nlist {
union {
char *n_name; /* for use when in-core */
int n_strx; /* index into file string table */
} n_un;
unsigned char n_type; /* type flag (N_TEXT,..) */
char n_other; /* unused */
unsigned int n_value; /* value of symbol (or sdb offset) */
};
/*
* Simple values for n_type.
*/
/*
* Dbx entries have some of the N_STAB bits set.
* These are given in <stab.h>
*/
/*
* Format for namelist values.
*/
#define N_FORMAT "%08x"
/*
* secondary sections.
* this stuff follows the string table.
* not even its presence or absence is noted in the
* exec header (?). the secondary header gives
* the number of sections. following it is an
* array of "extra_nsects" int's which give the
* sizeof of the individual sections. the presence of
* even the header is optional.
*/
#define EXTRA_IDENT 0 /* ident's in 0th extra section */
struct extra_sections {
int extra_magic; /* should be EXTRA_MAGIC */
int extra_nsects; /* number of extra sections */
};
#endif /* defined(__sparcv8) */
#ifdef __cplusplus
}
#endif
#endif /* _A_OUT_H */