aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-spu.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-03-18 15:16:54 +0100
committerMartin Liska <mliska@suse.cz>2021-04-01 14:59:04 +0200
commit3f3328b816ee3486ac0621cfd6d808faa2c0a689 (patch)
tree5323d7ff39635e28d62c26a7e13e705ccfafe757 /bfd/elf32-spu.c
parent24d127aa9f26445709dbd53e14e2ab636a449888 (diff)
downloadgdb-3f3328b816ee3486ac0621cfd6d808faa2c0a689.zip
gdb-3f3328b816ee3486ac0621cfd6d808faa2c0a689.tar.gz
gdb-3f3328b816ee3486ac0621cfd6d808faa2c0a689.tar.bz2
Use startswith more for strncmp function calls.
bfd/ChangeLog: * elf-bfd.h (bfd_section_is_ctf): Use startswith function. * elf.c (_bfd_elf_make_section_from_shdr): Likewise. (elf_get_reloc_section): Likewise. * elf32-arc.c (elf_arc_size_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_section_flags): Likewise. * elf32-microblaze.c (microblaze_elf_size_dynamic_sections): Likewise. * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise. (nds32_elf_relocate_section): Likewise. (nds32_elf_action_discarded): Likewise. (nds32_elf_check_relocs): Likewise. (nds32_elf_section_flags): Likewise. * elf32-or1k.c (or1k_elf_check_relocs): Likewise. * elf32-ppc.c (ppc_elf_section_from_shdr): Likewise. * elf32-rx.c (rx_table_find): Likewise. (rx_table_map): Likewise. * elf32-spu.c (spu_elf_backend_symbol_processing): Likewise. (spu_elf_find_overlays): Likewise. (needs_ovl_stub): Likewise. (allocate_spuear_stubs): Likewise. (build_spuear_stubs): Likewise. (mark_overlay_section): Likewise. (spu_elf_auto_overlay): Likewise. (spu_elf_output_symbol_hook): Likewise. * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise. * elf32-xtensa.c (xtensa_property_section_name): Likewise. * elf64-ppc.c (ppc64_elf_section_flags): Likewise. (ppc64_elf_relocate_section): Likewise. * elflink.c (resolve_section): Likewise. (UNARY_OP): Likewise. (BINARY_OP_HEAD): Likewise. (elf_link_input_bfd): Likewise. * elfnn-riscv.c (riscv_elf_size_dynamic_sections): Likewise. * elfxx-riscv.c (riscv_parse_subset): Likewise. * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise. * opncls.c (get_build_id): Likewise. binutils/ChangeLog: * dllwrap.c: Use startswith function. * objcopy.c (is_dwo_section): Likewise. (handle_remove_section_option): Likewise. (copy_main): Likewise. * objdump.c (is_significant_symbol_name): Likewise.
Diffstat (limited to 'bfd/elf32-spu.c')
-rw-r--r--bfd/elf32-spu.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c
index 5bffc1d..c3ce2c1 100644
--- a/bfd/elf32-spu.c
+++ b/bfd/elf32-spu.c
@@ -307,7 +307,7 @@ spu_elf_backend_symbol_processing (bfd *abfd ATTRIBUTE_UNUSED, asymbol *sym)
{
if (sym->name != NULL
&& sym->section != bfd_abs_section_ptr
- && strncmp (sym->name, "_EAR_", 5) == 0)
+ && startswith (sym->name, "_EAR_"))
sym->flags |= BSF_KEEP;
}
@@ -725,7 +725,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
an overlay, in the sense that it might be loaded in
by the overlay manager, but rather the initial
section contents for the overlay buffer. */
- if (strncmp (s->name, ".ovl.init", 9) != 0)
+ if (!startswith (s->name, ".ovl.init"))
{
num_buf = ((s->vma - vma_start) >> htab->line_size_log2) + 1;
set_id = (num_buf == prev_buf)? set_id + 1 : 0;
@@ -785,7 +785,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
if (spu_elf_section_data (s0)->u.o.ovl_index == 0)
{
++num_buf;
- if (strncmp (s0->name, ".ovl.init", 9) != 0)
+ if (!startswith (s0->name, ".ovl.init"))
{
alloc_sec[ovl_index] = s0;
spu_elf_section_data (s0)->u.o.ovl_index = ++ovl_index;
@@ -794,7 +794,7 @@ spu_elf_find_overlays (struct bfd_link_info *info)
else
ovl_end = s->vma + s->size;
}
- if (strncmp (s->name, ".ovl.init", 9) != 0)
+ if (!startswith (s->name, ".ovl.init"))
{
alloc_sec[ovl_index] = s;
spu_elf_section_data (s)->u.o.ovl_index = ++ovl_index;
@@ -970,7 +970,7 @@ needs_ovl_stub (struct elf_link_hash_entry *h,
/* setjmp always goes via an overlay stub, because then the return
and hence the longjmp goes via __ovly_return. That magically
makes setjmp/longjmp between overlays work. */
- if (strncmp (h->root.root.string, "setjmp", 6) == 0
+ if (startswith (h->root.root.string, "setjmp")
&& (h->root.root.string[6] == '\0' || h->root.root.string[6] == '@'))
ret = call_ovl_stub;
}
@@ -1496,7 +1496,7 @@ allocate_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->def_regular
- && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0
+ && startswith (h->root.root.string, "_SPUEAR_")
&& (sym_sec = h->root.u.def.section) != NULL
&& sym_sec->output_section != bfd_abs_section_ptr
&& spu_elf_section_data (sym_sec->output_section) != NULL
@@ -1521,7 +1521,7 @@ build_spuear_stubs (struct elf_link_hash_entry *h, void *inf)
if ((h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->def_regular
- && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0
+ && startswith (h->root.root.string, "_SPUEAR_")
&& (sym_sec = h->root.u.def.section) != NULL
&& sym_sec->output_section != bfd_abs_section_ptr
&& spu_elf_section_data (sym_sec->output_section) != NULL
@@ -3455,7 +3455,7 @@ mark_overlay_section (struct function_info *fun,
if (!fun->sec->linker_mark
&& (htab->params->ovly_flavour != ovly_soft_icache
|| htab->params->non_ia_text
- || strncmp (fun->sec->name, ".text.ia.", 9) == 0
+ || startswith (fun->sec->name, ".text.ia.")
|| strcmp (fun->sec->name, ".init") == 0
|| strcmp (fun->sec->name, ".fini") == 0))
{
@@ -3483,7 +3483,7 @@ mark_overlay_section (struct function_info *fun,
return false;
memcpy (name, ".rodata", sizeof (".rodata"));
}
- else if (strncmp (fun->sec->name, ".text.", 6) == 0)
+ else if (startswith (fun->sec->name, ".text."))
{
size_t len = strlen (fun->sec->name);
name = bfd_malloc (len + 3);
@@ -3492,7 +3492,7 @@ mark_overlay_section (struct function_info *fun,
memcpy (name, ".rodata", sizeof (".rodata"));
memcpy (name + 7, fun->sec->name + 5, len - 4);
}
- else if (strncmp (fun->sec->name, ".gnu.linkonce.t.", 16) == 0)
+ else if (startswith (fun->sec->name, ".gnu.linkonce.t."))
{
size_t len = strlen (fun->sec->name) + 1;
name = bfd_malloc (len);
@@ -3583,7 +3583,7 @@ mark_overlay_section (struct function_info *fun,
a stack! Also, don't mark .ovl.init as an overlay. */
if (fun->lo + fun->sec->output_offset + fun->sec->output_section->vma
== info->output_bfd->start_address
- || strncmp (fun->sec->output_section->name, ".ovl.init", 9) == 0)
+ || startswith (fun->sec->output_section->name, ".ovl.init"))
{
fun->sec->linker_mark = 0;
if (fun->rodata != NULL)
@@ -4317,7 +4317,7 @@ spu_elf_auto_overlay (struct bfd_link_info *info)
}
else if ((sec->flags & (SEC_ALLOC | SEC_LOAD)) == (SEC_ALLOC | SEC_LOAD)
&& sec->output_section->owner == info->output_bfd
- && strncmp (sec->output_section->name, ".ovl.init", 9) == 0)
+ && startswith (sec->output_section->name, ".ovl.init"))
fixed_size -= sec->size;
if (count != old_count)
bfd_arr[bfd_count++] = ibfd;
@@ -5156,7 +5156,7 @@ spu_elf_output_symbol_hook (struct bfd_link_info *info,
&& (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
&& h->def_regular
- && strncmp (h->root.root.string, "_SPUEAR_", 8) == 0)
+ && startswith (h->root.root.string, "_SPUEAR_"))
{
struct got_entry *g;