aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.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/elflink.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/elflink.c')
-rw-r--r--bfd/elflink.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ce1407f..f8d6313 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -8719,7 +8719,7 @@ resolve_section (const char *name,
if (strncmp (curr->name, name, len) == 0)
{
- if (strncmp (".end", name + len, 4) == 0)
+ if (startswith (name + len, ".end"))
{
*result = (curr->vma
+ curr->size / bfd_octets_per_byte (abfd, curr));
@@ -8832,7 +8832,7 @@ eval_symbol (bfd_vma *result,
/* All that remains are operators. */
#define UNARY_OP(op) \
- if (strncmp (sym, #op, strlen (#op)) == 0) \
+ if (startswith (sym, #op)) \
{ \
sym += strlen (#op); \
if (*sym == ':') \
@@ -8849,7 +8849,7 @@ eval_symbol (bfd_vma *result,
}
#define BINARY_OP_HEAD(op) \
- if (strncmp (sym, #op, strlen (#op)) == 0) \
+ if (startswith (sym, #op)) \
{ \
sym += strlen (#op); \
if (*sym == ':') \
@@ -11196,10 +11196,10 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
/* We need to reverse-copy input .ctors/.dtors sections if
they are placed in .init_array/.finit_array for output. */
if (o->size > address_size
- && ((strncmp (o->name, ".ctors", 6) == 0
+ && ((startswith (o->name, ".ctors")
&& strcmp (o->output_section->name,
".init_array") == 0)
- || (strncmp (o->name, ".dtors", 6) == 0
+ || (startswith (o->name, ".dtors")
&& strcmp (o->output_section->name,
".fini_array") == 0))
&& (o->name[6] == 0 || o->name[6] == '.'))