gas reloc rewrite.
[binutils-gdb.git] / gas / config / obj-coff.h
index 8d2ae736ac9686f1cb12bf583d011ecf93b748d3..e90dd70f0418fbd6a54034c210d3b263576b5356 100644 (file)
 #define TARGET_FORMAT "coff-tic30"
 #endif
 
+#ifdef TC_TIC4X
+#include "coff/tic4x.h"
+#define TARGET_FORMAT "coff2-c4x"
+#endif
+
 #ifdef TC_TIC54X
 #include "coff/tic54x.h"
 #define TARGET_FORMAT "coff1-c54x"
@@ -244,6 +249,12 @@ extern void coff_obj_read_begin_hook PARAMS ((void));
 #define OBJ_SYMFIELD_TYPE      unsigned long
 #define sy_obj                 sy_flags
 
+/* We can't use the predefined section symbols in bfd/section.c, as
+   COFF symbols have extra fields.  See bfd/libcoff.h:coff_symbol_type.  */
+#ifndef obj_sec_sym_ok_for_reloc
+#define obj_sec_sym_ok_for_reloc(SEC)  ((SEC)->owner != 0)
+#endif
+
 #define SYM_AUXENT(S) \
   (&coffsymbol (symbol_get_bfdsym (S))->native[1].u.auxent)
 #define SYM_AUXINFO(S) \
@@ -294,9 +305,9 @@ extern void SA_SET_SYM_ENDNDX PARAMS ((symbolS *, symbolS *));
 #define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
 
 /* Internal use only definitions. SF_ stands for symbol flags.
-  
+
    These values can be assigned to sy_symbol.ost_flags field of a symbolS.
-  
+
    You'll break i960 if you shift the SYSPROC bits anywhere else.  for
    more on the balname/callname hack, see tc-i960.h.  b.out is done
    differently.  */
@@ -474,7 +485,9 @@ typedef struct
 
 /* Predicates.  */
 /* True if the symbol is external.  */
-#define S_IS_EXTERNAL(s)        ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
+#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).  */
@@ -483,8 +496,17 @@ typedef struct
    || ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION \
        && S_GET_VALUE (s) > 0) \
    || ((s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
+
+/* 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) \
+  (!SEG_NORMAL (S_GET_SEGMENT (s)) || S_IS_WEAK (s))
+
 /* True if a debug special symbol entry.  */
-#define S_IS_DEBUG(s)          ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
+#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 includes ^A is a gas internal pseudo symbol.  */
 #define S_IS_LOCAL(s) \
@@ -495,13 +517,16 @@ typedef struct
    || (flag_strip_local_absolute \
        && !S_IS_EXTERNAL(s) \
        && (s)->sy_symbol.ost_entry.n_scnum == C_ABS_SECTION))
+
 /* True if a symbol is not defined in this file.  */
 #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_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)
 
@@ -518,34 +543,51 @@ typedef struct
 /* Accessors.  */
 /* The name of the symbol.  */
 #define S_GET_NAME(s)          ((char*) (s)->sy_symbol.ost_entry.n_offset)
+
 /* The pointer to the string table.  */
 #define S_GET_OFFSET(s)         ((s)->sy_symbol.ost_entry.n_offset)
+
 /* The numeric value of the segment.  */
 #define S_GET_SEGMENT(s)   s_get_segment(s)
+
 /* The data type.  */
 #define S_GET_DATA_TYPE(s)     ((s)->sy_symbol.ost_entry.n_type)
+
 /* The storage class.  */
 #define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
+
 /* The number of auxiliary entries.  */
 #define S_GET_NUMBER_AUXILIARY(s)      ((s)->sy_symbol.ost_entry.n_numaux)
 
 /* Modifiers.  */
 /* Set the name of the symbol.  */
-#define S_SET_NAME(s,v)                ((s)->sy_symbol.ost_entry.n_offset = (unsigned long) (v))
+#define S_SET_NAME(s,v) \
+  ((s)->sy_symbol.ost_entry.n_offset = (unsigned long) (v))
+
 /* Set the offset of the symbol.  */
-#define S_SET_OFFSET(s,v)      ((s)->sy_symbol.ost_entry.n_offset = (v))
+#define S_SET_OFFSET(s,v) \
+  ((s)->sy_symbol.ost_entry.n_offset = (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))
+#define S_SET_SEGMENT(s,v) \
+  ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
+
 /* The data type.  */
-#define S_SET_DATA_TYPE(s,v)   ((s)->sy_symbol.ost_entry.n_type = (v))
+#define S_SET_DATA_TYPE(s,v) \
+  ((s)->sy_symbol.ost_entry.n_type = (v))
+
 /* The storage class.  */
-#define S_SET_STORAGE_CLASS(s,v)       ((s)->sy_symbol.ost_entry.n_sclass = (v))
+#define S_SET_STORAGE_CLASS(s,v) \
+  ((s)->sy_symbol.ost_entry.n_sclass = (v))
+
 /* The number of auxiliary entries.  */
-#define S_SET_NUMBER_AUXILIARY(s,v)    ((s)->sy_symbol.ost_entry.n_numaux = (v))
+#define S_SET_NUMBER_AUXILIARY(s,v) \
+  ((s)->sy_symbol.ost_entry.n_numaux = (v))
 
 /* Additional modifiers.  */
 /* The symbol is external (does not mean undefined).  */
-#define S_SET_EXTERNAL(s)       { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
+#define S_SET_EXTERNAL(s) \
+  { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
 
 /* Auxiliary entry macros. SA_ stands for symbol auxiliary.  */
 /* Omit the tv related fields.  */
@@ -582,9 +624,9 @@ typedef struct
 #define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
 
 /* Internal use only definitions. SF_ stands for symbol flags.
-  
+
    These values can be assigned to sy_symbol.ost_flags field of a symbolS.
-  
+
    You'll break i960 if you shift the SYSPROC bits anywhere else.  for
    more on the balname/callname hack, see tc-i960.h.  b.out is done
    differently.  */