⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsdaout.h

📁 早期freebsd实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/*	BSDI $Id: bsdaout.h,v 1.1.1.1 1992/08/27 17:05:12 trent Exp $	*//* * ARGH -- Cygnus takes standard POSIX macros and * rewrites them to apply to their own internal data structures! * I've extracted BSD definitions and modified them for BFD, * and installed the UCB copyright from a.out.h; * hope this covers everyone's copyright objections. (DMS/BSDI) */ /*- * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software *    must display the following acknowledgement: *	This product includes software developed by the University of *	California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *	from @(#)a.out.h	5.6 (Berkeley) 4/30/91 / BSDI rcsid 1.2 *//* `a.out' object-file definitions, including extensions to 64-bit fields */#ifndef __A_OUT_64_H__#define __A_OUT_64_H__/* This is the layout on disk of the 32-bit or 64-bit exec header. */struct external_exec {  bfd_byte e_info[4];		/* magic number and stuff		*/  bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes	*/  bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes	*/  bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes 		*/  bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes 	*/  bfd_byte e_entry[BYTES_IN_WORD]; /* start address 			*/  bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info	*/  bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info 	*/};#define	EXEC_BYTES_SIZE	(4 + BYTES_IN_WORD * 7)/* Magic numbers for a.out files */#if ARCH_SIZE==64#define OMAGIC 0x1001		/* Code indicating object file  */#define ZMAGIC 0x1002		/* Code indicating demand-paged executable.  */#define NMAGIC 0x1003		/* Code indicating pure executable.  */#define	QMAGIC 0x1004		/* Header in text, first page mapped out. */#else#define OMAGIC 0407		/* ...object file or impure executable.  */#define NMAGIC 0410		/* Code indicating pure executable.  */#define ZMAGIC 0413		/* Code indicating demand-paged executable.  */#define	QMAGIC 0314		/* Header in text, first page mapped out. */#endif#define N_BADMAG(x)	  (N_MAGIC(x) != OMAGIC		\			&& N_MAGIC(x) != NMAGIC		\  			&& N_MAGIC(x) != ZMAGIC		\  			&& N_MAGIC(x) != QMAGIC)/* By default, segment size is constant.  But some machines override this   to be a function of the a.out header (e.g. machine type).  */#ifndef	N_SEGSIZE#define	N_SEGSIZE(x)	__LDPGSZ#endif/* Virtual memory address of the text section.   This is getting very complicated.  A good reason to discard a.out format   for something that specifies these fields explicitly.  But til then...   * OMAGIC and NMAGIC files:       (object files: text for "relocatable addr 0" right after the header)       start at 0, offset is EXEC_BYTES_SIZE, size as stated.   * The text address, offset, and size of ZMAGIC files depend     on the entry point of the file:     * entry point below TEXT_START_ADDR:       (hack for SunOS shared libraries)       start at 0, offset is 0, size as stated.     * If N_HEADER_IN_TEXT(x) is true (which defaults to being the       case when the entry point is EXEC_BYTES_SIZE or further into a page):       no padding is needed; text can start after exec header.  Sun       considers the text segment of such files to include the exec header;       for BFD's purposes, we don't, which makes more work for us.       start at TEXT_START_ADDR + EXEC_BYTES_SIZE, offset is EXEC_BYTES_SIZE,       size as stated minus EXEC_BYTES_SIZE.     * If N_HEADER_IN_TEXT(x) is false (which defaults to being the case when       the entry point is less than EXEC_BYTES_SIZE into a page (e.g. page       aligned)): (padding is needed so that text can start at a page boundary)       start at TEXT_START_ADDR, offset PAGE_SIZE, size as stated.    Specific configurations may want to hardwire N_HEADER_IN_TEXT,    for efficiency or to allow people to play games with the entry point.    In that case, you would #define N_HEADER_IN_TEXT(x) as 1 for sunos,    and as 0 for most other hosts (Sony News, Vax Ultrix, etc).    (Do this in the appropriate bfd target file.)    (The default is a heuristic that will break if people try changing    the entry point, perhaps with the ld -e flag.)    */#if defined(hp300) || defined(i386)#define	__LDPGSZ	4096#endif#if defined(tahoe) || defined(vax)#define	__LDPGSZ	1024#endif#define	__NO_PAGE_0(ex)		(N_MAGIC(ex) == QMAGIC)#define	__HEADER_IN_TEXT(ex)	__NO_PAGE_0(ex)#define	__HOLE_IN_FILE(ex) \	(N_MAGIC(ex) == ZMAGIC || N_MAGIC(ex) == QMAGIC)#define	__HOLE_IN_ADDRESSES(ex) \	(__HOLE_IN_FILE(ex) || N_MAGIC(ex) == NMAGIC)#ifndef N_HEADER_IN_TEXT#define N_HEADER_IN_TEXT(x) __HEADER_IN_TEXT(x)#endif#ifndef N_SHARED_LIB#if 0#define N_SHARED_LIB(x) ((x).a_entry < TEXT_START_ADDR)#else#define	N_SHARED_LIB(x) 0#endif#endif#ifndef N_TXTADDR#define	N_TXTADDR(ex)	(__NO_PAGE_0(ex) ? __LDPGSZ : 0)#endif/* Offset in an a.out of the start of the text section. */#define	N_TXTOFF(ex) \	(__HEADER_IN_TEXT(ex) ? 0 : (N_MAGIC(ex) == ZMAGIC ? \	    __LDPGSZ : EXEC_BYTES_SIZE))/* Size of the text section.  It's always as stated, except that we   offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF   for ZMAGIC files that nominally include the exec header   as part of the first page of text.  (BFD doesn't consider the   exec header to be part of the text segment.)  */#define	N_TXTSIZE(x) \    ((N_MAGIC(x) != ZMAGIC || N_SHARED_LIB(x)) ? (x).a_text : \     N_HEADER_IN_TEXT(x)  ?	\	    (x).a_text - EXEC_BYTES_SIZE:	/* no padding */\	    (x).a_text				/* a page of padding */\    )/* The address of the data segment in virtual memory.   It is the text segment address, plus text segment size, rounded   up to a N_SEGSIZE boundary for pure or pageable files. */#define	N_DATADDR(ex) \	(N_TXTADDR(ex) + (__HOLE_IN_ADDRESSES(ex) ? \	    __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)) : (ex).a_text))/* The address of the BSS segment -- immediately after the data segment.  */#define N_BSSADDR(x)	(N_DATADDR(x) + (x).a_data)/* Offsets of the various portions of the file after the text segment.  */#define	N_DATOFF(ex) \	(N_TXTOFF(ex) + (__HOLE_IN_FILE(ex) ? \	    __LDPGSZ + ((ex).a_text - 1 & ~(__LDPGSZ - 1)) : (ex).a_text))#define N_TRELOFF(x)	( N_DATOFF(x) + (x).a_data )#define N_DRELOFF(x)	( N_TRELOFF(x) + (x).a_trsize )#define N_SYMOFF(x)	( N_DRELOFF(x) + (x).a_drsize )#define N_STROFF(x)	( N_SYMOFF(x) + (x).a_syms )/* Symbols */struct external_nlist {  bfd_byte e_strx[BYTES_IN_WORD];	/* index into string table of name */  bfd_byte e_type[1];			/* type of symbol */  bfd_byte e_other[1];			/* misc info (usually empty) */  bfd_byte e_desc[2];			/* description field */  bfd_byte e_value[BYTES_IN_WORD];	/* value of symbol */};#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)struct internal_nlist {  unsigned long n_strx;			/* index into string table of name */  unsigned char n_type;			/* type of symbol */  unsigned char n_other;		/* misc info (usually empty) */  unsigned short n_desc;		/* description field */  bfd_vma n_value;			/* value of symbol */};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -