aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-hppa.c
diff options
context:
space:
mode:
authorTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-03-28 05:49:15 -0400
committerTrevor Saunders <tbsaunde+binutils@tbsaunde.org>2016-05-13 00:35:51 -0400
commit29a2809e4210d5055291e95de861b493c55b9c0a (patch)
tree7b64ff6421a379f7ad2568e8648f6be1ffa99a12 /gas/config/tc-hppa.c
parent59441ccdbd5d74575ae0149c6cf7b4663b56ff6d (diff)
downloadgdb-29a2809e4210d5055291e95de861b493c55b9c0a.zip
gdb-29a2809e4210d5055291e95de861b493c55b9c0a.tar.gz
gdb-29a2809e4210d5055291e95de861b493c55b9c0a.tar.bz2
use xstrdup, xmemdup0 and concat more
gas/ChangeLog: 2016-05-13 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> * config/obj-coff.c (obj_coff_def): Simplify string copying. (weak_name2altname): Likewise. (weak_uniquify): Likewise. (obj_coff_section): Likewise. (obj_coff_init_stab_section): Likewise. * config/obj-elf.c (obj_elf_section_name): Likewise. (obj_elf_init_stab_section): Likewise. * config/obj-evax.c (evax_shorten_name): Likewise. * config/obj-macho.c (obj_mach_o_make_or_get_sect): Likewise. * config/tc-aarch64.c (create_register_alias): Likewise. * config/tc-alpha.c (load_expression): Likewise. (s_alpha_file): Likewise. (s_alpha_section_name): Likewise. (tc_gen_reloc): Likewise. * config/tc-arc.c (md_assemble): Likewise. * config/tc-arm.c (create_neon_reg_alias): Likewise. (start_unwind_section): Likewise. * config/tc-hppa.c (pa_build_unwind_subspace): Likewise. (hppa_elf_mark_end_of_function): Likewise. * config/tc-nios2.c (nios2_modify_arg): Likewise. (nios2_negate_arg): Likewise. * config/tc-rx.c (rx_section): Likewise. * config/tc-sh64.c (sh64_consume_datalabel): Likewise. * config/tc-tic30.c (tic30_find_parallel_insn): Likewise. * config/tc-tic54x.c (tic54x_include): Likewise. (tic54x_macro_info): Likewise. (subsym_get_arg): Likewise. (subsym_substitute): Likewise. (tic54x_start_line_hook): Likewise. * config/tc-xtensa.c (xtensa_literal_prefix): Likewise. (xg_reverse_shift_count): Likewise. * config/xtensa-relax.c (enter_opname_n): Likewise. (split_string): Likewise. * dwarf2dbg.c (get_filenum): Likewise. (process_entries): Likewise. * expr.c (operand): Likewise. * itbl-ops.c (alloc_entry): Likewise. * listing.c (listing_message): Likewise. (listing_title): Likewise. * macro.c (check_macro): Likewise. * stabs.c (s_xstab): Likewise. * symbols.c (symbol_relc_make_expr): Likewise. * write.c (compress_debug): Likewise.
Diffstat (limited to 'gas/config/tc-hppa.c')
-rw-r--r--gas/config/tc-hppa.c71
1 files changed, 29 insertions, 42 deletions
diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c
index 6bf1bba..aea78dc 100644
--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -5974,11 +5974,8 @@ pa_build_unwind_subspace (struct call_info *call_info)
/* Replace the start symbol with a local symbol that will be reduced
to a section offset. This avoids problems with weak functions with
multiple definitions, etc. */
- name = xmalloc (strlen ("L$\001start_")
- + strlen (S_GET_NAME (call_info->start_symbol))
- + 1);
- strcpy (name, "L$\001start_");
- strcat (name, S_GET_NAME (call_info->start_symbol));
+ name = concat ("L$\001start_", S_GET_NAME (call_info->start_symbol),
+ (char *) NULL);
/* If we have a .procend preceded by a .exit, then the symbol will have
already been defined. In that case, we don't want another unwind
@@ -6414,6 +6411,7 @@ hppa_elf_mark_end_of_function (void)
/* ELF does not have EXIT relocations. All we do is create a
temporary symbol marking the end of the function. */
char *name;
+ symbolS *symbolP;
if (last_call_info == NULL || last_call_info->start_symbol == NULL)
{
@@ -6422,48 +6420,37 @@ hppa_elf_mark_end_of_function (void)
return;
}
- name = xmalloc (strlen ("L$\001end_")
- + strlen (S_GET_NAME (last_call_info->start_symbol))
- + 1);
- if (name)
- {
- symbolS *symbolP;
-
- strcpy (name, "L$\001end_");
- strcat (name, S_GET_NAME (last_call_info->start_symbol));
-
- /* If we have a .exit followed by a .procend, then the
- symbol will have already been defined. */
- symbolP = symbol_find (name);
- if (symbolP)
- {
- /* The symbol has already been defined! This can
- happen if we have a .exit followed by a .procend.
-
- This is *not* an error. All we want to do is free
- the memory we just allocated for the name and continue. */
- xfree (name);
- }
- else
- {
- /* symbol value should be the offset of the
- last instruction of the function */
- symbolP = symbol_new (name, now_seg, (valueT) (frag_now_fix () - 4),
- frag_now);
+ name = concat ("L$\001end_", S_GET_NAME (last_call_info->start_symbol),
+ (char *) NULL);
- gas_assert (symbolP);
- S_CLEAR_EXTERNAL (symbolP);
- symbol_table_insert (symbolP);
- }
+ /* If we have a .exit followed by a .procend, then the
+ symbol will have already been defined. */
+ symbolP = symbol_find (name);
+ if (symbolP)
+ {
+ /* The symbol has already been defined! This can
+ happen if we have a .exit followed by a .procend.
- if (symbolP)
- last_call_info->end_symbol = symbolP;
- else
- as_bad (_("Symbol '%s' could not be created."), name);
+ This is *not* an error. All we want to do is free
+ the memory we just allocated for the name and continue. */
+ xfree (name);
+ }
+ else
+ {
+ /* symbol value should be the offset of the
+ last instruction of the function */
+ symbolP = symbol_new (name, now_seg, (valueT) (frag_now_fix () - 4),
+ frag_now);
+ gas_assert (symbolP);
+ S_CLEAR_EXTERNAL (symbolP);
+ symbol_table_insert (symbolP);
}
+
+ if (symbolP)
+ last_call_info->end_symbol = symbolP;
else
- as_bad (_("No memory for symbol name."));
+ as_bad (_("Symbol '%s' could not be created."), name);
}
#endif