* config/tc-sh.c (md_pseudo_table): Add "uses".

(s_uses): New static function.
	(sh_coff_frob_file): New function.
	(md_convert_frag): Call subseg_change before calling fix_new.
	(sh_handle_align): New function.
	(SWITCH_TABLE): Define.
	(sh_force_relocation): New function.
	(md_apply_fix): Handle R_SH_USES, R_SH_COUNT and R_SH_ALIGN.
	(sh_coff_reloc_mangle): Likewise.  Also handle switch table
	entries.
	* config/tc-sh.h (HANDLE_ALIGN): Define.
	(sh_handle_align): Declare.
	(TC_FORCE_RELOCATION): Define.
	(sh_force_relocation): Declare.
	(TC_COUNT_RELOC): Simplify; rely on TC_FORCE_RELOCATION instead.
	(tc_frob_file): Define.
	(sh_coff_frob_file): Declare.
	* config/obj-coff.c (write_object_file): Call tc_frob_file if it
	is defined.
	(fixup_mdeps): Call HANDLE_ALIGN if it is defined.
	(TC_FORCE_RELOCATION): Define if not defined.
	(fixup_segment): Use TC_FORCE_RELOCATION to decide whether to
	clear the symbol fields of fixP.
This commit is contained in:
Ian Lance Taylor
1995-07-24 18:18:39 +00:00
parent eae0538f9c
commit a91c6b0885
2 changed files with 110 additions and 16 deletions

View File

@ -1,3 +1,35 @@
Mon Jul 24 14:10:24 1995 Ian Lance Taylor <ian@cygnus.com>
* config/tc-sh.c (md_pseudo_table): Add "uses".
(s_uses): New static function.
(sh_coff_frob_file): New function.
(md_convert_frag): Call subseg_change before calling fix_new.
(sh_handle_align): New function.
(SWITCH_TABLE): Define.
(sh_force_relocation): New function.
(md_apply_fix): Handle R_SH_USES, R_SH_COUNT and R_SH_ALIGN.
(sh_coff_reloc_mangle): Likewise. Also handle switch table
entries.
* config/tc-sh.h (HANDLE_ALIGN): Define.
(sh_handle_align): Declare.
(TC_FORCE_RELOCATION): Define.
(sh_force_relocation): Declare.
(TC_COUNT_RELOC): Simplify; rely on TC_FORCE_RELOCATION instead.
(tc_frob_file): Define.
(sh_coff_frob_file): Declare.
* config/obj-coff.c (write_object_file): Call tc_frob_file if it
is defined.
(fixup_mdeps): Call HANDLE_ALIGN if it is defined.
(TC_FORCE_RELOCATION): Define if not defined.
(fixup_segment): Use TC_FORCE_RELOCATION to decide whether to
clear the symbol fields of fixP.
Fri Jul 21 22:38:00 1995 Michael Meissner <meissner@cygnus.com>
* config/tc-ppc.c (ppc_elf_suffix): Add support for R_PPC_SDAREL
relocation.
(md_apply_fix3): Ditto.
Thu Jul 20 13:00:56 1995 Ken Raeburn <raeburn@cygnus.com> Thu Jul 20 13:00:56 1995 Ken Raeburn <raeburn@cygnus.com>
* config/tc-m68k.c (md_convert_frag): Rename argument seg to sec, * config/tc-m68k.c (md_convert_frag): Rename argument seg to sec,

View File

@ -1030,6 +1030,10 @@ coff_frob_symbol (symp, punt)
S_SET_STORAGE_CLASS (symp, C_EXT); S_SET_STORAGE_CLASS (symp, C_EXT);
else if (SF_GET_LOCAL (symp)) else if (SF_GET_LOCAL (symp))
*punt = 1; *punt = 1;
if (SF_GET_FUNCTION (symp))
symp->bsym->flags |= BSF_FUNCTION;
/* more ... */ /* more ... */
} }
@ -1607,7 +1611,8 @@ do_relocs_for (abfd, h, file_cursor)
if (TC_COUNT_RELOC (fix_ptr)) if (TC_COUNT_RELOC (fix_ptr))
{ {
#ifdef TC_RELOC_MANGLE #ifdef TC_RELOC_MANGLE
TC_RELOC_MANGLE (fix_ptr, &intr, base); TC_RELOC_MANGLE (&segment_info[idx], fix_ptr, &intr,
base);
#else #else
symbolS *dot; symbolS *dot;
@ -2451,6 +2456,10 @@ obj_read_begin_hook ()
/* This function runs through the symbol table and puts all the /* This function runs through the symbol table and puts all the
externals onto another chain */ externals onto another chain */
/* The chain of globals. */
symbolS *symbol_globalP;
symbolS *symbol_global_lastP;
/* The chain of externals */ /* The chain of externals */
symbolS *symbol_externP; symbolS *symbol_externP;
symbolS *symbol_extern_lastP; symbolS *symbol_extern_lastP;
@ -2640,6 +2649,23 @@ yank_symbols ()
symbol_append (symbolP, symbol_extern_lastP, &symbol_externP, &symbol_extern_lastP); symbol_append (symbolP, symbol_extern_lastP, &symbol_externP, &symbol_extern_lastP);
symbolP = hold; symbolP = hold;
} }
else if (! S_IS_DEBUG (symbolP)
&& ! SF_GET_STATICS (symbolP)
&& ! SF_GET_FUNCTION (symbolP)
&& S_GET_STORAGE_CLASS (symbolP) == C_EXT)
{
symbolS *hold = symbol_previous (symbolP);
/* The O'Reilly COFF book says that defined global symbols
come at the end of the symbol table, just before
undefined global symbols. */
symbol_remove (symbolP, &symbol_rootP, &symbol_lastP);
symbol_clear_list_pointers (symbolP);
symbol_append (symbolP, symbol_global_lastP, &symbol_globalP,
&symbol_global_lastP);
symbolP = hold;
}
else else
{ {
if (SF_GET_STRING (symbolP)) if (SF_GET_STRING (symbolP))
@ -2662,16 +2688,19 @@ yank_symbols ()
static unsigned int static unsigned int
glue_symbols () glue_symbols (head, tail)
symbolS **head;
symbolS **tail;
{ {
unsigned int symbol_number = 0; unsigned int symbol_number = 0;
symbolS *symbolP; symbolS *symbolP;
for (symbolP = symbol_externP; symbol_externP;)
for (symbolP = *head; *head != NULL;)
{ {
symbolS *tmp = symbol_externP; symbolS *tmp = *head;
/* append */ /* append */
symbol_remove (tmp, &symbol_externP, &symbol_extern_lastP); symbol_remove (tmp, head, tail);
symbol_append (tmp, symbol_lastP, &symbol_rootP, &symbol_lastP); symbol_append (tmp, symbol_lastP, &symbol_rootP, &symbol_lastP);
/* and process */ /* and process */
@ -2688,8 +2717,8 @@ glue_symbols ()
tmp->sy_number = symbol_number; tmp->sy_number = symbol_number;
symbol_number += 1 + S_GET_NUMBER_AUXILIARY (tmp); symbol_number += 1 + S_GET_NUMBER_AUXILIARY (tmp);
} /* append the entire extern chain */ } /* append the entire extern chain */
return symbol_number;
return symbol_number;
} }
static unsigned int static unsigned int
@ -2768,9 +2797,16 @@ crawl_symbols (h, abfd)
/* Take all the externals out and put them into another chain */ /* Take all the externals out and put them into another chain */
H_SET_SYMBOL_TABLE_SIZE (h, yank_symbols ()); H_SET_SYMBOL_TABLE_SIZE (h, yank_symbols ());
/* Take the externals and glue them onto the end.*/ /* Take the externals and glue them onto the end.*/
H_SET_SYMBOL_TABLE_SIZE (h, H_GET_SYMBOL_COUNT (h) + glue_symbols ()); H_SET_SYMBOL_TABLE_SIZE (h,
(H_GET_SYMBOL_COUNT (h)
+ glue_symbols (&symbol_globalP,
&symbol_global_lastP)
+ glue_symbols (&symbol_externP,
&symbol_extern_lastP)));
H_SET_SYMBOL_TABLE_SIZE (h, tie_tags ()); H_SET_SYMBOL_TABLE_SIZE (h, tie_tags ());
know (symbol_globalP == NULL);
know (symbol_global_lastP == NULL);
know (symbol_externP == NULL); know (symbol_externP == NULL);
know (symbol_extern_lastP == NULL); know (symbol_extern_lastP == NULL);
} }
@ -2991,6 +3027,10 @@ write_object_file ()
H_SET_STRING_SIZE (&headers, string_byte_count); H_SET_STRING_SIZE (&headers, string_byte_count);
#ifdef tc_frob_file
tc_frob_file ();
#endif
for (i = SEG_E0; i < SEG_UNKNOWN; i++) for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{ {
fixup_mdeps (segment_info[i].frchainP->frch_root, &headers, i); fixup_mdeps (segment_info[i].frchainP->frch_root, &headers, i);
@ -3521,12 +3561,15 @@ fixup_mdeps (frags, h, this_segment)
{ {
case rs_align: case rs_align:
case rs_org: case rs_org:
#ifdef HANDLE_ALIGN
HANDLE_ALIGN (frags);
#endif
frags->fr_type = rs_fill; frags->fr_type = rs_fill;
frags->fr_offset = frags->fr_offset =
(frags->fr_next->fr_address - frags->fr_address - frags->fr_fix); (frags->fr_next->fr_address - frags->fr_address - frags->fr_fix);
break; break;
case rs_machine_dependent: case rs_machine_dependent:
md_convert_frag (h, frags); md_convert_frag (h, this_segment, frags);
frag_wane (frags); frag_wane (frags);
break; break;
default: default:
@ -3537,6 +3580,11 @@ fixup_mdeps (frags, h, this_segment)
} }
#if 1 #if 1
#ifndef TC_FORCE_RELOCATION
#define TC_FORCE_RELOCATION(fix) 0
#endif
static void static void
fixup_segment (segP, this_segment_type) fixup_segment (segP, this_segment_type)
segment_info_type * segP; segment_info_type * segP;
@ -3625,12 +3673,15 @@ fixup_segment (segP, this_segment_type)
#endif /* TC_I960 */ #endif /* TC_I960 */
add_number += S_GET_VALUE (add_symbolP) - add_number += S_GET_VALUE (add_symbolP) -
S_GET_VALUE (sub_symbolP); S_GET_VALUE (sub_symbolP);
add_symbolP = NULL; add_symbolP = NULL;
if (!TC_FORCE_RELOCATION (fixP))
{
fixP->fx_addsy = NULL; fixP->fx_addsy = NULL;
fixP->fx_subsy = NULL; fixP->fx_subsy = NULL;
fixP->fx_done = 1; fixP->fx_done = 1;
} }
}
else else
{ {
/* Different segments in subtraction. */ /* Different segments in subtraction. */
@ -3693,9 +3744,12 @@ fixup_segment (segP, this_segment_type)
add_number -= segP->scnhdr.s_vaddr; add_number -= segP->scnhdr.s_vaddr;
#endif #endif
pcrel = 0; /* Lie. Don't want further pcrel processing. */ pcrel = 0; /* Lie. Don't want further pcrel processing. */
if (!TC_FORCE_RELOCATION (fixP))
{
fixP->fx_addsy = NULL; fixP->fx_addsy = NULL;
fixP->fx_done = 1; fixP->fx_done = 1;
} }
}
else else
{ {
switch (add_symbol_segment) switch (add_symbol_segment)
@ -3705,9 +3759,13 @@ fixup_segment (segP, this_segment_type)
reloc_callj (fixP); /* See comment about reloc_callj() above*/ reloc_callj (fixP); /* See comment about reloc_callj() above*/
#endif /* TC_I960 */ #endif /* TC_I960 */
add_number += S_GET_VALUE (add_symbolP); add_number += S_GET_VALUE (add_symbolP);
add_symbolP = NULL;
if (!TC_FORCE_RELOCATION (fixP))
{
fixP->fx_addsy = NULL; fixP->fx_addsy = NULL;
fixP->fx_done = 1; fixP->fx_done = 1;
add_symbolP = NULL; }
break; break;
default: default:
@ -3805,7 +3863,11 @@ fixup_segment (segP, this_segment_type)
} /* not a bit fix */ } /* not a bit fix */
/* Once this fix has been applied, we don't have to output /* Once this fix has been applied, we don't have to output
anything nothing more need be done. */ anything nothing more need be done. */
#ifdef MD_APPLY_FIX3
md_apply_fix3 (fixP, &add_number, this_segment_type);
#else
md_apply_fix (fixP, add_number); md_apply_fix (fixP, add_number);
#endif
} /* For each fixS in this segment. */ } /* For each fixS in this segment. */
} /* fixup_segment() */ } /* fixup_segment() */