X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig%2Ftc-alpha.c;h=89eaf88603da7a3ce3fab869b201384c80e1ea9d;hb=945e0f82dad31db89a107b496532886fe215c011;hp=3cfca209ade28593fac46dfda9452018ea26d986;hpb=87975d2a60adf249212c1c031abb4dd0dbb800ac;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index 3cfca209ad..89eaf88603 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -1,7 +1,5 @@ /* tc-alpha.c - Processor-specific code for the DEC Alpha AXP CPU. - Copyright 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 1989-2016 Free Software Foundation, Inc. Contributed by Carnegie Mellon University, 1993. Written by Alessandro Forin, based on earlier gas-1.38 target CPU files. Modified by Ken Raeburn for gas-2.x and ECOFF support. @@ -243,7 +241,7 @@ const char EXP_CHARS[] = "eE"; /* Characters which mean that a number is a floating point constant, as in 0d1.0. */ /* XXX: Do all of these really get used on the alpha?? */ -char FLT_CHARS[] = "rRsSfFdDxXpP"; +const char FLT_CHARS[] = "rRsSfFdDxXpP"; #ifdef OBJ_EVAX const char *md_shortopts = "Fm:g+1h:HG:"; @@ -267,7 +265,7 @@ struct option md_longopts[] = #define OPTION_REPLACE (OPTION_RELAX + 1) #define OPTION_NOREPLACE (OPTION_REPLACE+1) { "replace", no_argument, NULL, OPTION_REPLACE }, - { "noreplace", no_argument, NULL, OPTION_NOREPLACE }, + { "noreplace", no_argument, NULL, OPTION_NOREPLACE }, #endif { NULL, no_argument, NULL, 0 } }; @@ -293,8 +291,6 @@ size_t md_longopts_size = sizeof (md_longopts); #undef AXP_REG_GP #define AXP_REG_GP AXP_REG_PV -static struct hash_control *alpha_evax_proc_hash; - #endif /* OBJ_EVAX */ /* The cpu for which we are generating code. */ @@ -429,6 +425,7 @@ static struct alpha_linkage_fixups *alpha_linkage_fixup_tail; /* Current procedure descriptor. */ static struct alpha_evax_procs *alpha_evax_proc; +static struct alpha_evax_procs alpha_evax_proc_data; static int alpha_flag_hash_long_names = 0; /* -+ */ static int alpha_flag_show_after_trunc = 0; /* -H */ @@ -581,8 +578,8 @@ static void assemble_insn (const struct alpha_opcode *, const expressionS *, int static void emit_insn (struct alpha_insn *); static void assemble_tokens (const char *, const expressionS *, int, int); #ifdef OBJ_EVAX -static char *s_alpha_section_name (void); -static symbolS *add_to_link_pool (symbolS *, symbolS *, offsetT); +static const char *s_alpha_section_name (void); +static symbolS *add_to_link_pool (symbolS *, offsetT); #endif static struct alpha_reloc_tag * @@ -924,8 +921,7 @@ tokenize_arguments (char *str, ++input_line_pointer; SKIP_WHITESPACE (); - p = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&p); /* Parse !relocation_type. */ len = input_line_pointer - p; @@ -946,7 +942,7 @@ tokenize_arguments (char *str, } *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != '!') { if (r->require_seq) @@ -1395,7 +1391,8 @@ load_expression (int targreg, gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS); insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_NOP; ensym = symbol_find_or_make (ensymname); - ensym->sy_used = 1; + free (ensymname); + symbol_mark_used (ensym); /* The fixup must be the same as the BFD_RELOC_ALPHA_BOH case in emit_jsrjmp. See B.4.5.2 of the OpenVMS Linker Utility Manual. */ @@ -1427,7 +1424,8 @@ load_expression (int targreg, gas_assert (insn.nfixups + 1 <= MAX_INSN_FIXUPS); insn.fixups[insn.nfixups].reloc = BFD_RELOC_ALPHA_LDA; psym = symbol_find_or_make (psymname); - psym->sy_used = 1; + free (psymname); + symbol_mark_used (psym); insn.fixups[insn.nfixups].exp.X_op = O_subtract; insn.fixups[insn.nfixups].exp.X_add_symbol = psym; insn.fixups[insn.nfixups].exp.X_op_symbol = alpha_evax_proc->symbol; @@ -1448,8 +1446,7 @@ load_expression (int targreg, if (!range_signed_32 (addend)) addend = sign_extend_32 (addend); - linkexp = add_to_link_pool (alpha_evax_proc->symbol, - exp->X_add_symbol, 0); + linkexp = add_to_link_pool (exp->X_add_symbol, 0); set_tok_reg (newtok[0], targreg); set_tok_sym (newtok[1], linkexp, 0); set_tok_preg (newtok[2], basereg); @@ -1516,8 +1513,7 @@ load_expression (int targreg, /* For 64-bit addends, just put it in the literal pool. */ #ifdef OBJ_EVAX /* Emit "ldq targreg, lit(basereg)". */ - litexp = add_to_link_pool (alpha_evax_proc->symbol, - section_symbol (absolute_section), addend); + litexp = add_to_link_pool (section_symbol (absolute_section), addend); set_tok_reg (newtok[0], targreg); set_tok_sym (newtok[1], litexp, 0); set_tok_preg (newtok[2], alpha_gp_register); @@ -1803,7 +1799,7 @@ emit_insn (struct alpha_insn *insn) default: gas_assert (size >= 1 && size <= 4); } - + pcrel = reloc_howto->pc_relative; } @@ -1979,7 +1975,7 @@ static unsigned insert_operand (unsigned insn, const struct alpha_operand *operand, offsetT val, - char *file, + const char *file, unsigned line) { if (operand->bits != 32 && !(operand->flags & AXP_OPERAND_NOOVERFLOW)) @@ -1998,7 +1994,7 @@ insert_operand (unsigned insn, } if (val < min || val > max) - as_warn_value_out_of_range (_("operand"), val, min, max, file, line); + as_bad_value_out_of_range (_("operand"), val, min, max, file, line); } if (operand->insert) @@ -2142,7 +2138,7 @@ assemble_insn (const struct alpha_opcode *opcode, /* If this is a real relocation (as opposed to a lituse hint), then the relocation width should match the operand width. - Take care of -MDISP in operand table. */ + Take care of -MDISP in operand table. */ else if (reloc < BFD_RELOC_UNUSED && reloc > 0) { reloc_howto_type *reloc_howto @@ -2195,7 +2191,7 @@ emit_ir_load (const expressionS *tok, if (basereg == alpha_gp_register && (symlen > 4 && strcmp (&symname [symlen - 4], "..lk") == 0)) return; - + newtok[0] = tok[0]; set_tok_preg (newtok[2], basereg); @@ -2236,7 +2232,7 @@ emit_loadstore (const expressionS *tok, if (alpha_noat_on) as_bad (_("macro requires $at register while noat in effect")); - lituse = load_expression (AXP_REG_AT, &tok[1], + lituse = load_expression (AXP_REG_AT, &tok[1], &basereg, &newtok[1], (const char *) opname); } else @@ -2909,6 +2905,7 @@ emit_jsrjmp (const expressionS *tok, insn.fixups[0].procsym = alpha_evax_proc->symbol; insn.nfixups++; alpha_linkage_symbol = 0; + free (ensymname); } #endif @@ -3372,26 +3369,24 @@ assemble_tokens (const char *opname, #ifdef OBJ_EVAX -/* Add symbol+addend to link pool. - Return offset from basesym to entry in link pool. +/* Add sym+addend to link pool. + Return offset from curent procedure value (pv) to entry in link pool. Add new fixup only if offset isn't 16bit. */ static symbolS * -add_to_link_pool (symbolS *basesym, - symbolS *sym, - offsetT addend) +add_to_link_pool (symbolS *sym, offsetT addend) { + symbolS *basesym; segT current_section = now_seg; int current_subsec = now_subseg; - valueT offset; char *p; segment_info_type *seginfo = seg_info (alpha_link_section); fixS *fixp; symbolS *linksym, *expsym; expressionS e; - - offset = 0; /* ??? DBR */ + + basesym = alpha_evax_proc->symbol; /* @@ This assumes all entries in a given section will be of the same size... Probably correct, but unwise to rely on. */ @@ -3402,11 +3397,6 @@ add_to_link_pool (symbolS *basesym, fixp != (fixS *) NULL; fixp = fixp->fx_next) { - if (fixp->tc_fix_data.info - && fixp->tc_fix_data.info->sym - && fixp->tc_fix_data.info->sym->sy_value.X_op_symbol == basesym) - offset += 8; - if (fixp->fx_addsy == sym && fixp->fx_offset == (valueT)addend && fixp->tc_fix_data.info @@ -3415,27 +3405,29 @@ add_to_link_pool (symbolS *basesym, return fixp->tc_fix_data.info->sym; } - /* Not found in 16bit signed range. */ - + /* Not found, add a new entry. */ subseg_set (alpha_link_section, 0); linksym = symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now); p = frag_more (8); memset (p, 0, 8); + /* Create a symbol for 'basesym - linksym' (offset of the added entry). */ e.X_op = O_subtract; e.X_add_symbol = linksym; e.X_op_symbol = basesym; e.X_add_number = 0; expsym = make_expr_symbol (&e); + /* Create a fixup for the entry. */ fixp = fix_new - (frag_now, p-frag_now->fr_literal, 8, sym, addend, 0, BFD_RELOC_64); + (frag_now, p - frag_now->fr_literal, 8, sym, addend, 0, BFD_RELOC_64); fixp->tc_fix_data.info = get_alpha_reloc_tag (next_sequence_num--); fixp->tc_fix_data.info->sym = expsym; subseg_set (current_section, current_subsec); - seginfo->literal_pool_size += 8; + + /* Return the symbol. */ return expsym; } #endif /* OBJ_EVAX */ @@ -3504,14 +3496,13 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) int log_align = 0; #endif - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* Alpha OSF/1 compiler doesn't provide the comma, gcc does. */ if (*input_line_pointer == ',') @@ -3561,12 +3552,12 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) The symbol is effectively an alias for the section name. */ segT sec; - char *sec_name; + const char *sec_name; symbolS *sec_symbol; segT current_seg = now_seg; subsegT current_subseg = now_subseg; int cur_size; - + input_line_pointer++; SKIP_WHITESPACE (); sec_name = s_alpha_section_name (); @@ -3610,7 +3601,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) frag_align (log_align, 0, 0); record_alignment (bss_section, log_align); - symbolP->sy_frag = frag_now; + symbol_set_frag (symbolP, frag_now); pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP, size, NULL); *pfrag = 0; @@ -3620,7 +3611,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) subseg_set (current_seg, current_subseg); } #endif - + if (S_GET_VALUE (symbolP)) { if (S_GET_VALUE (symbolP) != (valueT) size) @@ -3636,7 +3627,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) #endif S_SET_EXTERNAL (symbolP); } - + #ifndef OBJ_EVAX know (symbolP->sy_frag == &zero_address_frag); #endif @@ -3701,6 +3692,8 @@ static struct alpha_elf_frame_data *all_frame_data; static struct alpha_elf_frame_data **plast_frame_data = &all_frame_data; static struct alpha_elf_frame_data *cur_frame_data; +extern int all_cfi_sections; + /* Handle the .section pseudo-op. This is like the usual one, but it clears alpha_insn_label and restores auto alignment. */ @@ -3722,13 +3715,15 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); + /* CFI_EMIT_eh_frame is the default. */ + all_cfi_sections = CFI_EMIT_eh_frame; if (! is_name_beginner (*name)) { as_warn (_(".ent directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else { @@ -3754,7 +3749,7 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED) /* The .ent directive is sometimes followed by a number. Not sure what it really means, but ignore it. */ *input_line_pointer = name_end; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer == ',') { input_line_pointer++; @@ -3775,13 +3770,12 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_warn (_(".end directive has no name")); - *input_line_pointer = name_end; } else { @@ -3809,9 +3803,9 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED) } cur_frame_data = NULL; - - *input_line_pointer = name_end; } + + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } } @@ -4053,6 +4047,14 @@ alpha_elf_md_end (void) if (bfd_get_section_by_name (stdoutput, ".eh_frame") != NULL) return; + /* ??? In theory we could look for functions for which we have + generated unwind info via CFI directives, and those we have not. + Those we have not could still get their unwind info from here. + For now, do nothing if we've seen any CFI directives. Note that + the above test will not trigger, as we've not emitted data yet. */ + if (all_fde_data != NULL) + return; + /* Generate .eh_frame data for the unwind directives specified. */ for (p = all_frame_data; p ; p = p->next) if (p->prologue_sym) @@ -4063,6 +4065,7 @@ alpha_elf_md_end (void) S_GET_VALUE (p->func_sym), symbol_get_frag (p->func_sym))); + cfi_set_sections (); cfi_set_return_column (p->ra_regno); cfi_add_CFA_def_cfa_register (30); if (p->fp_regno != 30 || p->mask || p->fmask || p->frame_size) @@ -4127,19 +4130,20 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) symbolS *sym; int other; - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_bad (_(".usepv directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); ignore_rest_of_line (); return; } sym = symbol_find_or_make (name); - *input_line_pointer++ = name_end; + name_end = restore_line_pointer (name_end); + if (! is_end_of_line[(unsigned char) name_end]) + input_line_pointer++; if (name_end != ',') { @@ -4149,8 +4153,8 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) } SKIP_WHITESPACE (); - which = input_line_pointer; - which_end = get_symbol_end (); + + which_end = get_symbol_name (&which); if (strcmp (which, "no") == 0) other = STO_ALPHA_NOPV; @@ -4162,7 +4166,7 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) other = 0; } - *input_line_pointer = which_end; + (void) restore_line_pointer (which_end); demand_empty_rest_of_line (); S_SET_OTHER (sym, other | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD)); @@ -4180,7 +4184,7 @@ alpha_cfi_frame_initial_instructions (void) #ifdef OBJ_EVAX /* Get name of section. */ -static char * +static const char * s_alpha_section_name (void) { char *name; @@ -4237,7 +4241,7 @@ s_alpha_section_word (char *str, size_t len) { no = 1; str += 2; - len -= 2; + len -= 2; } if (len == 3) @@ -4288,13 +4292,14 @@ s_alpha_section_word (char *str, size_t len) #define EVAX_SECTION_COUNT 5 -static char *section_name[EVAX_SECTION_COUNT + 1] = +static const char *section_name[EVAX_SECTION_COUNT + 1] = { "NULL", ".rdata", ".comm", ".link", ".ctors", ".dtors" }; static void s_alpha_section (int secid) { - char *name, *beg; + const char *name; + char *beg; segT sec; flagword vms_flags = 0; symbolS *symbol; @@ -4316,15 +4321,15 @@ s_alpha_section (int secid) char c; SKIP_WHITESPACE (); - beg = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&beg); *input_line_pointer = c; vms_flags |= s_alpha_section_word (beg, input_line_pointer - beg); - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); } while (*input_line_pointer++ == ','); + --input_line_pointer; } @@ -4366,8 +4371,10 @@ s_alpha_ent (int ignore ATTRIBUTE_UNUSED) symbolS *symbol; expressionS symexpr; - alpha_evax_proc - = (struct alpha_evax_procs *) xmalloc (sizeof (struct alpha_evax_procs)); + if (alpha_evax_proc != NULL) + as_bad (_("previous .ent not closed by a .end")); + + alpha_evax_proc = &alpha_evax_proc_data; alpha_evax_proc->pdsckind = 0; alpha_evax_proc->framereg = -1; @@ -4395,10 +4402,6 @@ s_alpha_ent (int ignore ATTRIBUTE_UNUSED) symbol_get_bfdsym (symbol)->flags |= BSF_FUNCTION; alpha_evax_proc->symbol = symbol; - (void) hash_insert - (alpha_evax_proc_hash, - symbol_get_bfdsym (alpha_evax_proc->symbol)->name, (PTR)alpha_evax_proc); - demand_empty_rest_of_line (); } @@ -4410,13 +4413,12 @@ s_alpha_handler (int is_data) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_warn (_(".handler directive has no name")); - *input_line_pointer = name_end; } else { @@ -4425,9 +4427,11 @@ s_alpha_handler (int is_data) sym = symbol_find_or_make (name); symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; alpha_evax_proc->handler = sym; - *input_line_pointer = name_end; } - } + + (void) restore_line_pointer (name_end); + } + demand_empty_rest_of_line (); } @@ -4437,6 +4441,7 @@ static void s_alpha_frame (int ignore ATTRIBUTE_UNUSED) { long val; + int ra; alpha_evax_proc->framereg = tc_get_register (1); @@ -4452,7 +4457,10 @@ s_alpha_frame (int ignore ATTRIBUTE_UNUSED) alpha_evax_proc->framesize = val; - (void) tc_get_register (1); + ra = tc_get_register (1); + if (ra != AXP_REG_RA) + as_warn (_("Bad RA (%d) register for .frame"), ra); + SKIP_WHITESPACE (); if (*input_line_pointer++ != ',') { @@ -4469,13 +4477,12 @@ s_alpha_frame (int ignore ATTRIBUTE_UNUSED) static void s_alpha_prologue (int ignore ATTRIBUTE_UNUSED) { - get_absolute_expression (); demand_empty_rest_of_line (); alpha_prologue_label = symbol_new (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now); } -/* Parse .pdesc . +/* Parse .pdesc ,{null|stack|reg} Insert a procedure descriptor. */ static void @@ -4483,58 +4490,57 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) { char *name; char name_end; - register char *p; + char *p; expressionS exp; symbolS *entry_sym; - fixS *fixp; - segment_info_type *seginfo = seg_info (alpha_link_section); const char *entry_sym_name; - char *sym_name; - int len; + const char *pdesc_sym_name; + fixS *fixp; + size_t len; if (now_seg != alpha_link_section) { as_bad (_(".pdesc directive not in link (.link) section")); - demand_empty_rest_of_line (); return; } expression (&exp); if (exp.X_op != O_symbol) { - as_warn (_(".pdesc directive has no entry symbol")); - demand_empty_rest_of_line (); + as_bad (_(".pdesc directive has no entry symbol")); return; } - + entry_sym = make_expr_symbol (&exp); - entry_sym_name = symbol_get_bfdsym (entry_sym)->name; - + entry_sym_name = S_GET_NAME (entry_sym); + + /* Strip "..en". */ len = strlen (entry_sym_name); - sym_name = (char *) xmalloc (len - 4 + 1); - strncpy (sym_name, entry_sym_name, len - 4); - sym_name [len - 4] = 0; - - alpha_evax_proc = (struct alpha_evax_procs *) - hash_find (alpha_evax_proc_hash, sym_name); - - if (!alpha_evax_proc || !S_IS_DEFINED (alpha_evax_proc->symbol)) + if (len < 4 || strcmp (entry_sym_name + len - 4, "..en") != 0) { - as_fatal (_(".pdesc has no matching .ent")); - demand_empty_rest_of_line (); + as_bad (_(".pdesc has a bad entry symbol")); + return; + } + len -= 4; + pdesc_sym_name = S_GET_NAME (alpha_evax_proc->symbol); + + if (!alpha_evax_proc + || !S_IS_DEFINED (alpha_evax_proc->symbol) + || strlen (pdesc_sym_name) != len + || memcmp (entry_sym_name, pdesc_sym_name, len) != 0) + { + as_fatal (_(".pdesc doesn't match with last .ent")); return; } - *symbol_get_obj (alpha_evax_proc->symbol) = - (valueT) seginfo->literal_pool_size; + /* Define pdesc symbol. */ + symbol_set_value_now (alpha_evax_proc->symbol); - alpha_evax_proc->symbol->sy_obj = (valueT)seginfo->literal_pool_size; - /* Save bfd symbol of proc entry in function symbol. */ ((struct evax_private_udata_struct *) symbol_get_bfdsym (alpha_evax_proc->symbol)->udata.p)->enbsym = symbol_get_bfdsym (entry_sym); - + SKIP_WHITESPACE (); if (*input_line_pointer++ != ',') { @@ -4544,8 +4550,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) } SKIP_WHITESPACE (); - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (strncmp (name, "stack", 5) == 0) alpha_evax_proc->pdsckind = PDSC_S_K_KIND_FP_STACK; @@ -4558,12 +4563,13 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) else { + (void) restore_line_pointer (name_end); as_fatal (_("unknown procedure kind")); demand_empty_rest_of_line (); return; } - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); #ifdef md_flush_pending_output @@ -4574,7 +4580,6 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) p = frag_more (16); fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); fixp->fx_done = 1; - seginfo->literal_pool_size += 16; *p = alpha_evax_proc->pdsckind | ((alpha_evax_proc->framereg == 29) ? PDSC_S_M_BASE_REG_IS_FP : 0) @@ -4605,20 +4610,15 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) /* Signature offset. */ md_number_to_chars (p + 6, (valueT) 0, 2); - fix_new_exp (frag_now, p - frag_now->fr_literal+8, 8, &exp, 0, BFD_RELOC_64); + fix_new_exp (frag_now, p - frag_now->fr_literal + 8, + 8, &exp, 0, BFD_RELOC_64); if (alpha_evax_proc->pdsckind == PDSC_S_K_KIND_NULL) return; - /* Add dummy fix to make add_to_link_pool work. */ - p = frag_more (6); - fixp = fix_new (frag_now, p - frag_now->fr_literal, 6, 0, 0, 0, 0); - fixp->fx_done = 1; - seginfo->literal_pool_size += 6; - /* pdesc+16: Size. */ + p = frag_more (6); md_number_to_chars (p, (valueT) alpha_evax_proc->framesize, 4); - md_number_to_chars (p + 4, (valueT) 0, 2); /* Entry length. */ @@ -4630,14 +4630,8 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) if (alpha_evax_proc->pdsckind == PDSC_S_K_KIND_FP_REGISTER) return; - /* Add dummy fix to make add_to_link_pool work. */ - p = frag_more (8); - fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); - fixp->fx_done = 1; - seginfo->literal_pool_size += 8; - /* pdesc+24: register masks. */ - + p = frag_more (8); md_number_to_chars (p, alpha_evax_proc->imask, 4); md_number_to_chars (p + 4, alpha_evax_proc->fmask, 4); @@ -4650,11 +4644,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) if (alpha_evax_proc->handler_data) { - /* Add dummy fix to make add_to_link_pool work. */ p = frag_more (8); - fixp = fix_new (frag_now, p - frag_now->fr_literal, 8, 0, 0, 0, 0); - fixp->fx_done = 1; - seginfo->literal_pool_size += 8; md_number_to_chars (p, alpha_evax_proc->handler_data, 8); } } @@ -4666,7 +4656,6 @@ s_alpha_name (int ignore ATTRIBUTE_UNUSED) { char *p; expressionS exp; - segment_info_type *seginfo = seg_info (alpha_link_section); if (now_seg != alpha_link_section) { @@ -4691,7 +4680,6 @@ s_alpha_name (int ignore ATTRIBUTE_UNUSED) frag_align (3, 0, 0); p = frag_more (8); - seginfo->literal_pool_size += 8; fix_new_exp (frag_now, p - frag_now->fr_literal, 8, &exp, 0, BFD_RELOC_64); } @@ -4718,35 +4706,30 @@ s_alpha_linkage (int ignore ATTRIBUTE_UNUSED) else { struct alpha_linkage_fixups *linkage_fixup; - + p = frag_more (LKP_S_K_SIZE); memset (p, 0, LKP_S_K_SIZE); fixp = fix_new_exp - (frag_now, p - frag_now->fr_literal, LKP_S_K_SIZE, &exp, 0,\ + (frag_now, p - frag_now->fr_literal, LKP_S_K_SIZE, &exp, 0, BFD_RELOC_ALPHA_LINKAGE); + if (alpha_insn_label == NULL) + alpha_insn_label = symbol_new + (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now); + + /* Create a linkage element. */ linkage_fixup = (struct alpha_linkage_fixups *) xmalloc (sizeof (struct alpha_linkage_fixups)); - linkage_fixup->fixp = fixp; - linkage_fixup->next = 0; - - if (alpha_insn_label == 0) - alpha_insn_label = symbol_new - (FAKE_LABEL_NAME, now_seg, (valueT) frag_now_fix (), frag_now); + linkage_fixup->next = NULL; linkage_fixup->label = alpha_insn_label; - if (alpha_linkage_fixup_root == 0) - { - alpha_linkage_fixup_root = alpha_linkage_fixup_tail = linkage_fixup; - alpha_linkage_fixup_tail->next = 0; - } + /* Append it to the list. */ + if (alpha_linkage_fixup_root == NULL) + alpha_linkage_fixup_root = linkage_fixup; else - { - alpha_linkage_fixup_tail->next = linkage_fixup; - alpha_linkage_fixup_tail = linkage_fixup; - alpha_linkage_fixup_tail->next = 0; - } + alpha_linkage_fixup_tail->next = linkage_fixup; + alpha_linkage_fixup_tail = linkage_fixup; } demand_empty_rest_of_line (); } @@ -4780,7 +4763,6 @@ s_alpha_code_address (int ignore ATTRIBUTE_UNUSED) static void s_alpha_fp_save (int ignore ATTRIBUTE_UNUSED) { - alpha_evax_proc->fp_save = tc_get_register (1); demand_empty_rest_of_line (); @@ -4825,12 +4807,13 @@ s_alpha_fmask (int ignore ATTRIBUTE_UNUSED) static void s_alpha_end (int ignore ATTRIBUTE_UNUSED) { + char *name; char c; - c = get_symbol_end (); - *input_line_pointer = c; + c = get_symbol_name (&name); + (void) restore_line_pointer (c); demand_empty_rest_of_line (); - alpha_evax_proc = 0; + alpha_evax_proc = NULL; } static void @@ -4959,12 +4942,11 @@ s_alpha_proc (int is_static ATTRIBUTE_UNUSED) /* Takes ".proc name,nargs". */ SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; symbolP = symbol_find_or_make (name); *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { *p = 0; @@ -4994,9 +4976,8 @@ s_alpha_set (int x ATTRIBUTE_UNUSED) int yesno = 1; SKIP_WHITESPACE (); - name = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&name); s = name; if (s[0] == 'n' && s[1] == 'o') { @@ -5016,7 +4997,7 @@ s_alpha_set (int x ATTRIBUTE_UNUSED) else as_warn (_("Tried to .set unrecognized mode `%s'"), name); - *input_line_pointer = ch; + (void) restore_line_pointer (ch); demand_empty_rest_of_line (); } @@ -5081,12 +5062,13 @@ s_alpha_align (int ignore ATTRIBUTE_UNUSED) if (align != 0) { alpha_auto_align_on = 1; - alpha_align (align, pfill, alpha_insn_label, 1); + alpha_align (align, pfill, NULL, 1); } else { alpha_auto_align_on = 0; } + alpha_insn_label = NULL; demand_empty_rest_of_line (); } @@ -5150,8 +5132,8 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED) const struct cpu_type *p; SKIP_WHITESPACE (); - name = input_line_pointer; - ch = get_symbol_end (); + + ch = get_symbol_name (&name); for (p = cpu_types; p->name; ++p) if (strcmp (name, p->name) == 0) @@ -5162,7 +5144,7 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED) as_warn (_("Unknown CPU identifier `%s'"), name); found: - *input_line_pointer = ch; + (void) restore_line_pointer (ch); demand_empty_rest_of_line (); } @@ -5325,7 +5307,7 @@ maybe_set_gp (asection *sec) if (!sec) return; - vma = bfd_get_section_vma (foo, sec); + vma = bfd_get_section_vma (sec->owner, sec); if (vma && vma < alpha_gp_value) alpha_gp_value = vma; } @@ -5359,12 +5341,12 @@ select_gp_value (void) /* Map 's' to SHF_ALPHA_GPREL. */ bfd_vma -alpha_elf_section_letter (int letter, char **ptr_msg) +alpha_elf_section_letter (int letter, const char **ptr_msg) { if (letter == 's') return SHF_ALPHA_GPREL; - *ptr_msg = _("Bad .section directive: want a,s,w,x,M,S,G,T in string"); + *ptr_msg = _("bad .section directive: want a,s,w,x,M,S,G,T in string"); return -1; } @@ -5385,8 +5367,8 @@ alpha_elf_section_flags (flagword flags, bfd_vma attr, int type ATTRIBUTE_UNUSED void alpha_handle_align (fragS *fragp) { - static char const unop[4] = { 0x00, 0x00, 0xfe, 0x2f }; - static char const nopunop[8] = + static unsigned char const unop[4] = { 0x00, 0x00, 0xfe, 0x2f }; + static unsigned char const nopunop[8] = { 0x1f, 0x04, 0xff, 0x47, 0x00, 0x00, 0xfe, 0x2f @@ -5533,7 +5515,6 @@ md_begin (void) #ifdef OBJ_EVAX create_literal_section (".link", &alpha_link_section, &alpha_link_symbol); - alpha_evax_proc_hash = hash_new (); #endif #ifdef OBJ_ELF @@ -5599,10 +5580,10 @@ md_section_align (segT seg, valueT size) of LITTLENUMS emitted is stored in *SIZEP. An error message is returned, or NULL on OK. */ -char * +const char * md_atof (int type, char *litP, int *sizeP) { - extern char *vax_md_atof (int, char *, int *); + extern const char *vax_md_atof (int, char *, int *); switch (type) { @@ -5622,7 +5603,7 @@ md_atof (int type, char *litP, int *sizeP) /* Take care of the target-specific command-line options. */ int -md_parse_option (int c, char *arg) +md_parse_option (int c, const char *arg) { switch (c) { @@ -6269,26 +6250,14 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, gas_assert (!fixp->fx_pcrel == !reloc->howto->pc_relative); + reloc->addend = fixp->fx_offset; + #ifdef OBJ_ECOFF + /* Fake out bfd_perform_relocation. sigh. */ + /* ??? Better would be to use the special_function hook. */ if (fixp->fx_r_type == BFD_RELOC_ALPHA_LITERAL) - /* Fake out bfd_perform_relocation. sigh. */ reloc->addend = -alpha_gp_value; - else #endif - { - reloc->addend = fixp->fx_offset; -#ifdef OBJ_ELF - /* Ohhh, this is ugly. The problem is that if this is a local global - symbol, the relocation will entirely be performed at link time, not - at assembly time. bfd_perform_reloc doesn't know about this sort - of thing, and as a result we need to fake it out here. */ - if ((S_IS_EXTERNAL (fixp->fx_addsy) || S_IS_WEAK (fixp->fx_addsy) - || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_MERGE) - || (S_GET_SEGMENT (fixp->fx_addsy)->flags & SEC_THREAD_LOCAL)) - && !S_IS_COMMON (fixp->fx_addsy)) - reloc->addend -= symbol_get_bfdsym (fixp->fx_addsy)->value; -#endif - } #ifdef OBJ_EVAX switch (fixp->fx_r_type) @@ -6314,11 +6283,15 @@ tc_gen_reloc (asection *sec ATTRIBUTE_UNUSED, if (pname_len > 4 && strcmp (pname + pname_len - 4, "..en") == 0) { symbolS *sym; - char *my_pname = xstrdup (pname); + char *my_pname = (char *) xmalloc (pname_len - 4 + 1); + + memcpy (my_pname, pname, pname_len - 4); my_pname [pname_len - 4] = 0; sym = symbol_find (my_pname); + free (my_pname); if (sym == NULL) abort (); + while (symbol_equated_reloc_p (sym)) { symbolS *n = symbol_get_value_expression (sym)->X_add_symbol; @@ -6364,8 +6337,8 @@ tc_get_register (int frame ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); if (*input_line_pointer == '$') { - char *s = input_line_pointer; - char c = get_symbol_end (); + char *s; + char c = get_symbol_name (&s); symbolS *sym = md_undefined_symbol (s); *strchr (s, '\0') = c;