+
+
+
+
/* coff object file format
- Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
+ Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
-This file is part of GAS.
+ This file is part of GAS.
-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 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. */
+ 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$ */
+#ifndef OBJ_FORMAT_H
+#define OBJ_FORMAT_H
#define OBJ_COFF 1
+#define WORKING_DOT_WORD
+#define WARN_SIGNED_OVERFLOW_WORD
+
#include "targ-cpu.h"
#include "bfd.h"
#define internal_lineno bfd_internal_lineno
#include "coff/internal.h"
#undef internal_lineno
-
-#if defined(TC_H8300)
+#if defined(TC_Z8K)
+#include "coff/z8k.h"
+#define TARGET_FORMAT "coff-z8k"
+#elif defined(TC_H8300)
#include "coff/h8300.h"
#define TARGET_FORMAT "coff-h8300"
+#elif defined(TC_M68K)
+#include "coff/m68k.h"
+#define TARGET_FORMAT "coff-m68k"
+
+#elif defined(TC_I386)
+#include "coff/i386.h"
+#define TARGET_FORMAT "coff-i386"
#elif defined(TC_A29K)
#include "coff/a29k.h"
#define TARGET_FORMAT "coff-a29k-big"
+
+/* Allow translate from aout relocs to coff relocs */
+#define NO_RELOC 20
+#define RELOC_32 1
+#define RELOC_8 2
+#define RELOC_CONST 3
+#define RELOC_CONSTH 4
+#define RELOC_JUMPTARG 5
+#define RELOC_BASE22 6
+#define RELOC_HI22 7
+#define RELOC_LO10 8
+#define RELOC_BASE13 9
+#define RELOC_WDISP22 10
+#define RELOC_WDISP30 11
#else
help me
#endif
#if 0
/* Define some processor dependent values according to the processor we are
- on. */
+ on. */
#if defined(TC_H8300)
#define BYTE_ORDERING 0
#define FILE_HEADER_MAGIC H8300MAGIC
#elif defined(TC_M68K)
-#define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
+#define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC MC68MAGIC /* ... */
+#define FILE_HEADER_MAGIC MC68MAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_I386)
-#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
+#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC I386MAGIC /* ... */
+#define FILE_HEADER_MAGIC I386MAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_I960)
-#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
+#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC I960ROMAGIC /* ... */
+#define FILE_HEADER_MAGIC I960ROMAGIC /* ... */
#endif /* FILE_HEADER_MAGIC */
#elif defined(TC_A29K)
#ifndef FILE_HEADER_MAGIC
#define FILE_HEADER_MAGIC SIPFBOMAGIC
#endif /* FILE_HEADER_MAGIC */
-
#else
-you lose
-#endif
+ you lose
+#endif
#endif
#endif /* OBJ_COFF_MAX_AUXENTRIES */
-extern const segT N_TYPE_seg[];
+extern const segT N_TYPE_seg[];
/* Magic number of paged executable. */
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300
/* SYMBOL TABLE */
- /* targets may also set this */
+/* targets may also set this */
#ifndef SYMBOLS_NEED_BACKPOINTERS
#define SYMBOLS_NEED_BACKPOINTERS 1
#endif /* SYMBOLS_NEED_BACKPOINTERS */
/* Symbol table entry data type */
-typedef struct
+typedef struct
{
- struct internal_syment ost_entry; /* Basic symbol */
- union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
+ struct internal_syment ost_entry; /* Basic symbol */
+ union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
+
+ unsigned int ost_flags; /* obj_coff internal use only flags */
+}
- unsigned int ost_flags; /* obj_coff internal use only flags */
-} obj_symbol_type;
+obj_symbol_type;
+#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
#define DO_STRIP 1
-
+#endif
/* Symbol table macros and constants */
-/* Possible and usefull section number in symbol table
+/* Possible and usefull section number in symbol table
* The values of TEXT, DATA and BSS may not be portable.
*/
/* True if the symbol is external */
#define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
/* True if symbol has been defined, ie :
- section > 0 (DATA, TEXT or BSS)
- section == 0 and value > 0 (external bss symbol) */
+ section > 0 (DATA, TEXT or BSS)
+ section == 0 and value > 0 (external bss symbol) */
#define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \
((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \
(s)->sy_symbol.ost_entry.n_value > 0))
/* The zeroes if symbol name is longer than 8 chars */
#define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes)
/* The value of the symbol */
-#define S_GET_VALUE(s) ((unsigned) ((s)->sy_symbol.ost_entry.n_value))
+#define S_GET_VALUE(s) ((unsigned) ((s)->sy_symbol.ost_entry.n_value))
/* The numeric value of the segment */
#define S_GET_SEGMENT(s) s_get_segment(s)
/* The data type */
* differently.
*/
-#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
-#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
-#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
-#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
-#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
+#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
+#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
+#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
+#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
+#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
-#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
+#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
-#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
-#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
-#define SF_STRING (0x00004000) /* Symbol name length > 8 */
-#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
+#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
+#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
+#define SF_STRING (0x00004000) /* Symbol name length > 8 */
+#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
-#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
+#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
-#define SF_FUNCTION (0x00010000) /* The symbol is a function */
-#define SF_PROCESS (0x00020000) /* Process symbol before write */
-#define SF_TAGGED (0x00040000) /* Is associated with a tag */
-#define SF_TAG (0x00080000) /* Is a tag */
-#define SF_DEBUG (0x00100000) /* Is in debug or abs section */
-#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
- /* All other bits are unused. */
+#define SF_FUNCTION (0x00010000) /* The symbol is a function */
+#define SF_PROCESS (0x00020000) /* Process symbol before write */
+#define SF_TAGGED (0x00040000) /* Is associated with a tag */
+#define SF_TAG (0x00080000) /* Is a tag */
+#define SF_DEBUG (0x00100000) /* Is in debug or abs section */
+#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
+/* All other bits are unused. */
/* Accessors */
#define SF_GET(s) ((s)->sy_symbol.ost_flags)
#define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED)
#define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG)
#define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT)
-#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
-#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
-#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
-#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
-#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
+#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
+#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
+#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
+#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
+#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
/* Modifiers */
#define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v))
#define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED)
#define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG)
#define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT)
-#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
-#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
-#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
-#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
-#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
+#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
+#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
+#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
+#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
+#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
/* File header macro and type definition */
#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
- /* Segment flipping */
+/* Segment flipping */
#define segment_name(v) (seg_name[(int) (v)])
-typedef struct {
+typedef struct
+ {
#ifdef BFD_HEADERS
- struct internal_aouthdr aouthdr; /* a.out header */
- struct internal_filehdr filehdr; /* File header, not machine dep. */
+ struct internal_aouthdr aouthdr; /* a.out header */
+ struct internal_filehdr filehdr; /* File header, not machine dep. */
#else
- AOUTHDR aouthdr; /* a.out header */
- FILHDR filehdr; /* File header, not machine dep. */
+ AOUTHDR aouthdr; /* a.out header */
+ FILHDR filehdr; /* File header, not machine dep. */
#endif
- long string_table_size; /* names + '\0' + sizeof(int) */
- long relocation_size; /* Cumulated size of relocation
+ long string_table_size; /* names + '\0' + sizeof(int) */
+ long relocation_size; /* Cumulated size of relocation
information for all sections in
bytes. */
- long lineno_size; /* Size of the line number information
+ long lineno_size; /* Size of the line number information
table in bytes */
-} object_headers;
+ }
+
+object_headers;
struct lineno_list
{
-
+
struct bfd_internal_lineno line;
- char* frag; /* Frag to which the line number is related */
- struct lineno_list* next; /* Forward chain pointer */
-} ;
+ char *frag; /* Frag to which the line number is related */
+ struct lineno_list *next; /* Forward chain pointer */
+};
- /* stack stuff */
-typedef struct {
+/* stack stuff */
+typedef struct
+ {
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
- char* data;
+ char *data;
unsigned long pointer;
-} stack;
+ }
+
+stack;
-char *EXFUN(stack_pop,(stack *st));
-char *EXFUN(stack_push,(stack *st, char *element));
-char *EXFUN(stack_top,(stack *st));
-stack *EXFUN(stack_init,(unsigned long chunk_size, unsigned long element_size));
-void EXFUN(c_dot_file_symbol,(char *filename));
-void EXFUN(obj_extra_stuff,(object_headers *headers));
-void EXFUN(stack_delete,(stack *st));
+char *EXFUN (stack_pop, (stack * st));
+char *EXFUN (stack_push, (stack * st, char *element));
+char *EXFUN (stack_top, (stack * st));
+stack *EXFUN (stack_init, (unsigned long chunk_size, unsigned long element_size));
+void EXFUN (c_dot_file_symbol, (char *filename));
+void EXFUN (obj_extra_stuff, (object_headers * headers));
+void EXFUN (stack_delete, (stack * st));
-void EXFUN(c_section_header,(
+void EXFUN (c_section_header, (
- struct internal_scnhdr *header,
- char *name,
- long core_address,
- long size,
- long data_ptr,
- long reloc_ptr,
- long lineno_ptr,
- long reloc_number,
- long lineno_number,
- long alignment));
+ struct internal_scnhdr * header,
+ char *name,
+ long core_address,
+ long size,
+ long data_ptr,
+ long reloc_ptr,
+ long lineno_ptr,
+ long reloc_number,
+ long lineno_number,
+ long alignment));
- /* sanity check */
+/* sanity check */
#ifdef TC_I960
#ifndef C_LEAFSTAT
-hey! Where is the C_LEAFSTAT definition? i960-coff support is depending on it.
+hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it.
#endif /* no C_LEAFSTAT */
#endif /* TC_I960 */
#ifdef BFD_HEADERS
extern SCNHDR data_section_header;
extern SCNHDR text_section_header;
#endif
+#endif
+
/*
* Local Variables:
* comment-column: 0
* End:
*/
-/* end of obj-coff.h */
+/* end of obj-coffbfd.h */