diff options
Diffstat (limited to 'gas/config/obj-coff.h')
-rw-r--r-- | gas/config/obj-coff.h | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h index ed1fda9..e90dd70 100644 --- a/gas/config/obj-coff.h +++ b/gas/config/obj-coff.h @@ -249,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) \ @@ -479,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). */ @@ -488,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) \ @@ -500,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) @@ -523,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. */ |