diff options
author | Martin Liska <mliska@suse.cz> | 2021-03-18 15:16:54 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2021-04-01 14:59:04 +0200 |
commit | 3f3328b816ee3486ac0621cfd6d808faa2c0a689 (patch) | |
tree | 5323d7ff39635e28d62c26a7e13e705ccfafe757 /bfd/elf32-nds32.c | |
parent | 24d127aa9f26445709dbd53e14e2ab636a449888 (diff) | |
download | gdb-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-nds32.c')
-rw-r--r-- | bfd/elf32-nds32.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 31a3ca0..5eb0295 100644 --- a/bfd/elf32-nds32.c +++ b/bfd/elf32-nds32.c @@ -4439,7 +4439,7 @@ nds32_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { got_size += s->size; } - else if (strncmp (bfd_section_name (s), ".rela", 5) == 0) + else if (startswith (bfd_section_name (s), ".rela")) { if (s->size != 0 && s != elf_hash_table (info)->srelplt) relocs = true; @@ -5426,7 +5426,7 @@ nds32_elf_relocate_section (bfd * output_bfd ATTRIBUTE_UNUSED, if (name == NULL) return false; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + BFD_ASSERT (startswith (name, ".rela") && strcmp (bfd_section_name (input_section), name + 5) == 0); @@ -6870,8 +6870,7 @@ static unsigned int nds32_elf_action_discarded (asection *sec) { - if (strncmp - (".gcc_except_table", sec->name, sizeof (".gcc_except_table") - 1) == 0) + if (startswith (sec->name, ".gcc_except_table")) return 0; return _bfd_elf_default_action_discarded (sec); @@ -7239,7 +7238,7 @@ nds32_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, if (name == NULL) return false; - BFD_ASSERT (strncmp (name, ".rela", 5) == 0 + BFD_ASSERT (startswith (name, ".rela") && strcmp (bfd_section_name (sec), name + 5) == 0); @@ -12450,8 +12449,8 @@ nds32_elf_section_flags (const Elf_Internal_Shdr *hdr) { const char *name = hdr->bfd_section->name; - if (strncmp (name, ".sbss", 5) == 0 - || strncmp (name, ".sdata", 6) == 0) + if (startswith (name, ".sbss") + || startswith (name, ".sdata")) hdr->bfd_section->flags |= SEC_SMALL_DATA; return true; |