X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Fobj-bout.h;h=374abbcc5586ec19d1cb21a1b31eda2d8996af77;hb=8ad30312fff34325113307cb27bcae49d220df15;hp=67e866a01f42a1b1c71e789fc3b3c2ab86aafb1b;hpb=d1a9e594859320d99c9ff5730d90dc171594c8e0;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/obj-bout.h b/gas/config/obj-bout.h index 67e866a01f..374abbcc55 100644 --- a/gas/config/obj-bout.h +++ b/gas/config/obj-bout.h @@ -1,24 +1,23 @@ /* b.out object file format - Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc. + Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 2000, + 2002, 2003 Free Software Foundation, Inc. -This file is part of GAS, the GNU Assembler. + This file is part of GAS, the GNU Assembler. -GAS is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 1, -or (at your option) any later version. + GAS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, + or (at your option) any later version. -GAS is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See -the GNU General Public License for more details. + GAS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See + the GNU General Public License for more details. -You should have received a copy of the GNU General Public -License along with GAS; see the file COPYING. If not, write -to the Free Software Foundation, 675 Mass Ave, Cambridge, MA -02139, USA. */ - -/* $Id$ */ + You should have received a copy of the GNU General Public + License along with GAS; see the file COPYING. If not, write + to the Free Software Foundation, 59 Temple Place - Suite 330, Cambridge, MA + 02139, USA. */ /* * This file is a modified version of 'a.out.h'. It is to be used in all GNU @@ -47,6 +46,9 @@ to the Free Software Foundation, 675 Mass Ave, Cambridge, MA * are in host byte-order: object files CANNOT be lifted from a * little-end host and used on a big-endian (or vice versa) without * modification. + * ==> THIS IS NO LONGER TRUE USING BFD. WE CAN GENERATE ANY BYTE ORDER + * FOR THE HEADER, AND READ ANY BYTE ORDER. PREFERENCE WOULD BE TO + * USE LITTLE-ENDIAN BYTE ORDER THROUGHOUT, REGARDLESS OF HOST. <== * * o The downloader ('comm960') takes care to generate a pseudo-header * with correct (i80960) byte-ordering before shipping text and data @@ -54,23 +56,16 @@ to the Free Software Foundation, 675 Mass Ave, Cambridge, MA * relocation info are never sent to the target. */ - #define OBJ_BOUT 1 -#include "targ-cpu.h" +#define OUTPUT_FLAVOR bfd_target_aout_flavour - /* bout uses host byte order for headers */ -#ifdef CROSS_COMPILE -#undef CROSS_COMPILE -#endif /* CROSS_COMPILE */ - - /* We want \v. */ -#define BACKSLASH_V 1 +#include "targ-cpu.h" #define OBJ_DEFAULT_OUTPUT_FILE_NAME "b.out" extern const short seg_N_TYPE[]; -extern const segT N_TYPE_seg[]; +extern const segT N_TYPE_seg[]; #define BMAGIC 0415 /* We don't accept the following (see N_BADMAG macro). @@ -90,28 +85,29 @@ extern const segT N_TYPE_seg[]; * 'n' indicates the corresponding segment must begin at an * address that is a multiple of (2**n). */ -struct exec { - /* Standard stuff */ - unsigned long a_magic; /* Identifies this as a b.out file */ - unsigned long a_text; /* Length of text */ - unsigned long a_data; /* Length of data */ - unsigned long a_bss; /* Length of runtime uninitialized data area */ - unsigned long a_syms; /* Length of symbol table */ - unsigned long a_entry; /* Runtime start address */ - unsigned long a_trsize; /* Length of text relocation info */ - unsigned long a_drsize; /* Length of data relocation info */ - - /* Added for i960 */ - unsigned long a_tload; /* Text runtime load address */ - unsigned long a_dload; /* Data runtime load address */ - unsigned char a_talign; /* Alignment of text segment */ - unsigned char a_dalign; /* Alignment of data segment */ - unsigned char a_balign; /* Alignment of bss segment */ - unsigned char unused; /* (Just to make struct size a multiple of 4) */ -}; +struct exec + { + /* Standard stuff */ + unsigned long a_magic; /* Identifies this as a b.out file */ + unsigned long a_text; /* Length of text */ + unsigned long a_data; /* Length of data */ + unsigned long a_bss; /* Length of runtime uninitialized data area */ + unsigned long a_syms; /* Length of symbol table */ + unsigned long a_entry; /* Runtime start address */ + unsigned long a_trsize; /* Length of text relocation info */ + unsigned long a_drsize; /* Length of data relocation info */ + + /* Added for i960 */ + unsigned long a_tload; /* Text runtime load address */ + unsigned long a_dload; /* Data runtime load address */ + unsigned char a_talign; /* Alignment of text segment */ + unsigned char a_dalign; /* Alignment of data segment */ + unsigned char a_balign; /* Alignment of bss segment */ + unsigned char a_relaxable; /* Contains enough info to relax */ + }; #define N_BADMAG(x) (((x).a_magic)!=BMAGIC) -#define N_TXTOFF(x) ( sizeof(struct exec) ) +#define N_TXTOFF(x) ( sizeof (struct exec) ) #define N_DATOFF(x) ( N_TXTOFF(x) + (x).a_text ) #define N_TROFF(x) ( N_DATOFF(x) + (x).a_data ) #define N_DROFF(x) ( N_TROFF(x) + (x).a_trsize ) @@ -120,60 +116,58 @@ struct exec { /* A single entry in the symbol table */ -struct nlist { - union { - char *n_name; - struct nlist *n_next; - long n_strx; /* Index into string table */ - } n_un; - unsigned char n_type; /* See below */ - char n_other; /* Used in i80960 support -- see below */ - short n_desc; - unsigned long n_value; -}; +struct nlist + { + union + { + char *n_name; + struct nlist *n_next; + long n_strx; /* Index into string table */ + } + n_un; + unsigned char n_type; /* See below */ + char n_other; /* Used in i80960 support -- see below */ + short n_desc; + unsigned long n_value; + }; typedef struct nlist obj_symbol_type; /* Legal values of n_type */ -#define N_UNDF 0 /* Undefined symbol */ -#define N_ABS 2 /* Absolute symbol */ -#define N_TEXT 4 /* Text symbol */ -#define N_DATA 6 /* Data symbol */ -#define N_BSS 8 /* BSS symbol */ -#define N_FN 31 /* Filename symbol */ +#define N_UNDF 0 /* Undefined symbol */ +#define N_ABS 2 /* Absolute symbol */ +#define N_TEXT 4 /* Text symbol */ +#define N_DATA 6 /* Data symbol */ +#define N_BSS 8 /* BSS symbol */ +#define N_FN 31 /* Filename symbol */ -#define N_EXT 1 /* External symbol (OR'd in with one of above) */ -#define N_TYPE 036 /* Mask for all the type bits */ -#define N_STAB 0340 /* Mask for all bits used for SDB entries */ +#define N_EXT 1 /* External symbol (OR'd in with one of above) */ +#define N_TYPE 036 /* Mask for all the type bits */ +#define N_STAB 0340 /* Mask for all bits used for SDB entries */ #ifndef CUSTOM_RELOC_FORMAT -struct relocation_info { - int r_address; /* File address of item to be relocated */ - unsigned - r_index:24,/* Index of symbol on which relocation is based*/ - r_pcrel:1, /* 1 => relocate PC-relative; else absolute - * On i960, pc-relative implies 24-bit - * address, absolute implies 32-bit. - */ - r_length:2, /* Number of bytes to relocate: - * 0 => 1 byte - * 1 => 2 bytes - * 2 => 4 bytes -- only value used for i960 - */ - r_extern:1, - r_bsr:1, /* Something for the GNU NS32K assembler */ - r_disp:1, /* Something for the GNU NS32K assembler */ - r_callj:1, /* 1 if relocation target is an i960 'callj' */ - nuthin:1; /* Unused */ -}; -#endif /* CUSTOM_RELOC_FORMAT */ - -/* If compiler generate leading underscores, remove them. */ +struct relocation_info + { + int r_address; /* File address of item to be relocated */ + unsigned + r_index:24, /* Index of symbol on which relocation is based*/ + r_pcrel:1, /* 1 => relocate PC-relative; else absolute + * On i960, pc-relative implies 24-bit + * address, absolute implies 32-bit. + */ + r_length:2, /* Number of bytes to relocate: + * 0 => 1 byte + * 1 => 2 bytes + * 2 => 4 bytes -- only value used for i960 + */ + r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */ + r_disp:1, /* Something for the GNU NS32K assembler */ + r_callj:1, /* 1 if relocation target is an i960 'callj' */ + nuthin:1; /* Unused */ + }; -#ifndef STRIP_UNDERSCORE -#define STRIP_UNDERSCORE 0 -#endif /* STRIP_UNDERSCORE */ +#endif /* CUSTOM_RELOC_FORMAT */ /* * Macros to extract information from a symbol table entry. @@ -187,25 +181,36 @@ struct relocation_info { /* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */ #define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_DESC(s) != 0)) + +/* Return true for symbols that should not be reduced to section + symbols or eliminated from expressions, because they may be + overridden by the linker. */ +#define S_FORCE_RELOC(s, strict) \ + (!SEG_NORMAL (S_GET_SEGMENT (s))) + +#define S_IS_COMMON(s) \ + (S_GET_TYPE (s) == N_UNDF && S_GET_VALUE (s) != 0) + #define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER) /* True if a debug special symbol entry */ #define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB) /* True if a symbol is local symbol name */ -/* A symbol name whose name begin with ^A is a gas internal pseudo symbol - nameless symbols come from .stab directives. */ -#define S_IS_LOCAL(s) (S_GET_NAME(s) && \ - !S_IS_DEBUG(s) && \ - (S_GET_NAME(s)[0] == '\001' || \ - (S_LOCAL_NAME(s) && !flagseen['L']))) +#define S_IS_LOCAL(s) \ + ((S_GET_NAME (s) \ + && !S_IS_DEBUG (s) \ + && (strchr (S_GET_NAME (s), '\001') != NULL \ + || strchr (S_GET_NAME (s), '\002') != NULL \ + || (S_LOCAL_NAME(s) && !flag_keep_locals))) \ + || (flag_strip_local_absolute \ + && !S_IS_EXTERNAL(s) \ + && S_GET_SEGMENT(s) == absolute_section)) /* True if a symbol is not defined in this file */ #define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT) /* True if the symbol has been generated because of a .stabd directive */ #define S_IS_STABD(s) (S_GET_NAME(s) == NULL) /* Accessors */ -/* The value of the symbol */ -#define S_GET_VALUE(s) ((unsigned long) ((s)->sy_symbol.n_value)) /* The name of the symbol */ #define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name) /* The pointer to the string table */ @@ -220,10 +225,8 @@ struct relocation_info { #define S_GET_DESC(s) ((s)->sy_symbol.n_desc) /* Modifiers */ -/* Set the value of the symbol */ -#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v)) /* Assume that a symbol cannot be simultaneously in more than on segment */ - /* set segment */ +/* set segment */ #define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg)) /* The symbol is external */ #define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT) @@ -237,16 +240,19 @@ struct relocation_info { #define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v)) /* Set the n_desc expression value */ #define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v)) +/* Set the n_type value */ +#define S_SET_TYPE(s,v) ((s)->sy_symbol.n_type = (v)) /* File header macro and type definition */ -#define H_GET_FILE_SIZE(h) (sizeof(struct exec) + \ +#define H_GET_FILE_SIZE(h) (sizeof (struct exec) + \ H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \ H_GET_SYMBOL_TABLE_SIZE(h) + \ H_GET_TEXT_RELOCATION_SIZE(h) + \ H_GET_DATA_RELOCATION_SIZE(h) + \ (h)->string_table_size) +#define H_GET_HEADER_SIZE(h) (sizeof (struct exec)) #define H_GET_TEXT_SIZE(h) ((h)->header.a_text) #define H_GET_DATA_SIZE(h) ((h)->header.a_data) #define H_GET_BSS_SIZE(h) ((h)->header.a_bss) @@ -256,6 +262,8 @@ struct relocation_info { #define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info) #define H_GET_ENTRY_POINT(h) ((h)->header.a_entry) #define H_GET_STRING_SIZE(h) ((h)->string_table_size) +#define H_GET_LINENO_SIZE(h) (0) + #ifdef EXEC_MACHINE_TYPE #define H_GET_MACHINE_TYPE(h) ((h)->header.a_machtype) #endif /* EXEC_MACHINE_TYPE */ @@ -263,9 +271,9 @@ struct relocation_info { #define H_GET_VERSION(h) ((h)->header.a_version) #endif /* EXEC_VERSION */ -#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v))) -#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v))) -#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v))) +#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = (v)) +#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = (v)) +#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = (v)) #define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\ H_SET_DATA_RELOCATION_SIZE((h),(d))) @@ -273,7 +281,7 @@ struct relocation_info { #define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v)) #define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v)) #define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \ - sizeof(struct nlist)) + sizeof (struct nlist)) #define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_magic = (v)) @@ -286,27 +294,26 @@ struct relocation_info { #define H_SET_VERSION(h,v) ((h)->header.a_version = (v)) #endif /* EXEC_VERSION */ -/* - * Current means for getting the name of a segment. - * This will change for infinite-segments support (e.g. COFF). - */ -#define segment_name(seg) ( seg_name[(int)(seg)] ) -extern char *const seg_name[]; - -typedef struct { - struct exec header; /* a.out header */ - long string_table_size; /* names + '\0' + sizeof(int) */ -} object_headers; - -/* unused hooks. */ -#define OBJ_EMIT_LINENO(a, b, c) ; -#define obj_pre_write_hook(a) ; - -/* - * Local Variables: - * comment-column: 0 - * fill-column: 131 - * End: - */ - -/* end of obj-bout.h */ +typedef struct + { + struct exec header; /* a.out header */ + long string_table_size; /* names + '\0' + sizeof (int) */ + } + +object_headers; + +/* unused hooks. */ +#define OBJ_EMIT_LINENO(a, b, c) {;} +#define obj_pre_write_hook(a) {;} + +#if __STDC__ +struct fix; +#endif +extern void tc_aout_fix_to_chars PARAMS ((char *where, + struct fix *fixP, + relax_addressT segment_address)); +extern void tc_bout_fix_to_chars PARAMS ((char *where, + struct fix *fixP, + relax_addressT segment_address)); + +#define AOUT_STABS