From 7ab1edc8f0070c300e6edcab31d8be26bddec07a Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 31 Oct 1995 22:55:22 +0000 Subject: [PATCH] * config/tc-ppc.c (ppc_bb): Call SF_SET_PROCESS. (ppc_eb): Likewise. Set the storage class to C_BLOCK, not C_FCN. (ppc_frob_symbol): Don't change C_BLOCK symbols to C_HIDEXT. * config/obj-coff.c (coff_frob_symbol): Don't call SA_SET_SYM_ENDNDX with the current symbol; call it with the next one. If OBJ_XCOFF, try to figure out whether the symbol is going to be dropped. --- gas/ChangeLog | 8 ++++ gas/config/obj-coff.c | 90 ++++++++++++++++++++++++++++++++++--------- gas/config/tc-ppc.c | 7 +++- 3 files changed, 86 insertions(+), 19 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 9ec34d3f8e9..97145a84e4c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -17,6 +17,14 @@ Tue Oct 31 16:34:28 1995 David Mosberger-Tang Tue Oct 31 13:29:08 1995 Ian Lance Taylor + * config/tc-ppc.c (ppc_bb): Call SF_SET_PROCESS. + (ppc_eb): Likewise. Set the storage class to C_BLOCK, not C_FCN. + (ppc_frob_symbol): Don't change C_BLOCK symbols to C_HIDEXT. + * config/obj-coff.c (coff_frob_symbol): Don't call + SA_SET_SYM_ENDNDX with the current symbol; call it with the next + one. If OBJ_XCOFF, try to figure out whether the symbol is going + to be dropped. + * config/tc-ppc.c (md_pseudo_table): Add "bc" and "ec". (ppc_stab_symbol): New static variable. (ppc_change_csect): Check that ppc_toc_csect is not NULL. diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index a5c04d2a1e8..64d7e3c7b59 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -414,7 +414,7 @@ obj_symbol_new_hook (symbolP) static symbolS *current_lineno_sym; static struct line_no *line_nos; /* @@ Blindly assume all .ln directives will be in the .text section... */ -static int n_line_nos; +int coff_n_line_nos; static void add_lineno (frag, offset, num) @@ -433,7 +433,7 @@ add_lineno (frag, offset, num) new_line->l.line_number = num; new_line->l.u.offset = offset; line_nos = new_line; - n_line_nos++; + coff_n_line_nos++; } void @@ -443,7 +443,7 @@ coff_add_linesym (sym) if (line_nos) { coffsymbol (current_lineno_sym->bsym)->lineno = (alent *) line_nos; - n_line_nos++; + coff_n_line_nos++; line_nos = 0; } current_lineno_sym = sym; @@ -938,6 +938,7 @@ coff_frob_symbol (symp, punt) static symbolS *last_tagP; static stack *block_stack; static symbolS *set_end; + symbolS *next_set_end = NULL; if (symp == &abs_symbol) { @@ -990,7 +991,7 @@ coff_frob_symbol (symp, punt) if (begin == 0) as_warn ("mismatched .eb"); else - set_end = begin; + next_set_end = begin; } } if (coff_last_function == 0 && SF_GET_FUNCTION (symp)) @@ -1010,14 +1011,14 @@ coff_frob_symbol (symp, punt) SA_SET_SYM_FSIZE (coff_last_function, (long) (S_GET_VALUE (symp) - S_GET_VALUE (coff_last_function))); - set_end = coff_last_function; + next_set_end = coff_last_function; coff_last_function = 0; } } else if (SF_GET_TAG (symp)) last_tagP = symp; else if (S_GET_STORAGE_CLASS (symp) == C_EOS) - set_end = last_tagP; + next_set_end = last_tagP; else if (S_GET_STORAGE_CLASS (symp) == C_FILE) { if (S_GET_VALUE (symp)) @@ -1037,6 +1038,17 @@ coff_frob_symbol (symp, punt) /* more ... */ } +#ifdef OBJ_XCOFF + /* This is pretty horrible, but we have to set *punt correctly in + order to call SA_SET_SYM_ENDNDX correctly. */ + if (! symp->sy_used_in_reloc + && ((symp->bsym->flags & BSF_SECTION_SYM) != 0 + || (! S_IS_EXTERNAL (symp) + && ! symp->sy_tc.output + && S_GET_STORAGE_CLASS (symp) != C_FILE))) + *punt = 1; +#endif + if (set_end != (symbolS *) NULL && ! *punt) { @@ -1044,6 +1056,10 @@ coff_frob_symbol (symp, punt) set_end = NULL; } + if (next_set_end != NULL + && ! *punt) + set_end = next_set_end; + if (coffsymbol (symp->bsym)->lineno) { int i; @@ -1088,7 +1104,7 @@ coff_adjust_section_syms (abfd, sec, x) return; if (!strcmp (sec->name, ".text")) - nlnno = n_line_nos; + nlnno = coff_n_line_nos; else nlnno = 0; { @@ -1143,6 +1159,14 @@ obj_coff_section (ignore) flagword flags; asection *sec; + if (flag_mri) + { + char type; + + s_mri_sect (&type); + return; + } + section_name = input_line_pointer; c = get_symbol_end (); @@ -3186,6 +3210,21 @@ obj_coff_section (ignore) unsigned int exp; long flags; + if (flag_mri) + { + char type; + + s_mri_sect (&type); + flags = 0; + if (type == 'C') + flags = STYP_TEXT; + else if (type == 'D') + flags = STYP_DATA; + segment_info[now_seg].scnhdr.s_flags |= flags; + + return; + } + section_name = input_line_pointer; c = get_symbol_end (); section_name_end = input_line_pointer; @@ -3657,25 +3696,37 @@ fixup_segment (segP, this_segment_type) if (sub_symbolP) { - if (!add_symbolP) + if (add_symbolP == NULL || add_symbol_segment == absolute_section) { - /* Its just -sym */ - if (S_GET_SEGMENT (sub_symbolP) != absolute_section) + if (add_symbolP != NULL) + { + add_number += S_GET_VALUE (add_symbolP); + add_symbolP = NULL; + fixP->fx_addsy = NULL; + } + + /* It's just -sym. */ + if (S_GET_SEGMENT (sub_symbolP) == absolute_section) + { + add_number -= S_GET_VALUE (sub_symbolP); + fixP->fx_subsy = 0; + fixP->fx_done = 1; + } + else { +#ifndef TC_M68K as_bad_where (fixP->fx_file, fixP->fx_line, "Negative of non-absolute symbol %s", S_GET_NAME (sub_symbolP)); +#endif + add_number -= S_GET_VALUE (sub_symbolP); } /* not absolute */ - add_number -= S_GET_VALUE (sub_symbolP); - fixP->fx_subsy = 0; - /* if sub_symbol is in the same segment that add_symbol - and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */ + and add_symbol is either in DATA, TEXT, BSS or ABSOLUTE */ } - else if ((S_GET_SEGMENT (sub_symbolP) == add_symbol_segment) - && (SEG_NORMAL (add_symbol_segment) - || (add_symbol_segment == absolute_section))) + else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment + && SEG_NORMAL (add_symbol_segment)) { /* Difference of 2 symbols from same segment. Can't make difference of 2 undefineds: 'value' means @@ -3985,9 +4036,12 @@ const pseudo_typeS obj_pseudo_table[] = {"type", obj_coff_type, 0}, {"val", obj_coff_val, 0}, {"section", obj_coff_section, 0}, + {"sect", obj_coff_section, 0}, + /* FIXME: We ignore the MRI short attribute. */ + {"section.s", obj_coff_section, 0}, + {"sect.s", obj_coff_section, 0}, #ifndef BFD_ASSEMBLER {"use", obj_coff_section, 0}, - {"sect", obj_coff_section, 0}, {"text", obj_coff_text, 0}, {"data", obj_coff_data, 0}, {"bss", obj_coff_bss, 0}, diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 4683b2f4d6b..f2d9b22a35e 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2515,6 +2515,8 @@ ppc_bb (ignore) sym->sy_tc.output = 1; + SF_SET_PROCESS (sym); + ppc_frob_label (sym); demand_empty_rest_of_line (); @@ -2533,11 +2535,13 @@ ppc_eb (ignore) S_SET_SEGMENT (sym, text_section); sym->sy_frag = frag_now; S_SET_VALUE (sym, frag_now_fix ()); - S_SET_STORAGE_CLASS (sym, C_FCN); + S_SET_STORAGE_CLASS (sym, C_BLOCK); S_SET_NUMBER_AUXILIARY (sym, 1); SA_SET_SYM_LNNO (sym, get_absolute_expression ()); sym->sy_tc.output = 1; + SF_SET_PROCESS (sym); + ppc_frob_label (sym); demand_empty_rest_of_line (); @@ -3547,6 +3551,7 @@ ppc_frob_symbol (sym) && (sym->bsym->flags & BSF_SECTION_SYM) == 0 && S_GET_STORAGE_CLASS (sym) != C_FILE && S_GET_STORAGE_CLASS (sym) != C_FCN + && S_GET_STORAGE_CLASS (sym) != C_BLOCK && S_GET_STORAGE_CLASS (sym) != C_BSTAT && S_GET_STORAGE_CLASS (sym) != C_ESTAT && S_GET_STORAGE_CLASS (sym) != C_BINCL -- 2.30.2