X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fsymbols.c;h=082b2c715fcced2bab529ac18d72d0058ef82af4;hb=69c9e028b6c29f98b6f71faf52242aaaeb03a659;hp=642f6d771b40ca45432a189da32ea5f8d907f32e;hpb=325801bda4678d100721414300eb1170bfbc2e24;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/symbols.c b/gas/symbols.c index 642f6d771b..082b2c715f 100644 --- a/gas/symbols.c +++ b/gas/symbols.c @@ -1262,7 +1262,10 @@ resolve_symbol_value (symbolS *symp) resolved = symbol_resolved_p (add_symbol); if (S_IS_WEAKREFR (symp)) - goto exit_dont_set_value; + { + symp->sy_flags.sy_resolving = 0; + goto exit_dont_set_value; + } break; case O_uminus: @@ -1636,7 +1639,7 @@ define_dollar_label (long label) { dollar_labels = XNEWVEC (long, DOLLAR_LABEL_BUMP_BY); dollar_label_instances = XNEWVEC (long, DOLLAR_LABEL_BUMP_BY); - dollar_label_defines = (char *) xmalloc (DOLLAR_LABEL_BUMP_BY); + dollar_label_defines = XNEWVEC (char, DOLLAR_LABEL_BUMP_BY); dollar_label_max = DOLLAR_LABEL_BUMP_BY; dollar_label_count = 0; } @@ -1646,7 +1649,8 @@ define_dollar_label (long label) dollar_labels = XRESIZEVEC (long, dollar_labels, dollar_label_max); dollar_label_instances = XRESIZEVEC (long, dollar_label_instances, dollar_label_max); - dollar_label_defines = (char *) xrealloc (dollar_label_defines, dollar_label_max); + dollar_label_defines = XRESIZEVEC (char, dollar_label_defines, + dollar_label_max); } /* if we needed to grow */ dollar_labels[dollar_label_count] = label; @@ -3072,11 +3076,11 @@ symbol_relc_make_sym (symbolS * sym) sname_len = strlen (sname); typetag = symbol_section_p (sym) ? 'S' : 's'; - terminal = xmalloc (1 /* S or s */ - + 8 /* sname_len in decimal */ - + 1 /* _ spacer */ - + sname_len /* name itself */ - + 1 /* \0 */ ); + terminal = XNEWVEC (char, (1 /* S or s */ + + 8 /* sname_len in decimal */ + + 1 /* _ spacer */ + + sname_len /* name itself */ + + 1 /* \0 */ )); sprintf (terminal, "%c%d:%s", typetag, sname_len, sname); return terminal; @@ -3217,25 +3221,16 @@ symbol_relc_make_expr (expressionS * exp) if (opstr == NULL) concat_string = NULL; + else if (arity == 0) + concat_string = xstrdup (opstr); + else if (arity == 1) + concat_string = concat (opstr, ":", operands[0], (char *) NULL); + else if (arity == 2) + concat_string = concat (opstr, ":", operands[0], ":", operands[1], + (char *) NULL); else - { - /* Allocate new string; include inter-operand padding gaps etc. */ - concat_string = xmalloc (strlen (opstr) - + 1 - + (arity >= 1 ? (strlen (operands[0]) + 1 ) : 0) - + (arity >= 2 ? (strlen (operands[1]) + 1 ) : 0) - + (arity >= 3 ? (strlen (operands[2]) + 0 ) : 0) - + 1); - gas_assert (concat_string != NULL); - - /* Format the thing. */ - sprintf (concat_string, - (arity == 0 ? "%s" : - arity == 1 ? "%s:%s" : - arity == 2 ? "%s:%s:%s" : - /* arity == 3 */ "%s:%s:%s:%s"), - opstr, operands[0], operands[1], operands[2]); - } + concat_string = concat (opstr, ":", operands[0], ":", operands[1], ":", + operands[2], (char *) NULL); /* Free operand strings (not opstr). */ if (arity >= 1) xfree (operands[0]);