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 /binutils/objcopy.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 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index 092bc9e..6622adc 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1285,7 +1285,7 @@ is_dwo_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec) if (len < 5) return false; - return strncmp (name + len - 4, ".dwo", 4) == 0; + return startswith (name + len - 4, ".dwo"); } /* Return TRUE if section SEC is in the update list. */ @@ -4261,7 +4261,7 @@ static void handle_remove_section_option (const char *section_pattern) { find_section_list (section_pattern, true, SECTION_CONTEXT_REMOVE); - if (strncmp (section_pattern, ".rel", 4) == 0) + if (startswith (section_pattern, ".rel")) { section_pattern += 4; if (*section_pattern == 'a') @@ -5875,15 +5875,15 @@ copy_main (int argc, char *argv[]) /* Convert input EFI target to PEI target. */ if (input_target != NULL - && strncmp (input_target, "efi-", 4) == 0) + && startswith (input_target, "efi-")) { char *efi; efi = xstrdup (output_target + 4); - if (strncmp (efi, "bsdrv-", 6) == 0 - || strncmp (efi, "rtdrv-", 6) == 0) + if (startswith (efi, "bsdrv-") + || startswith (efi, "rtdrv-")) efi += 2; - else if (strncmp (efi, "app-", 4) != 0) + else if (!startswith (efi, "app-")) fatal (_("unknown input EFI target: %s"), input_target); input_target = efi; @@ -5892,23 +5892,23 @@ copy_main (int argc, char *argv[]) /* Convert output EFI target to PEI target. */ if (output_target != NULL - && strncmp (output_target, "efi-", 4) == 0) + && startswith (output_target, "efi-")) { char *efi; efi = xstrdup (output_target + 4); - if (strncmp (efi, "app-", 4) == 0) + if (startswith (efi, "app-")) { if (pe_subsystem == -1) pe_subsystem = IMAGE_SUBSYSTEM_EFI_APPLICATION; } - else if (strncmp (efi, "bsdrv-", 6) == 0) + else if (startswith (efi, "bsdrv-")) { if (pe_subsystem == -1) pe_subsystem = IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER; efi += 2; } - else if (strncmp (efi, "rtdrv-", 6) == 0) + else if (startswith (efi, "rtdrv-")) { if (pe_subsystem == -1) pe_subsystem = IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER; |