diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 04785a814e8..8bac21f2f64 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -26,6 +26,7 @@ #include "elf/external.h" #include "elf/internal.h" #include "bfdlink.h" +#include "str-util.h" #ifdef __cplusplus extern "C" { @@ -3095,7 +3096,7 @@ static inline bfd_boolean bfd_section_is_ctf (const asection *sec) { const char *name = bfd_section_name (sec); - return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.'); + return startswith (name, ".ctf") && (name[4] == 0 || name[4] == '.'); } #ifdef __cplusplus diff --git a/bfd/elf.c b/bfd/elf.c index 3f9927072ef..e7b8cf174a9 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -1084,19 +1084,19 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, not any sort of flag. Their SEC_ALLOC bits are cleared. */ if (name [0] == '.') { - if (strncmp (name, ".debug", 6) == 0 - || strncmp (name, ".gnu.debuglto_.debug_", 21) == 0 - || strncmp (name, ".gnu.linkonce.wi.", 17) == 0 - || strncmp (name, ".zdebug", 7) == 0) + if (startswith (name, ".debug") + || startswith (name, ".gnu.debuglto_.debug_") + || startswith (name, ".gnu.linkonce.wi.") + || startswith (name, ".zdebug")) flags |= SEC_DEBUGGING | SEC_ELF_OCTETS; - else if (strncmp (name, GNU_BUILD_ATTRS_SECTION_NAME, 21) == 0 - || strncmp (name, ".note.gnu", 9) == 0) + else if (startswith (name, GNU_BUILD_ATTRS_SECTION_NAME) + || startswith (name, ".note.gnu")) { flags |= SEC_ELF_OCTETS; opb = 1; } - else if (strncmp (name, ".line", 5) == 0 - || strncmp (name, ".stab", 5) == 0 + else if (startswith (name, ".line") + || startswith (name, ".stab") || strcmp (name, ".gdb_index") == 0) flags |= SEC_DEBUGGING; } @@ -1277,8 +1277,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd, /* GCC uses .gnu.lto_.lto. as a LTO bytecode information section. */ - const char *lto_section_name = ".gnu.lto_.lto."; - if (strncmp (name, lto_section_name, strlen (lto_section_name)) == 0) + if (startswith (name, ".gnu.lto_.lto.")) { struct lto_section lsection; if (bfd_get_section_contents (abfd, newsect, &lsection, 0, @@ -3677,7 +3676,7 @@ elf_get_reloc_section (asection *reloc_sec) /* We look up the section the relocs apply to by name. */ name = reloc_sec->name; - if (strncmp (name, ".rel", 4) != 0) + if (!startswith (name, ".rel")) return NULL; name += 4; if (type == SHT_RELA && *name++ != 'a') diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c index df12fd33a10..88f388dfe9b 100644 --- a/bfd/elf32-arc.c +++ b/bfd/elf32-arc.c @@ -2759,7 +2759,7 @@ elf_arc_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, { /* Strip this section if we don't need it. */ } - else if (strncmp (s->name, ".rela", 5) == 0) + else if (startswith (s->name, ".rela")) { if (s->size != 0 && s != htab->srelplt) relocs_exist = TRUE; diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c index 95e0c17bc5c..20bba31c733 100644 --- a/bfd/elf32-m32r.c +++ b/bfd/elf32-m32r.c @@ -3615,8 +3615,8 @@ m32r_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; diff --git a/bfd/elf32-microblaze.c b/bfd/elf32-microblaze.c index 1571bbb118a..ef059f1e668 100644 --- a/bfd/elf32-microblaze.c +++ b/bfd/elf32-microblaze.c @@ -3050,7 +3050,7 @@ microblaze_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, of the dynobj section names depend upon the input files. */ name = bfd_section_name (s); - if (strncmp (name, ".rela", 5) == 0) + if (startswith (name, ".rela")) { if (s->size == 0) { diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c index 01d0702255a..d1ebfccd299 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; diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c index 82a5b4ac8e2..ac460c2eb09 100644 --- a/bfd/elf32-or1k.c +++ b/bfd/elf32-or1k.c @@ -2110,7 +2110,7 @@ or1k_elf_check_relocs (bfd *abfd, if (name == NULL) return FALSE; - if (strncmp (name, ".rela", 5) != 0 + if (!startswith (name, ".rela") || strcmp (bfd_section_name (sec), name + 5) != 0) { _bfd_error_handler diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index fe8b6fdb7d1..77a3187e0a2 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1338,10 +1338,10 @@ ppc_elf_section_from_shdr (bfd *abfd, if (hdr->sh_type == SHT_ORDERED) flags |= SEC_SORT_ENTRIES; - if (strncmp (name, ".PPC.EMB", 8) == 0) + if (startswith (name, ".PPC.EMB")) name += 8; - if (strncmp (name, ".sbss", 5) == 0 - || strncmp (name, ".sdata", 6) == 0) + if (startswith (name, ".sbss") + || startswith (name, ".sdata")) flags |= SEC_SMALL_DATA; return (flags == 0 diff --git a/bfd/elf32-rx.c b/bfd/elf32-rx.c index e2f4c9fb34a..b5ad93c0f93 100644 --- a/bfd/elf32-rx.c +++ b/bfd/elf32-rx.c @@ -557,7 +557,7 @@ rx_elf_relocate_section name = h->root.root.string; } - if (strncmp (name, "$tableentry$default$", 20) == 0) + if (startswith (name, "$tableentry$default$")) { bfd_vma entry_vma; int idx; @@ -3759,7 +3759,7 @@ rx_table_find (struct bfd_hash_entry *vent, void *vinfo) sec = ent->u.def.section; abfd = sec->owner; - if (strncmp (name, "$tablestart$", 12)) + if (!startswith (name, "$tablestart$")) return TRUE; sec->flags |= SEC_KEEP; @@ -3895,7 +3895,7 @@ rx_table_map (struct bfd_hash_entry *vent, void *vinfo) name = ent->root.string; - if (strncmp (name, "$tablestart$", 12)) + if (!startswith (name, "$tablestart$")) return TRUE; tname = name + 12; diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index c31ab98b310..ed83e9c4bb7 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; diff --git a/bfd/elf32-tilepro.c b/bfd/elf32-tilepro.c index 255235a4eb5..89295ba03e7 100644 --- a/bfd/elf32-tilepro.c +++ b/bfd/elf32-tilepro.c @@ -2332,7 +2332,7 @@ tilepro_elf_size_dynamic_sections (bfd *output_bfd, /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (s->name, ".rela", 5) == 0) + else if (startswith (s->name, ".rela")) { if (s->size != 0) { diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index abc244c04cb..838ee8949e8 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -11260,7 +11260,7 @@ xtensa_property_section_name (asection *sec, const char *base_name, suffix = 0; prop_sec_name = xtensa_add_names (base_name, suffix); } - else if (strncmp (sec->name, ".gnu.linkonce.", linkonce_len) == 0) + else if (startswith (sec->name, ".gnu.linkonce.")) { char *linkonce_kind = 0; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 741f510a28d..c1ef86e0fab 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -2042,8 +2042,8 @@ ppc64_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; @@ -15873,7 +15873,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (*name == '.') ++name; - if (strncmp (name, "__libc_start_main", 17) == 0 + if (startswith (name, "__libc_start_main") && (name[17] == 0 || name[17] == '@')) { /* Allow crt1 branch to go via a toc adjusting diff --git a/bfd/elflink.c b/bfd/elflink.c index c5db406f2b4..e64933e3cb6 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 == ':') \ @@ -11195,10 +11195,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] == '.')) diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index 364d67b6749..ab2b5685050 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -1515,7 +1515,7 @@ riscv_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info) /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (s->name, ".rela", 5) == 0) + else if (startswith (s->name, ".rela")) { if (s->size != 0) { diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c index 966e142be4c..40dc6944bf3 100644 --- a/bfd/elfxx-riscv.c +++ b/bfd/elfxx-riscv.c @@ -1802,12 +1802,12 @@ riscv_parse_subset (riscv_parse_subset_t *rps, } p = arch; - if (strncmp (p, "rv32", 4) == 0) + if (startswith (p, "rv32")) { *rps->xlen = 32; p += 4; } - else if (strncmp (p, "rv64", 4) == 0) + else if (startswith (p, "rv64")) { *rps->xlen = 64; p += 4; diff --git a/bfd/elfxx-tilegx.c b/bfd/elfxx-tilegx.c index 3544a3064f8..f9d8eb69f90 100644 --- a/bfd/elfxx-tilegx.c +++ b/bfd/elfxx-tilegx.c @@ -2578,7 +2578,7 @@ tilegx_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Strip this section if we don't need it; see the comment below. */ } - else if (strncmp (s->name, ".rela", 5) == 0) + else if (startswith (s->name, ".rela")) { if (s->size != 0) { diff --git a/bfd/opncls.c b/bfd/opncls.c index 30ef9fd537d..b912030512b 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -1904,7 +1904,7 @@ get_build_id (bfd *abfd) if (inote.descsz <= 0 || inote.type != NT_GNU_BUILD_ID || inote.namesz != 4 /* sizeof "GNU" */ - || strncmp (inote.namedata, "GNU", 4) != 0 + || !startswith (inote.namedata, "GNU") || inote.descsz > 0x7ffffffe || size < (12 + BFD_ALIGN (inote.namesz, 4) + inote.descsz)) { diff --git a/binutils/dllwrap.c b/binutils/dllwrap.c index bd65b98fee0..bc7104de004 100644 --- a/binutils/dllwrap.c +++ b/binutils/dllwrap.c @@ -840,11 +840,11 @@ Creating one, but that may not be what you want")); else which_target = UNKNOWN_TARGET; - if (! strncmp (target, "arm", 3)) + if (startswith (target, "arm")) which_cpu = ARM_CPU; - else if (!strncmp (target, "x86_64", 6) - || !strncmp (target, "athlon64", 8) - || !strncmp (target, "amd64", 5)) + else if (startswith (target, "x86_64") + || startswith (target, "athlon64") + || startswith (target, "amd64")) which_cpu = X64_CPU; else if (target[0] == 'i' && (target[1] >= '3' && target[1] <= '6') && target[2] == '8' && target[3] == '6') diff --git a/binutils/objcopy.c b/binutils/objcopy.c index f5e48e80d08..168d526f462 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1284,7 +1284,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. */ @@ -4260,7 +4260,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') @@ -5874,15 +5874,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; @@ -5891,23 +5891,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; diff --git a/binutils/objdump.c b/binutils/objdump.c index cb5ce5b057c..b541f5e0d9a 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -821,7 +821,7 @@ slurp_dynamic_symtab (bfd *abfd) static bfd_boolean is_significant_symbol_name (const char * name) { - return strncmp (name, ".plt", 4) == 0 || strcmp (name, ".got") == 0; + return startswith (name, ".plt") || startswith (name, ".got"); } /* Filter out (in place) symbols that are useless for disassembly.