diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-07-24 18:18:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-07-24 18:18:39 +0000 |
commit | a91c6b08851fab0519eefdccded4580c702d7bba (patch) | |
tree | 2cf313750de1fd254a66a8e64a45dc58f9d26cc0 /gas | |
parent | eae0538f9c455c9f85699f489fa114b5103ae830 (diff) | |
download | gdb-a91c6b08851fab0519eefdccded4580c702d7bba.zip gdb-a91c6b08851fab0519eefdccded4580c702d7bba.tar.gz gdb-a91c6b08851fab0519eefdccded4580c702d7bba.tar.bz2 |
* 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.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 32 | ||||
-rw-r--r-- | gas/config/obj-coff.c | 94 |
2 files changed, 110 insertions, 16 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 7468d8a..671fe1c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -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> * config/tc-m68k.c (md_convert_frag): Rename argument seg to sec, diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index c1093a0..11a5daa 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -1030,6 +1030,10 @@ coff_frob_symbol (symp, punt) S_SET_STORAGE_CLASS (symp, C_EXT); else if (SF_GET_LOCAL (symp)) *punt = 1; + + if (SF_GET_FUNCTION (symp)) + symp->bsym->flags |= BSF_FUNCTION; + /* more ... */ } @@ -1607,7 +1611,8 @@ do_relocs_for (abfd, h, file_cursor) if (TC_COUNT_RELOC (fix_ptr)) { #ifdef TC_RELOC_MANGLE - TC_RELOC_MANGLE (fix_ptr, &intr, base); + TC_RELOC_MANGLE (&segment_info[idx], fix_ptr, &intr, + base); #else symbolS *dot; @@ -2451,6 +2456,10 @@ obj_read_begin_hook () /* This function runs through the symbol table and puts all the externals onto another chain */ +/* The chain of globals. */ +symbolS *symbol_globalP; +symbolS *symbol_global_lastP; + /* The chain of externals */ symbolS *symbol_externP; symbolS *symbol_extern_lastP; @@ -2640,6 +2649,23 @@ yank_symbols () symbol_append (symbolP, symbol_extern_lastP, &symbol_externP, &symbol_extern_lastP); 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 { if (SF_GET_STRING (symbolP)) @@ -2662,16 +2688,19 @@ yank_symbols () static unsigned int -glue_symbols () +glue_symbols (head, tail) + symbolS **head; + symbolS **tail; { unsigned int symbol_number = 0; symbolS *symbolP; - for (symbolP = symbol_externP; symbol_externP;) + + for (symbolP = *head; *head != NULL;) { - symbolS *tmp = symbol_externP; + symbolS *tmp = *head; /* append */ - symbol_remove (tmp, &symbol_externP, &symbol_extern_lastP); + symbol_remove (tmp, head, tail); symbol_append (tmp, symbol_lastP, &symbol_rootP, &symbol_lastP); /* and process */ @@ -2688,8 +2717,8 @@ glue_symbols () tmp->sy_number = symbol_number; symbol_number += 1 + S_GET_NUMBER_AUXILIARY (tmp); } /* append the entire extern chain */ - return symbol_number; + return symbol_number; } static unsigned int @@ -2768,9 +2797,16 @@ crawl_symbols (h, abfd) /* Take all the externals out and put them into another chain */ H_SET_SYMBOL_TABLE_SIZE (h, yank_symbols ()); /* 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 ()); + know (symbol_globalP == NULL); + know (symbol_global_lastP == NULL); know (symbol_externP == NULL); know (symbol_extern_lastP == NULL); } @@ -2991,6 +3027,10 @@ write_object_file () H_SET_STRING_SIZE (&headers, string_byte_count); +#ifdef tc_frob_file + tc_frob_file (); +#endif + for (i = SEG_E0; i < SEG_UNKNOWN; 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_org: +#ifdef HANDLE_ALIGN + HANDLE_ALIGN (frags); +#endif frags->fr_type = rs_fill; frags->fr_offset = (frags->fr_next->fr_address - frags->fr_address - frags->fr_fix); break; case rs_machine_dependent: - md_convert_frag (h, frags); + md_convert_frag (h, this_segment, frags); frag_wane (frags); break; default: @@ -3537,6 +3580,11 @@ fixup_mdeps (frags, h, this_segment) } #if 1 + +#ifndef TC_FORCE_RELOCATION +#define TC_FORCE_RELOCATION(fix) 0 +#endif + static void fixup_segment (segP, this_segment_type) segment_info_type * segP; @@ -3625,11 +3673,14 @@ fixup_segment (segP, this_segment_type) #endif /* TC_I960 */ add_number += S_GET_VALUE (add_symbolP) - S_GET_VALUE (sub_symbolP); - add_symbolP = NULL; - fixP->fx_addsy = NULL; - fixP->fx_subsy = NULL; - fixP->fx_done = 1; + + if (!TC_FORCE_RELOCATION (fixP)) + { + fixP->fx_addsy = NULL; + fixP->fx_subsy = NULL; + fixP->fx_done = 1; + } } else { @@ -3693,8 +3744,11 @@ fixup_segment (segP, this_segment_type) add_number -= segP->scnhdr.s_vaddr; #endif pcrel = 0; /* Lie. Don't want further pcrel processing. */ - fixP->fx_addsy = NULL; - fixP->fx_done = 1; + if (!TC_FORCE_RELOCATION (fixP)) + { + fixP->fx_addsy = NULL; + fixP->fx_done = 1; + } } else { @@ -3705,9 +3759,13 @@ fixup_segment (segP, this_segment_type) reloc_callj (fixP); /* See comment about reloc_callj() above*/ #endif /* TC_I960 */ add_number += S_GET_VALUE (add_symbolP); - fixP->fx_addsy = NULL; - fixP->fx_done = 1; add_symbolP = NULL; + + if (!TC_FORCE_RELOCATION (fixP)) + { + fixP->fx_addsy = NULL; + fixP->fx_done = 1; + } break; default: @@ -3805,7 +3863,11 @@ fixup_segment (segP, this_segment_type) } /* not a bit fix */ /* Once this fix has been applied, we don't have to output 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); +#endif } /* For each fixS in this segment. */ } /* fixup_segment() */ |