Changes to support stabs-in-coff
[deliverable/binutils-gdb.git] / gas / config / obj-coffbfd.h
index b1b9a0b037b9d212d642e22bbf3f1be5e26803c7..9e75f7cb45ac40096b943b13c4e0f667ef6f8652 100644 (file)
@@ -1,18 +1,18 @@
 /* coff object file format
    Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
-   
+
    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 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.  */
 #define OBJ_COFF 1
 
 #define WORKING_DOT_WORD
+#define WARN_SIGNED_OVERFLOW_WORD
+
+/* By default we omit the optional aouthdr.  */
+#define OBJ_COFF_OMIT_OPTIONAL_HEADER
 
 #include "targ-cpu.h"
 
 #include "bfd.h"
 
-/*extern bfd *stdoutput;*/
 /* This internal_lineno crap is to stop namespace pollution from the
    bfd internal coff headerfile. */
 
 #define internal_lineno bfd_internal_lineno
 #include "coff/internal.h"
 #undef internal_lineno
-#if defined(TC_Z8K)
+
+#ifdef TC_Z8K
 #include "coff/z8k.h"
 #define TARGET_FORMAT "coff-z8k"
-#elif defined(TC_H8300)
+#endif
+
+#ifdef TC_H8300
 #include "coff/h8300.h"
 #define TARGET_FORMAT "coff-h8300"
-#elif defined(TC_M68K)
+#endif
+
+#ifdef TC_H8500
+#include "coff/h8500.h"
+#define TARGET_FORMAT "coff-h8500"
+#endif
+
+#ifdef TC_SH
+#include "coff/sh.h"
+#define TARGET_FORMAT "coff-sh"
+#endif
+
+#ifdef TC_M68K
 #include "coff/m68k.h"
 #define TARGET_FORMAT "coff-m68k"
+#endif
+
+#ifdef TC_M88K
+#include "coff/m88k.h"
+#define TARGET_FORMAT "coff-m88kbcs"
+#endif
+
+#ifdef TC_I386
+#include "coff/i386.h"
+#define TARGET_FORMAT "coff-i386"
+#endif
 
-#elif defined(TC_A29K)
+#ifdef TC_A29K
 #include "coff/a29k.h"
 #define TARGET_FORMAT "coff-a29k-big"
 
 #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. */
-#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. */
-#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC      MC68MAGIC  /* ... */
-#endif /* FILE_HEADER_MAGIC */
-
-#elif defined(TC_I386)
-
-#define BYTE_ORDERING          F_AR32WR   /* See filehdr.h for more info. */
-#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC      I386MAGIC  /* ... */
-#endif /* FILE_HEADER_MAGIC */
-
-#elif defined(TC_I960)
-
-#define BYTE_ORDERING          F_AR32WR   /* See filehdr.h for more info. */
-#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC      I960ROMAGIC  /* ... */
-#endif /* FILE_HEADER_MAGIC */
-
-#elif defined(TC_A29K)
-
-#define BYTE_ORDERING          F_AR32W /* big endian. */
-#ifndef FILE_HEADER_MAGIC
-#define FILE_HEADER_MAGIC      SIPFBOMAGIC
-#endif /* FILE_HEADER_MAGIC */
-#else
-you lose
-#endif 
-    
-#endif
-    
+
+
+
+
 #ifndef OBJ_COFF_MAX_AUXENTRIES
 #define OBJ_COFF_MAX_AUXENTRIES 1
 #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
@@ -125,13 +116,33 @@ you lose
 
 /* 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. */
-       
-       unsigned int ost_flags; /* obj_coff internal use only flags */
-} obj_symbol_type;
+  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 */
+
+  /* For stabs-in-coff. */
+  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 */
+
+}
+
+obj_symbol_type;
+
+#define S_SET_OFFSET_2(S,V) ((S)->sy_symbol.n_strx = (V))
+#define S_SET_OTHER(S,V) ((S)->sy_symbol.n_other = (V))
+#define S_SET_TYPE(S,T) ((S)->sy_symbol.n_type = (T))
+#define S_SET_DESC(S,D) ((S)->sy_symbol.n_desc = (D))
+#define S_GET_OFFSET_2(S) ((S)->sy_symbol.n_strx)
+#define S_GET_OTHER(S) ((S)->sy_symbol.n_other)
+#define S_GET_TYPE(S) ((S)->sy_symbol.n_type)
+#define S_GET_DESC(S) ((S)->sy_symbol.n_desc)
+
 
 #ifndef DO_NOT_STRIP
 #define DO_NOT_STRIP   0
@@ -139,7 +150,7 @@ typedef struct
 #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.
  */
 
@@ -164,21 +175,24 @@ typedef struct
    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))
+                                 S_GET_VALUE (s) > 0))
 /* True if a debug special symbol entry */
 #define S_IS_DEBUG(s)          ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
 /* True if a symbol is local symbol name */
-/* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
-#define S_IS_LOCAL(s)          (S_GET_NAME(s)[0] == '\001' || \
-                                (s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION || \
-                                (S_LOCAL_NAME(s) && !flagseen['L']))
+/* A symbol name whose name includes ^A is a gas internal pseudo symbol */
+#define S_IS_LOCAL(s) \
+  ((s)->sy_symbol.ost_entry.n_scnum == C_REGISTER_SECTION \
+   || (S_LOCAL_NAME(s) && !flagseen['L']) \
+   || (strchr (s, '\001') != NULL))
 /* True if a symbol is not defined in this file */
-#define S_IS_EXTERN(s)         ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value == 0)
+#define S_IS_EXTERN(s)         ((s)->sy_symbol.ost_entry.n_scnum == 0 \
+                                && S_GET_VALUE (s) == 0)
 /*
  * True if a symbol can be multiply defined (bss symbols have this def
  * though it is bad practice)
  */
-#define S_IS_COMMON(s)         ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value != 0)
+#define S_IS_COMMON(s)         ((s)->sy_symbol.ost_entry.n_scnum == 0 \
+                                && S_GET_VALUE (s) != 0)
 /* True if a symbol name is in the string table, i.e. its length is > 8. */
 #define S_IS_STRING(s)         (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
 
@@ -189,8 +203,6 @@ typedef struct
 #define S_GET_OFFSET(s)         ((s)->sy_symbol.ost_entry.n_offset)
 /* 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)) 
 /* The numeric value of the segment */
 #define S_GET_SEGMENT(s)   s_get_segment(s)
 /* The data type */
@@ -207,8 +219,6 @@ typedef struct
 #define S_SET_OFFSET(s,v)      ((s)->sy_symbol.ost_entry.n_offset = (v))
 /* The zeroes if symbol name is longer than 8 chars */
 #define S_SET_ZEROES(s,v)              ((s)->sy_symbol.ost_entry.n_zeroes = (v))
-/* Set the value of the symbol */
-#define S_SET_VALUE(s,v)       ((s)->sy_symbol.ost_entry.n_value = (v))
 /* The numeric value of the segment */
 #define S_SET_SEGMENT(s,v)     ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
 /* The data type */
@@ -276,27 +286,27 @@ typedef struct
  * 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. */
+#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 */
@@ -314,11 +324,11 @@ typedef struct
 #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))
@@ -336,11 +346,11 @@ typedef struct
 #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 */
 
@@ -445,81 +455,86 @@ typedef struct
 #define H_SET_LINENO_SIZE(h,v)          ((h)->lineno_size = (v))
 
 /* 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 */
-} ;
+
+  struct bfd_internal_lineno line;
+  char *frag;                  /* Frag to which the line number is related */
+  struct lineno_list *next;    /* Forward chain pointer */
+};
 
 
 
 
 /* stack stuff */
-typedef struct {
-       unsigned long chunk_size;
-       unsigned long element_size;
-       unsigned long size;
-       char*     data;
-       unsigned long pointer;
-} stack;
+typedef struct
+  {
+    unsigned long chunk_size;
+    unsigned long element_size;
+    unsigned long size;
+    char *data;
+    unsigned long pointer;
+  }
 
+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));
 
+segT EXFUN (s_get_segment,(struct symbol * ptr));
 
-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));
+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));
 
 
 /* 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 struct internal_scnhdr data_section_header;
+extern struct internal_scnhdr data_section_header;
 extern struct internal_scnhdr text_section_header;
 #else
 extern SCNHDR data_section_header;
@@ -527,11 +542,18 @@ extern SCNHDR text_section_header;
 #endif
 #endif
 
-/*
- * Local Variables:
- * comment-column: 0
- * fill-column: 131
- * End:
- */
+/* Forward the segment of a forwarded symbol.  */
+#define obj_frob_forward_symbol(symp) \
+  (SF_GET_GET_SEGMENT (symp) \
+   ? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \
+   : 0)
+
+#define SEPARATE_STAB_SECTIONS
+
+#define MAKE_STAB_SYMBOL(SYM, STR, SEC) \
+ { extern symbolS current_stab_symbol; \
+  (SYM) = &current_stab_symbol; \
+  (SYM)->sy_symbol.n_strx = get_stab_string_offset(STR, SEC);  \
+ }
 
 /* end of obj-coffbfd.h */
This page took 0.044359 seconds and 4 git commands to generate.