Add startswith function and use it instead of CONST_STRNEQ.

bfd/ChangeLog:

	* bfd-in.h (startswith): Add startswith function.
	(CONST_STRNEQ): Remove.
	* bfd-in2.h (startswith): Regenerate with make headers.
	* archive.c (bfd_slurp_armap): Replace usage of CONST_STRNEQ with startswith.
	(_bfd_slurp_extended_name_table): Likewise.
	* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
	* bfd.c (bfd_get_sign_extend_vma): Likewise.
	(bfd_convert_section_size): Likewise.
	(bfd_convert_section_contents): Likewise.
	* coff-stgo32.c (go32exe_create_stub): Likewise.
	(go32exe_check_format): Likewise.
	* coffcode.h (styp_to_sec_flags): Likewise.
	(GNU_DEBUGALTLINK): Likewise.
	* coffgen.c (_bfd_coff_section_already_linked): Likewise.
	(coff_gc_sweep): Likewise.
	(bfd_coff_gc_sections): Likewise.
	* cofflink.c (coff_link_add_symbols): Likewise.
	(process_embedded_commands): Likewise.
	* compress.c (bfd_is_section_compressed_with_header): Likewise.
	(bfd_init_section_decompress_status): Likewise.
	* dwarf2.c (find_debug_info): Likewise.
	(place_sections): Likewise.
	* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
	* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
	* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
	(assign_section_numbers): Likewise.
	(elfcore_grok_win32pstatus): Likewise.
	* elf32-arm.c (cmse_scan): Likewise.
	(elf32_arm_gc_mark_extra_sections): Likewise.
	(elf32_arm_size_dynamic_sections): Likewise.
	(is_arm_elf_unwind_section_name): Likewise.
	* elf32-bfin.c (bfin_size_dynamic_sections): Likewise.
	* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
	* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
	* elf32-csky.c (csky_elf_size_dynamic_sections): Likewise.
	* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
	* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
	* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
	* elf32-msp430.c (msp430_elf_relax_delete_bytes): Likewise.
	* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
	* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
	* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
	* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
	* elf32-tic6x.c (is_tic6x_elf_unwind_section_name): Likewise.
	(elf32_tic6x_size_dynamic_sections): Likewise.
	* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
	* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
	(xtensa_is_insntable_section): Likewise.
	(xtensa_is_littable_section): Likewise.
	(xtensa_is_proptable_section): Likewise.
	(xtensa_property_section_name): Likewise.
	(xtensa_callback_required_dependence): Likewise.
	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
	* elf64-ia64-vms.c (is_unwind_section_name): Likewise.
	(get_reloc_section): Likewise.
	(elf64_ia64_size_dynamic_sections): Likewise.
	(elf64_ia64_object_p): Likewise.
	* elf64-mmix.c (mmix_elf_add_symbol_hook): Likewise.
	* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
	* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
	* elflink.c (elf_link_add_object_symbols): Likewise.
	(_bfd_elf_gc_mark_extra_sections): Likewise.
	(bfd_elf_parse_eh_frame_entries): Likewise.
	(_bfd_elf_section_already_linked): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
	* elfnn-ia64.c (is_unwind_section_name): Likewise.
	(elfNN_ia64_size_dynamic_sections): Likewise.
	(elfNN_ia64_object_p): Likewise.
	* elfxx-mips.c (FN_STUB_P): Likewise.
	(CALL_STUB_P): Likewise.
	(CALL_FP_STUB_P): Likewise.
	(_bfd_mips_elf_section_from_shdr): Likewise.
	(_bfd_mips_elf_fake_sections): Likewise.
	(_bfd_mips_elf_size_dynamic_sections): Likewise.
	(_bfd_mips_final_write_processing): Likewise.
	(_bfd_mips_elf_final_link): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
	* elfxx-x86.c (elf_i386_is_reloc_section): Likewise.
	(elf_x86_64_is_reloc_section): Likewise.
	* hpux-core.c (thread_section_p): Likewise.
	* libcoff.h (bfd_pei_p): Likewise.
	* linker.c (REAL): Likewise.
	(unwrap_hash_lookup): Likewise.
	(_bfd_generic_link_add_one_symbol): Likewise.
	* mmo.c (mmo_internal_write_section): Likewise.
	* osf-core.c (osf_core_core_file_p): Likewise.
	* pef.c (bfd_pef_print_symbol): Likewise.
	* pei-x86_64.c (pex64_print_all_pdata_sections): Likewise.
	* som.c (som_slurp_symbol_table): Likewise.
	(som_slurp_armap): Likewise.
	* wasm-module.c (wasm_compute_custom_section_file_position): Likewise.

binutils/ChangeLog:

	* dlltool.c (scan_drectve_symbols): Replace usage of CONST_STRNEQ with startswith.
	* emul_aix.c (ar_emul_aix_parse_arg): Likewise.
	* objcopy.c (is_mergeable_note_section): Likewise.
	* objdump.c (dump_dwarf_section): Likewise.
	* prdbg.c (pr_method_type): Likewise.
	(pr_class_baseclass): Likewise.
	(tg_class_baseclass): Likewise.
	* readelf.c (process_lto_symbol_tables): Likewise.
	* stabs.c (ULLHIGH): Likewise.
	(parse_stab_argtypes): Likewise.
	(stab_demangle_function_name): Likewise.

gas/ChangeLog:

	* config/tc-i386.c (md_parse_option): Replace usage of CONST_STRNEQ with startswith.
	(x86_64_section_word): Likewise.
	* config/tc-sparc.c (md_parse_option): Likewise.

gdb/ChangeLog:

	* arm-tdep.c (show_disassembly_style_sfunc): Replace usage of CONST_STRNEQ with startswith.
	(_initialize_arm_tdep): Likewise.

ld/ChangeLog:

	* emultempl/aix.em: Replace usage of CONST_STRNEQ with startswith.
	* emultempl/beos.em: Likewise.
	* emultempl/elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
	* ldctor.c (ctor_prio): Likewise.
	* ldelf.c (ldelf_try_needed): Likewise.
	(ldelf_parse_ld_so_conf): Likewise.
	(ldelf_after_open): Likewise.
	(output_rel_find): Likewise.
	(ldelf_place_orphan): Likewise.
	* ldfile.c (ldfile_add_library_path): Likewise.
	* ldlang.c (lang_add_input_file): Likewise.
	* ldmain.c (get_sysroot): Likewise.
	(get_emulation): Likewise.
	(add_archive_element): Likewise.
	* ldwrite.c (unsplittable_name): Likewise.
	(clone_section): Likewise.
	* lexsup.c (parse_args): Likewise.
	* pe-dll.c (is_import): Likewise.
	(pe_implied_import_dll): Likewise.

opcodes/ChangeLog:

	* aarch64-dis.c (parse_aarch64_dis_option): Replace usage of CONST_STRNEQ with startswith.
	* arc-dis.c (parse_option): Likewise.
	* arm-dis.c (parse_arm_disassembler_options): Likewise.
	* cris-dis.c (print_with_operands): Likewise.
	* h8300-dis.c (bfd_h8_disassemble): Likewise.
	* i386-dis.c (print_insn): Likewise.
	* ia64-gen.c (fetch_insn_class): Likewise.
	(parse_resource_users): Likewise.
	(in_iclass): Likewise.
	(lookup_specifier): Likewise.
	(insert_opcode_dependencies): Likewise.
	* mips-dis.c (parse_mips_ase_option): Likewise.
	(parse_mips_dis_option): Likewise.
	* s390-dis.c (disassemble_init_s390): Likewise.
	* wasm32-dis.c (parse_wasm32_disassembler_options): Likewise.
This commit is contained in:
Martin Liska 2021-03-19 11:50:26 +01:00
parent 1e7fcccb8d
commit 08dedd6631
97 changed files with 491 additions and 342 deletions

View File

@ -1,3 +1,104 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* bfd-in.h (startswith): Add startswith function.
(CONST_STRNEQ): Remove.
* bfd-in2.h (startswith): Regenerate with make headers.
* archive.c (bfd_slurp_armap): Replace usage of CONST_STRNEQ with startswith.
(_bfd_slurp_extended_name_table): Likewise.
* archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise.
* bfd.c (bfd_get_sign_extend_vma): Likewise.
(bfd_convert_section_size): Likewise.
(bfd_convert_section_contents): Likewise.
* coff-stgo32.c (go32exe_create_stub): Likewise.
(go32exe_check_format): Likewise.
* coffcode.h (styp_to_sec_flags): Likewise.
(GNU_DEBUGALTLINK): Likewise.
* coffgen.c (_bfd_coff_section_already_linked): Likewise.
(coff_gc_sweep): Likewise.
(bfd_coff_gc_sections): Likewise.
* cofflink.c (coff_link_add_symbols): Likewise.
(process_embedded_commands): Likewise.
* compress.c (bfd_is_section_compressed_with_header): Likewise.
(bfd_init_section_decompress_status): Likewise.
* dwarf2.c (find_debug_info): Likewise.
(place_sections): Likewise.
* ecoff.c (_bfd_ecoff_slurp_armap): Likewise.
* elf-m10300.c (_bfd_mn10300_elf_size_dynamic_sections): Likewise.
* elf.c (_bfd_elf_make_section_from_shdr): Likewise.
(assign_section_numbers): Likewise.
(elfcore_grok_win32pstatus): Likewise.
* elf32-arm.c (cmse_scan): Likewise.
(elf32_arm_gc_mark_extra_sections): Likewise.
(elf32_arm_size_dynamic_sections): Likewise.
(is_arm_elf_unwind_section_name): Likewise.
* elf32-bfin.c (bfin_size_dynamic_sections): Likewise.
* elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise.
* elf32-cris.c (elf_cris_size_dynamic_sections): Likewise.
* elf32-csky.c (csky_elf_size_dynamic_sections): Likewise.
* elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise.
* elf32-iq2000.c (iq2000_elf_check_relocs): Likewise.
* elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise.
* elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise.
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
* elf32-metag.c (elf_metag_size_dynamic_sections): Likewise.
* elf32-msp430.c (msp430_elf_relax_delete_bytes): Likewise.
* elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise.
* elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise.
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
* elf32-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise.
* elf32-sh.c (sh_elf_size_dynamic_sections): Likewise.
* elf32-tic6x.c (is_tic6x_elf_unwind_section_name): Likewise.
(elf32_tic6x_size_dynamic_sections): Likewise.
* elf32-vax.c (elf_vax_size_dynamic_sections): Likewise.
* elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise.
(xtensa_is_insntable_section): Likewise.
(xtensa_is_littable_section): Likewise.
(xtensa_is_proptable_section): Likewise.
(xtensa_property_section_name): Likewise.
(xtensa_callback_required_dependence): Likewise.
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
* elf64-ia64-vms.c (is_unwind_section_name): Likewise.
(get_reloc_section): Likewise.
(elf64_ia64_size_dynamic_sections): Likewise.
(elf64_ia64_object_p): Likewise.
* elf64-mmix.c (mmix_elf_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise.
* elf64-s390.c (elf_s390_size_dynamic_sections): Likewise.
* elflink.c (elf_link_add_object_symbols): Likewise.
(_bfd_elf_gc_mark_extra_sections): Likewise.
(bfd_elf_parse_eh_frame_entries): Likewise.
(_bfd_elf_section_already_linked): Likewise.
* elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise.
* elfnn-ia64.c (is_unwind_section_name): Likewise.
(elfNN_ia64_size_dynamic_sections): Likewise.
(elfNN_ia64_object_p): Likewise.
* elfxx-mips.c (FN_STUB_P): Likewise.
(CALL_STUB_P): Likewise.
(CALL_FP_STUB_P): Likewise.
(_bfd_mips_elf_section_from_shdr): Likewise.
(_bfd_mips_elf_fake_sections): Likewise.
(_bfd_mips_elf_size_dynamic_sections): Likewise.
(_bfd_mips_final_write_processing): Likewise.
(_bfd_mips_elf_final_link): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise.
* elfxx-x86.c (elf_i386_is_reloc_section): Likewise.
(elf_x86_64_is_reloc_section): Likewise.
* hpux-core.c (thread_section_p): Likewise.
* libcoff.h (bfd_pei_p): Likewise.
* linker.c (REAL): Likewise.
(unwrap_hash_lookup): Likewise.
(_bfd_generic_link_add_one_symbol): Likewise.
* mmo.c (mmo_internal_write_section): Likewise.
* osf-core.c (osf_core_core_file_p): Likewise.
* pef.c (bfd_pef_print_symbol): Likewise.
* pei-x86_64.c (pex64_print_all_pdata_sections): Likewise.
* som.c (som_slurp_symbol_table): Likewise.
(som_slurp_armap): Likewise.
* wasm-module.c (wasm_compute_custom_section_file_position): Likewise.
2021-03-22 Jan Beulich <jbeulich@suse.com> 2021-03-22 Jan Beulich <jbeulich@suse.com>
* peXXigen.c (_bfd_XXi_swap_scnhdr_out): Add missing * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Add missing

View File

@ -1175,12 +1175,12 @@ bfd_slurp_armap (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE; return FALSE;
if (CONST_STRNEQ (nextname, "__.SYMDEF ") if (startswith (nextname, "__.SYMDEF ")
|| CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */ || startswith (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd); return do_slurp_bsd_armap (abfd);
else if (CONST_STRNEQ (nextname, "/ ")) else if (startswith (nextname, "/ "))
return do_slurp_coff_armap (abfd); return do_slurp_coff_armap (abfd);
else if (CONST_STRNEQ (nextname, "/SYM64/ ")) else if (startswith (nextname, "/SYM64/ "))
{ {
/* 64bit (Irix 6) archive. */ /* 64bit (Irix 6) archive. */
#ifdef BFD64 #ifdef BFD64
@ -1190,7 +1190,7 @@ bfd_slurp_armap (bfd *abfd)
return FALSE; return FALSE;
#endif #endif
} }
else if (CONST_STRNEQ (nextname, "#1/20 ")) else if (startswith (nextname, "#1/20 "))
{ {
/* Mach-O has a special name for armap when the map is sorted by name. /* Mach-O has a special name for armap when the map is sorted by name.
However because this name has a space it is slightly more difficult However because this name has a space it is slightly more difficult
@ -1206,8 +1206,8 @@ bfd_slurp_armap (bfd *abfd)
if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0) if (bfd_seek (abfd, -(file_ptr) (sizeof (hdr) + 20), SEEK_CUR) != 0)
return FALSE; return FALSE;
extname[20] = 0; extname[20] = 0;
if (CONST_STRNEQ (extname, "__.SYMDEF SORTED") if (startswith (extname, "__.SYMDEF SORTED")
|| CONST_STRNEQ (extname, "__.SYMDEF")) || startswith (extname, "__.SYMDEF"))
return do_slurp_bsd_armap (abfd); return do_slurp_bsd_armap (abfd);
} }
@ -1246,8 +1246,8 @@ _bfd_slurp_extended_name_table (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0) if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE; return FALSE;
if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ") if (! startswith (nextname, "ARFILENAMES/ ")
&& ! CONST_STRNEQ (nextname, "// ")) && ! startswith (nextname, "// "))
{ {
bfd_ardata (abfd)->extended_names = NULL; bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0; bfd_ardata (abfd)->extended_names_size = 0;

View File

@ -62,10 +62,10 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
return FALSE; return FALSE;
/* Archives with traditional armaps are still permitted. */ /* Archives with traditional armaps are still permitted. */
if (CONST_STRNEQ (nextname, "/ ")) if (startswith (nextname, "/ "))
return bfd_slurp_armap (abfd); return bfd_slurp_armap (abfd);
if (! CONST_STRNEQ (nextname, "/SYM64/ ")) if (! startswith (nextname, "/SYM64/ "))
{ {
abfd->has_armap = FALSE; abfd->has_armap = FALSE;
return TRUE; return TRUE;

View File

@ -56,15 +56,7 @@ extern "C" {
comma and then the length of the string. Doing this by hand comma and then the length of the string. Doing this by hand
is error prone, so using this macro is safer. */ is error prone, so using this macro is safer. */
#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
to create the arguments to another macro, since the preprocessor
will mis-count the number of arguments to the outer macro (by not
evaluating STRING_COMMA_LEN and so missing the comma). This is a
problem for example when trying to use STRING_COMMA_LEN to build
the arguments to the strncmp() macro. Hence this alternative
definition of strncmp is provided here.
Note - these macros do NOT work if STR2 is not a constant string. */
/* strcpy() can have a similar problem, but since we know we are /* strcpy() can have a similar problem, but since we know we are
copying a constant string, we can use memcpy which will be faster copying a constant string, we can use memcpy which will be faster
since there is no need to check for a NUL byte inside STR. We since there is no need to check for a NUL byte inside STR. We
@ -72,7 +64,6 @@ extern "C" {
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
#define BFD_SUPPORTS_PLUGINS @supports_plugins@ #define BFD_SUPPORTS_PLUGINS @supports_plugins@
/* The word size used by BFD on the host. This may be 64 with a 32 /* The word size used by BFD on the host. This may be 64 with a 32
@ -571,4 +562,3 @@ startswith (const char *str, const char *prefix)
{ {
return strncmp (str, prefix, strlen (prefix)) == 0; return strncmp (str, prefix, strlen (prefix)) == 0;
} }
#define CONST_STRNEQ(STR1,STR2) startswith (STR1, STR2)

View File

@ -63,15 +63,7 @@ extern "C" {
comma and then the length of the string. Doing this by hand comma and then the length of the string. Doing this by hand
is error prone, so using this macro is safer. */ is error prone, so using this macro is safer. */
#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1) #define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
to create the arguments to another macro, since the preprocessor
will mis-count the number of arguments to the outer macro (by not
evaluating STRING_COMMA_LEN and so missing the comma). This is a
problem for example when trying to use STRING_COMMA_LEN to build
the arguments to the strncmp() macro. Hence this alternative
definition of strncmp is provided here.
Note - these macros do NOT work if STR2 is not a constant string. */
/* strcpy() can have a similar problem, but since we know we are /* strcpy() can have a similar problem, but since we know we are
copying a constant string, we can use memcpy which will be faster copying a constant string, we can use memcpy which will be faster
since there is no need to check for a NUL byte inside STR. We since there is no need to check for a NUL byte inside STR. We
@ -79,7 +71,6 @@ extern "C" {
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1) #define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2)) #define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
#define BFD_SUPPORTS_PLUGINS @supports_plugins@ #define BFD_SUPPORTS_PLUGINS @supports_plugins@
/* The word size used by BFD on the host. This may be 64 with a 32 /* The word size used by BFD on the host. This may be 64 with a 32
@ -578,7 +569,6 @@ startswith (const char *str, const char *prefix)
{ {
return strncmp (str, prefix, strlen (prefix)) == 0; return strncmp (str, prefix, strlen (prefix)) == 0;
} }
#define CONST_STRNEQ(STR1,STR2) startswith (STR1, STR2)
/* Extracted from init.c. */ /* Extracted from init.c. */
unsigned int bfd_init (void); unsigned int bfd_init (void);

View File

@ -1746,7 +1746,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
no place to store this information in the COFF back end. no place to store this information in the COFF back end.
Should enough other COFF targets add support for DWARF2, Should enough other COFF targets add support for DWARF2,
a place will have to be found. Until then, this hack will do. */ a place will have to be found. Until then, this hack will do. */
if (CONST_STRNEQ (name, "coff-go32") if (startswith (name, "coff-go32")
|| strcmp (name, "pe-i386") == 0 || strcmp (name, "pe-i386") == 0
|| strcmp (name, "pei-i386") == 0 || strcmp (name, "pei-i386") == 0
|| strcmp (name, "pe-x86-64") == 0 || strcmp (name, "pe-x86-64") == 0
@ -1757,7 +1757,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
|| strcmp (name, "aix5coff64-rs6000") == 0) || strcmp (name, "aix5coff64-rs6000") == 0)
return 1; return 1;
if (CONST_STRNEQ (name, "mach-o")) if (startswith (name, "mach-o"))
return 0; return 0;
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
@ -2660,7 +2660,7 @@ bfd_convert_section_size (bfd *ibfd, sec_ptr isec, bfd *obfd,
return size; return size;
/* Convert GNU property size. */ /* Convert GNU property size. */
if (CONST_STRNEQ (isec->name, NOTE_GNU_PROPERTY_SECTION_NAME)) if (startswith (isec->name, NOTE_GNU_PROPERTY_SECTION_NAME))
return _bfd_elf_convert_gnu_property_size (ibfd, obfd); return _bfd_elf_convert_gnu_property_size (ibfd, obfd);
/* Do nothing if input file will be decompressed. */ /* Do nothing if input file will be decompressed. */
@ -2718,7 +2718,7 @@ bfd_convert_section_contents (bfd *ibfd, sec_ptr isec, bfd *obfd,
return TRUE; return TRUE;
/* Convert GNU properties. */ /* Convert GNU properties. */
if (CONST_STRNEQ (isec->name, NOTE_GNU_PROPERTY_SECTION_NAME)) if (startswith (isec->name, NOTE_GNU_PROPERTY_SECTION_NAME))
return _bfd_elf_convert_gnu_properties (ibfd, isec, obfd, ptr, return _bfd_elf_convert_gnu_properties (ibfd, isec, obfd, ptr,
ptr_size); ptr_size);

View File

@ -176,7 +176,7 @@ go32exe_create_stub (bfd *abfd)
close (f); close (f);
goto stub_end; goto stub_end;
} }
if (! CONST_STRNEQ (magic, "go32stub")) if (! startswith (magic, "go32stub"))
{ {
close (f); close (f);
goto stub_end; goto stub_end;
@ -306,7 +306,7 @@ go32exe_check_format (bfd *abfd)
header_end = H_GET_16 (abfd, filehdr_dos.e_cparhdr) * 16UL; header_end = H_GET_16 (abfd, filehdr_dos.e_cparhdr) * 16UL;
if (go32exe_temp_stub_size < header_end if (go32exe_temp_stub_size < header_end
|| go32exe_temp_stub_size - header_end < sizeof "go32stub" - 1 || go32exe_temp_stub_size - header_end < sizeof "go32stub" - 1
|| !CONST_STRNEQ (go32exe_temp_stub + header_end, "go32stub")) || !startswith (go32exe_temp_stub + header_end, "go32stub"))
goto fail_format; goto fail_format;
/* Set origin to where the COFF header starts and seek there. */ /* Set origin to where the COFF header starts and seek there. */

View File

@ -527,8 +527,8 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
styp_flags = STYP_LIT; styp_flags = STYP_LIT;
#endif /* _LIT */ #endif /* _LIT */
} }
else if (CONST_STRNEQ (sec_name, DOT_DEBUG) else if (startswith (sec_name, DOT_DEBUG)
|| CONST_STRNEQ (sec_name, DOT_ZDEBUG)) || startswith (sec_name, DOT_ZDEBUG))
{ {
/* Handle the XCOFF debug section and DWARF2 debug sections. */ /* Handle the XCOFF debug section and DWARF2 debug sections. */
if (!sec_name[6]) if (!sec_name[6])
@ -536,13 +536,13 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
else else
styp_flags = STYP_DEBUG_INFO; styp_flags = STYP_DEBUG_INFO;
} }
else if (CONST_STRNEQ (sec_name, ".stab")) else if (startswith (sec_name, ".stab"))
{ {
styp_flags = STYP_DEBUG_INFO; styp_flags = STYP_DEBUG_INFO;
} }
#ifdef COFF_LONG_SECTION_NAMES #ifdef COFF_LONG_SECTION_NAMES
else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI) else if (startswith (sec_name, GNU_LINKONCE_WI)
|| CONST_STRNEQ (sec_name, GNU_LINKONCE_WT)) || startswith (sec_name, GNU_LINKONCE_WT))
{ {
styp_flags = STYP_DEBUG_INFO; styp_flags = STYP_DEBUG_INFO;
} }
@ -642,13 +642,13 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
long styp_flags = 0; long styp_flags = 0;
bfd_boolean is_dbg = FALSE; bfd_boolean is_dbg = FALSE;
if (CONST_STRNEQ (sec_name, DOT_DEBUG) if (startswith (sec_name, DOT_DEBUG)
|| CONST_STRNEQ (sec_name, DOT_ZDEBUG) || startswith (sec_name, DOT_ZDEBUG)
#ifdef COFF_LONG_SECTION_NAMES #ifdef COFF_LONG_SECTION_NAMES
|| CONST_STRNEQ (sec_name, GNU_LINKONCE_WI) || startswith (sec_name, GNU_LINKONCE_WI)
|| CONST_STRNEQ (sec_name, GNU_LINKONCE_WT) || startswith (sec_name, GNU_LINKONCE_WT)
#endif #endif
|| CONST_STRNEQ (sec_name, ".stab")) || startswith (sec_name, ".stab"))
is_dbg = TRUE; is_dbg = TRUE;
/* caution: there are at least three groups of symbols that have /* caution: there are at least three groups of symbols that have
@ -843,16 +843,16 @@ styp_to_sec_flags (bfd *abfd,
#endif #endif
sec_flags |= SEC_ALLOC; sec_flags |= SEC_ALLOC;
} }
else if (CONST_STRNEQ (name, DOT_DEBUG) else if (startswith (name, DOT_DEBUG)
|| CONST_STRNEQ (name, DOT_ZDEBUG) || startswith (name, DOT_ZDEBUG)
#ifdef _COMMENT #ifdef _COMMENT
|| strcmp (name, _COMMENT) == 0 || strcmp (name, _COMMENT) == 0
#endif #endif
#ifdef COFF_LONG_SECTION_NAMES #ifdef COFF_LONG_SECTION_NAMES
|| CONST_STRNEQ (name, GNU_LINKONCE_WI) || startswith (name, GNU_LINKONCE_WI)
|| CONST_STRNEQ (name, GNU_LINKONCE_WT) || startswith (name, GNU_LINKONCE_WT)
#endif #endif
|| CONST_STRNEQ (name, ".stab")) || startswith (name, ".stab"))
{ {
#ifdef COFF_PAGE_SIZE #ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING; sec_flags |= SEC_DEBUGGING;
@ -880,8 +880,8 @@ styp_to_sec_flags (bfd *abfd,
#endif /* STYP_SDATA */ #endif /* STYP_SDATA */
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0 if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
&& (CONST_STRNEQ (name, ".sbss") && (startswith (name, ".sbss")
|| CONST_STRNEQ (name, ".sdata"))) || startswith (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA; sec_flags |= SEC_SMALL_DATA;
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE) #if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
@ -891,7 +891,7 @@ styp_to_sec_flags (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard are permitted. The GNU linker extension is to actually discard
all but one of the sections. */ all but one of the sections. */
if (CONST_STRNEQ (name, ".gnu.linkonce")) if (startswith (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif #endif
@ -1203,18 +1203,18 @@ styp_to_sec_flags (bfd *abfd,
bfd_boolean result = TRUE; bfd_boolean result = TRUE;
bfd_boolean is_dbg = FALSE; bfd_boolean is_dbg = FALSE;
if (CONST_STRNEQ (name, DOT_DEBUG) if (startswith (name, DOT_DEBUG)
|| CONST_STRNEQ (name, DOT_ZDEBUG) || startswith (name, DOT_ZDEBUG)
#ifdef COFF_LONG_SECTION_NAMES #ifdef COFF_LONG_SECTION_NAMES
|| CONST_STRNEQ (name, GNU_LINKONCE_WI) || startswith (name, GNU_LINKONCE_WI)
|| CONST_STRNEQ (name, GNU_LINKONCE_WT) || startswith (name, GNU_LINKONCE_WT)
/* FIXME: These definitions ought to be in a header file. */ /* FIXME: These definitions ought to be in a header file. */
#define GNU_DEBUGLINK ".gnu_debuglink" #define GNU_DEBUGLINK ".gnu_debuglink"
#define GNU_DEBUGALTLINK ".gnu_debugaltlink" #define GNU_DEBUGALTLINK ".gnu_debugaltlink"
|| CONST_STRNEQ (name, GNU_DEBUGLINK) || startswith (name, GNU_DEBUGLINK)
|| CONST_STRNEQ (name, GNU_DEBUGALTLINK) || startswith (name, GNU_DEBUGALTLINK)
#endif #endif
|| CONST_STRNEQ (name, ".stab")) || startswith (name, ".stab"))
is_dbg = TRUE; is_dbg = TRUE;
/* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */ /* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
sec_flags = SEC_READONLY; sec_flags = SEC_READONLY;
@ -1347,8 +1347,8 @@ styp_to_sec_flags (bfd *abfd,
} }
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0 if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
&& (CONST_STRNEQ (name, ".sbss") && (startswith (name, ".sbss")
|| CONST_STRNEQ (name, ".sdata"))) || startswith (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA; sec_flags |= SEC_SMALL_DATA;
#if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE) #if defined (COFF_LONG_SECTION_NAMES) && defined (COFF_SUPPORT_GNU_LINKONCE)
@ -1358,7 +1358,7 @@ styp_to_sec_flags (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard are permitted. The GNU linker extension is to actually discard
all but one of the sections. */ all but one of the sections. */
if (CONST_STRNEQ (name, ".gnu.linkonce")) if (startswith (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif #endif
@ -1679,7 +1679,7 @@ Special entry points for gdb to swap in coff symbol table parts:
.{* Macro: Returns true if the bfd is a PE executable as opposed to a .{* Macro: Returns true if the bfd is a PE executable as opposed to a
. PE object file. *} . PE object file. *}
.#define bfd_pei_p(abfd) \ .#define bfd_pei_p(abfd) \
. (CONST_STRNEQ ((abfd)->xvec->name, "pei-")) . (startswith ((abfd)->xvec->name, "pei-"))
*/ */
/* See whether the magic number matches. */ /* See whether the magic number matches. */

View File

@ -2635,7 +2635,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
key = s_comdat->name; key = s_comdat->name;
else else
{ {
if (CONST_STRNEQ (name, ".gnu.linkonce.") if (startswith (name, ".gnu.linkonce.")
&& (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL) && (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
key++; key++;
else else
@ -2995,10 +2995,10 @@ coff_gc_sweep (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0
|| (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
o->gc_mark = 1; o->gc_mark = 1;
else if (CONST_STRNEQ (o->name, ".idata") else if (startswith (o->name, ".idata")
|| CONST_STRNEQ (o->name, ".pdata") || startswith (o->name, ".pdata")
|| CONST_STRNEQ (o->name, ".xdata") || startswith (o->name, ".xdata")
|| CONST_STRNEQ (o->name, ".rsrc")) || startswith (o->name, ".rsrc"))
o->gc_mark = 1; o->gc_mark = 1;
if (o->gc_mark) if (o->gc_mark)
@ -3109,9 +3109,9 @@ bfd_coff_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
for (o = sub->sections; o != NULL; o = o->next) for (o = sub->sections; o != NULL; o = o->next)
{ {
if (((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP if (((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP
|| CONST_STRNEQ (o->name, ".vectors") || startswith (o->name, ".vectors")
|| CONST_STRNEQ (o->name, ".ctors") || startswith (o->name, ".ctors")
|| CONST_STRNEQ (o->name, ".dtors")) || startswith (o->name, ".dtors"))
&& !o->gc_mark) && !o->gc_mark)
{ {
if (!_bfd_coff_gc_mark (info, o, _bfd_coff_gc_mark_hook)) if (!_bfd_coff_gc_mark (info, o, _bfd_coff_gc_mark_hook))

View File

@ -397,7 +397,7 @@ coff_link_add_symbols (bfd *abfd,
|| classification == COFF_SYMBOL_PE_SECTION) || classification == COFF_SYMBOL_PE_SECTION)
&& coff_section_data (abfd, section) != NULL && coff_section_data (abfd, section) != NULL
&& coff_section_data (abfd, section)->comdat != NULL && coff_section_data (abfd, section)->comdat != NULL
&& CONST_STRNEQ (name, "??_") && startswith (name, "??_")
&& strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0) && strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0)
{ {
if (*sym_hash == NULL) if (*sym_hash == NULL)
@ -546,7 +546,7 @@ coff_link_add_symbols (bfd *abfd,
asection *stab; asection *stab;
for (stab = abfd->sections; stab; stab = stab->next) for (stab = abfd->sections; stab; stab = stab->next)
if (CONST_STRNEQ (stab->name, ".stab") if (startswith (stab->name, ".stab")
&& (!stab->name[5] && (!stab->name[5]
|| (stab->name[5] == '.' && ISDIGIT (stab->name[6])))) || (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
{ {
@ -1274,7 +1274,7 @@ process_embedded_commands (bfd *output_bfd,
s++; s++;
continue; continue;
} }
if (CONST_STRNEQ (s, "-attr")) if (startswith (s, "-attr"))
{ {
char *name; char *name;
char *attribs; char *attribs;
@ -1314,14 +1314,14 @@ process_embedded_commands (bfd *output_bfd,
asec->flags |= SEC_READONLY; asec->flags |= SEC_READONLY;
} }
} }
else if (CONST_STRNEQ (s, "-heap")) else if (startswith (s, "-heap"))
s = dores_com (s + 5, output_bfd, 1); s = dores_com (s + 5, output_bfd, 1);
else if (CONST_STRNEQ (s, "-stack")) else if (startswith (s, "-stack"))
s = dores_com (s + 6, output_bfd, 0); s = dores_com (s + 6, output_bfd, 0);
/* GNU extension for aligned commons. */ /* GNU extension for aligned commons. */
else if (CONST_STRNEQ (s, "-aligncomm:")) else if (startswith (s, "-aligncomm:"))
{ {
/* Common symbols must be aligned on reading, as it /* Common symbols must be aligned on reading, as it
is too late to do anything here, after they have is too late to do anything here, after they have

View File

@ -431,7 +431,7 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
if (compression_header_size == 0) if (compression_header_size == 0)
/* In this case, it should be "ZLIB" followed by the uncompressed /* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */ section size, 8 bytes in big-endian order. */
compressed = CONST_STRNEQ ((char*) header , "ZLIB"); compressed = startswith ((char*) header , "ZLIB");
else else
compressed = TRUE; compressed = TRUE;
} }
@ -536,7 +536,7 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
{ {
/* In this case, it should be "ZLIB" followed by the uncompressed /* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */ section size, 8 bytes in big-endian order. */
if (! CONST_STRNEQ ((char*) header, "ZLIB")) if (! startswith ((char*) header, "ZLIB"))
{ {
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
return FALSE; return FALSE;

View File

@ -4234,7 +4234,7 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
} }
for (msec = abfd->sections; msec != NULL; msec = msec->next) for (msec = abfd->sections; msec != NULL; msec = msec->next)
if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO)) if (startswith (msec->name, GNU_LINKONCE_INFO))
return msec; return msec;
return NULL; return NULL;
@ -4250,7 +4250,7 @@ find_debug_info (bfd *abfd, const struct dwarf_debug_section *debug_sections,
if (look != NULL && strcmp (msec->name, look) == 0) if (look != NULL && strcmp (msec->name, look) == 0)
return msec; return msec;
if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO)) if (startswith (msec->name, GNU_LINKONCE_INFO))
return msec; return msec;
} }
@ -4375,7 +4375,7 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash)
continue; continue;
is_debug_info = (strcmp (sect->name, debug_info_name) == 0 is_debug_info = (strcmp (sect->name, debug_info_name) == 0
|| CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)); || startswith (sect->name, GNU_LINKONCE_INFO));
if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd) if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd)
&& !is_debug_info) && !is_debug_info)
@ -4419,7 +4419,7 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash)
continue; continue;
is_debug_info = (strcmp (sect->name, debug_info_name) == 0 is_debug_info = (strcmp (sect->name, debug_info_name) == 0
|| CONST_STRNEQ (sect->name, GNU_LINKONCE_INFO)); || startswith (sect->name, GNU_LINKONCE_INFO));
if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd) if (!((sect->flags & SEC_ALLOC) != 0 && abfd == orig_bfd)
&& !is_debug_info) && !is_debug_info)

View File

@ -2866,7 +2866,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd)
bfd_slurp_armap, but that seems inappropriate since no other bfd_slurp_armap, but that seems inappropriate since no other
target uses this format. Instead, we check directly for a COFF target uses this format. Instead, we check directly for a COFF
armap. */ armap. */
if (CONST_STRNEQ (nextname, "/ ")) if (startswith (nextname, "/ "))
return bfd_slurp_armap (abfd); return bfd_slurp_armap (abfd);
/* See if the first element is an armap. */ /* See if the first element is an armap. */

View File

@ -5070,7 +5070,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
/* Remember whether there is a PLT. */ /* Remember whether there is a PLT. */
; ;
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -5084,7 +5084,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& ! streq (name, ".dynbss")) && ! streq (name, ".dynbss"))
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */
continue; continue;

View File

@ -1113,7 +1113,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard are permitted. The GNU linker extension is to actually discard
all but one of the sections. */ all but one of the sections. */
if (CONST_STRNEQ (name, ".gnu.linkonce") if (startswith (name, ".gnu.linkonce")
&& elf_next_in_group (newsect) == NULL) && elf_next_in_group (newsect) == NULL)
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD; flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
@ -3942,7 +3942,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
string section. We look for a section with the same name string section. We look for a section with the same name
but without the trailing ``str'', and set its sh_link but without the trailing ``str'', and set its sh_link
field to point to this section. */ field to point to this section. */
if (CONST_STRNEQ (sec->name, ".stab") if (startswith (sec->name, ".stab")
&& strcmp (sec->name + strlen (sec->name) - 3, "str") == 0) && strcmp (sec->name + strlen (sec->name) - 3, "str") == 0)
{ {
size_t len; size_t len;
@ -10190,7 +10190,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
if (note->descsz < 4) if (note->descsz < 4)
return TRUE; return TRUE;
if (! CONST_STRNEQ (note->namedata, "win32")) if (! startswith (note->namedata, "win32"))
return TRUE; return TRUE;
type = bfd_get_32 (abfd, note->descdata); type = bfd_get_32 (abfd, note->descdata);

View File

@ -5961,7 +5961,7 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
sym_name = bfd_elf_string_from_elf_section (input_bfd, sym_name = bfd_elf_string_from_elf_section (input_bfd,
symtab_hdr->sh_link, symtab_hdr->sh_link,
cmse_sym->st_name); cmse_sym->st_name);
if (!sym_name || !CONST_STRNEQ (sym_name, CMSE_PREFIX)) if (!sym_name || !startswith (sym_name, CMSE_PREFIX))
continue; continue;
/* Special symbol with local binding. */ /* Special symbol with local binding. */
@ -5971,7 +5971,7 @@ cmse_scan (bfd *input_bfd, struct elf32_arm_link_hash_table *htab,
{ {
cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]); cmse_hash = elf32_arm_hash_entry (sym_hashes[i - ext_start]);
sym_name = (char *) cmse_hash->root.root.root.string; sym_name = (char *) cmse_hash->root.root.root.string;
if (!CONST_STRNEQ (sym_name, CMSE_PREFIX)) if (!startswith (sym_name, CMSE_PREFIX))
continue; continue;
/* Special symbol has incorrect binding or type. */ /* Special symbol has incorrect binding or type. */
@ -15847,7 +15847,7 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info,
/* Assume it is a special symbol. If not, cmse_scan will /* Assume it is a special symbol. If not, cmse_scan will
warn about it and user can do something about it. */ warn about it and user can do something about it. */
if (CONST_STRNEQ (cmse_hash->root.root.root.string, if (startswith (cmse_hash->root.root.root.string,
CMSE_PREFIX)) CMSE_PREFIX))
{ {
cmse_sec = cmse_hash->root.root.u.def.section; cmse_sec = cmse_hash->root.root.u.def.section;
@ -16902,7 +16902,7 @@ elf32_arm_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
/* Remember whether there is a PLT. */ /* Remember whether there is a PLT. */
; ;
} }
else if (CONST_STRNEQ (name, ".rel")) else if (startswith (name, ".rel"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -17564,8 +17564,8 @@ elf32_arm_final_write_processing (bfd *abfd)
static bfd_boolean static bfd_boolean
is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name) is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
{ {
return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind) return (startswith (name, ELF_STRING_ARM_unwind)
|| CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once)); || startswith (name, ELF_STRING_ARM_unwind_once));
} }

View File

@ -5186,7 +5186,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
strip = FALSE; strip = FALSE;
if (CONST_STRNEQ (name, ".rela")) if (startswith (name, ".rela"))
{ {
if (s->size == 0) if (s->size == 0)
{ {
@ -5210,7 +5210,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got")) else if (! startswith (name, ".got"))
{ {
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */
continue; continue;

View File

@ -2439,7 +2439,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
/* Remember whether there is a PLT. */ /* Remember whether there is a PLT. */
; ;
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -2453,7 +2453,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0) && strcmp (name, ".dynbss") != 0)
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */
continue; continue;

View File

@ -3593,7 +3593,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->size += htab->dtpmod_refcount != 0 s->size += htab->dtpmod_refcount != 0
? 8 : 0; ? 8 : 0;
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (strcmp (name, ".rela.got") == 0 if (strcmp (name, ".rela.got") == 0
&& htab->dtpmod_refcount != 0 && htab->dtpmod_refcount != 0
@ -3612,7 +3612,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0 && strcmp (name, ".dynbss") != 0
&& s != htab->root.sdynrelro) && s != htab->root.sdynrelro)
{ {

View File

@ -2045,7 +2045,7 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.hplt != NULL) if (htab->elf.hplt != NULL)
strip_section = FALSE; strip_section = FALSE;
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rel") ) else if (startswith (bfd_section_name (s), ".rel") )
{ {
if (s->size != 0 ) if (s->size != 0 )
relocs = TRUE; relocs = TRUE;

View File

@ -2232,7 +2232,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|| sec == htab->etab.sdynbss || sec == htab->etab.sdynbss
|| sec == htab->etab.sdynrelro) || sec == htab->etab.sdynrelro)
; ;
else if (CONST_STRNEQ (bfd_section_name (sec), ".rela")) else if (startswith (bfd_section_name (sec), ".rela"))
{ {
if (sec->size != 0) if (sec->size != 0)
{ {

View File

@ -507,9 +507,9 @@ iq2000_elf_check_relocs (bfd *abfd,
case R_IQ2000_32: case R_IQ2000_32:
/* For debug section, change to special harvard-aware relocations. */ /* For debug section, change to special harvard-aware relocations. */
if (CONST_STRNEQ (sec->name, ".debug") if (startswith (sec->name, ".debug")
|| CONST_STRNEQ (sec->name, ".stab") || startswith (sec->name, ".stab")
|| CONST_STRNEQ (sec->name, ".eh_frame")) || startswith (sec->name, ".eh_frame"))
{ {
((Elf_Internal_Rela *) rel)->r_info ((Elf_Internal_Rela *) rel)->r_info
= ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG); = ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);

View File

@ -2020,7 +2020,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->root.srelplt) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -2073,7 +2073,7 @@ m32r_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->srelplt) if (s->size != 0 && s != htab->srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -3171,7 +3171,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Remember whether there is a PLT. */ /* Remember whether there is a PLT. */
; ;
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -3182,7 +3182,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0) && strcmp (name, ".dynbss") != 0)
{ {
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */

View File

@ -2847,7 +2847,7 @@ elf_metag_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->etab.srelplt) if (s->size != 0 && s != htab->etab.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -1855,8 +1855,8 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
the start of the next section. */ the start of the next section. */
|| (isym->st_value == toaddr || (isym->st_value == toaddr
&& name != NULL && name != NULL
&& (CONST_STRNEQ (name, ".Letext") && (startswith (name, ".Letext")
|| CONST_STRNEQ (name, ".LFE"))))) || startswith (name, ".LFE")))))
{ {
if (debug_relocs) if (debug_relocs)
printf (" adjusting value of local symbol %s from 0x%lx ", printf (" adjusting value of local symbol %s from 0x%lx ",

View File

@ -5825,7 +5825,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".rela")) if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {

View File

@ -3034,7 +3034,7 @@ or1k_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->root.srelplt) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -5812,7 +5812,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
{ {
strip_section = (s->flags & SEC_KEEP) == 0; strip_section = (s->flags & SEC_KEEP) == 0;
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {

View File

@ -1919,7 +1919,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
relocs = TRUE; relocs = TRUE;

View File

@ -3282,7 +3282,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".rel")) if (startswith (name, ".rel"))
{ {
if (s->size == 0) if (s->size == 0)
{ {
@ -3320,7 +3320,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (CONST_STRNEQ (name, ".got")) else if (startswith (name, ".got"))
{ {
/* s3_bfd_score_elf_always_size_sections() has already done /* s3_bfd_score_elf_always_size_sections() has already done
most of the work, but some symbols may have been mapped most of the work, but some symbols may have been mapped
@ -3333,7 +3333,7 @@ s3_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
of .text section. So put a dummy. XXX */ of .text section. So put a dummy. XXX */
s->size += SCORE_FUNCTION_STUB_SIZE; s->size += SCORE_FUNCTION_STUB_SIZE;
} }
else if (! CONST_STRNEQ (name, ".init")) else if (! startswith (name, ".init"))
{ {
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */
continue; continue;

View File

@ -3090,7 +3090,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".rel")) if (startswith (name, ".rel"))
{ {
if (s->size == 0) if (s->size == 0)
{ {
@ -3128,7 +3128,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (CONST_STRNEQ (name, ".got")) else if (startswith (name, ".got"))
{ {
/* s7_bfd_score_elf_always_size_sections() has already done /* s7_bfd_score_elf_always_size_sections() has already done
most of the work, but some symbols may have been mapped most of the work, but some symbols may have been mapped
@ -3141,7 +3141,7 @@ s7_bfd_score_elf_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *i
of .text section. So put a dummy. XXX */ of .text section. So put a dummy. XXX */
s->size += SCORE_FUNCTION_STUB_SIZE; s->size += SCORE_FUNCTION_STUB_SIZE;
} }
else if (! CONST_STRNEQ (name, ".init")) else if (! startswith (name, ".init"))
{ {
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */
continue; continue;

View File

@ -3152,7 +3152,7 @@ sh_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->root.srelplt && s != htab->srelplt2) if (s->size != 0 && s != htab->root.srelplt && s != htab->srelplt2)
relocs = TRUE; relocs = TRUE;

View File

@ -1938,8 +1938,8 @@ elf32_tic6x_gc_mark_extra_sections (struct bfd_link_info *info,
static bfd_boolean static bfd_boolean
is_tic6x_elf_unwind_section_name (const char *name) is_tic6x_elf_unwind_section_name (const char *name)
{ {
return (CONST_STRNEQ (name, ELF_STRING_C6000_unwind) return (startswith (name, ELF_STRING_C6000_unwind)
|| CONST_STRNEQ (name, ELF_STRING_C6000_unwind_once)); || startswith (name, ELF_STRING_C6000_unwind_once));
} }
@ -3284,7 +3284,7 @@ elf32_tic6x_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
if (s == htab->elf.splt && s->size > 0) if (s == htab->elf.splt && s->size > 0)
s->size = (s->size + 31) & ~(bfd_vma)31; s->size = (s->size + 31) & ~(bfd_vma)31;
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 if (s->size != 0
&& s != htab->elf.srelplt) && s != htab->elf.srelplt)

View File

@ -1082,7 +1082,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
/* Remember whether there is a PLT. */ /* Remember whether there is a PLT. */
; ;
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -1094,7 +1094,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0) && strcmp (name, ".dynbss") != 0)
{ {
/* It's not one of our sections, so don't allocate space. */ /* It's not one of our sections, so don't allocate space. */

View File

@ -1691,7 +1691,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".rela")) if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -1705,8 +1705,8 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".plt.") else if (! startswith (name, ".plt.")
&& ! CONST_STRNEQ (name, ".got.plt.") && ! startswith (name, ".got.plt.")
&& strcmp (name, ".got") != 0 && strcmp (name, ".got") != 0
&& strcmp (name, ".plt") != 0 && strcmp (name, ".plt") != 0
&& strcmp (name, ".got.plt") != 0 && strcmp (name, ".got.plt") != 0
@ -11144,8 +11144,8 @@ xtensa_is_property_section (asection *sec)
static bfd_boolean static bfd_boolean
xtensa_is_insntable_section (asection *sec) xtensa_is_insntable_section (asection *sec)
{ {
if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME) if (startswith (sec->name, XTENSA_INSN_SEC_NAME)
|| CONST_STRNEQ (sec->name, ".gnu.linkonce.x.")) || startswith (sec->name, ".gnu.linkonce.x."))
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -11155,8 +11155,8 @@ xtensa_is_insntable_section (asection *sec)
static bfd_boolean static bfd_boolean
xtensa_is_littable_section (asection *sec) xtensa_is_littable_section (asection *sec)
{ {
if (CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME) if (startswith (sec->name, XTENSA_LIT_SEC_NAME)
|| CONST_STRNEQ (sec->name, ".gnu.linkonce.p.")) || startswith (sec->name, ".gnu.linkonce.p."))
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -11166,8 +11166,8 @@ xtensa_is_littable_section (asection *sec)
static bfd_boolean static bfd_boolean
xtensa_is_proptable_section (asection *sec) xtensa_is_proptable_section (asection *sec)
{ {
if (CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME) if (startswith (sec->name, XTENSA_PROP_SEC_NAME)
|| CONST_STRNEQ (sec->name, ".gnu.linkonce.prop.")) || startswith (sec->name, ".gnu.linkonce.prop."))
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -11281,7 +11281,7 @@ xtensa_property_section_name (asection *sec, const char *base_name,
suffix = sec->name + linkonce_len; suffix = sec->name + linkonce_len;
/* For backward compatibility, replace "t." instead of inserting /* For backward compatibility, replace "t." instead of inserting
the new linkonce_kind (but not for "prop" sections). */ the new linkonce_kind (but not for "prop" sections). */
if (CONST_STRNEQ (suffix, "t.") && linkonce_kind[1] == '.') if (startswith (suffix, "t.") && linkonce_kind[1] == '.')
suffix += 2; suffix += 2;
strcat (prop_sec_name + linkonce_len, suffix); strcat (prop_sec_name + linkonce_len, suffix);
} }
@ -11396,7 +11396,7 @@ xtensa_callback_required_dependence (bfd *abfd,
/* ".plt*" sections have no explicit relocations but they contain L32R /* ".plt*" sections have no explicit relocations but they contain L32R
instructions that reference the corresponding ".got.plt*" sections. */ instructions that reference the corresponding ".got.plt*" sections. */
if ((sec->flags & SEC_LINKER_CREATED) != 0 if ((sec->flags & SEC_LINKER_CREATED) != 0
&& CONST_STRNEQ (sec->name, ".plt")) && startswith (sec->name, ".plt"))
{ {
asection *sgotplt; asection *sgotplt;

View File

@ -2859,7 +2859,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */ of the dynobj section names depend upon the input files. */
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".rela")) if (startswith (name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -2873,7 +2873,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0; s->reloc_count = 0;
} }
} }
else if (! CONST_STRNEQ (name, ".got") else if (! startswith (name, ".got")
&& strcmp (name, ".plt") != 0 && strcmp (name, ".plt") != 0
&& strcmp (name, ".dynbss") != 0) && strcmp (name, ".dynbss") != 0)
{ {
@ -2890,7 +2890,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
linker does that before adjust_dynamic_symbol is called, and linker does that before adjust_dynamic_symbol is called, and
it is that function which decides whether anything needs to it is that function which decides whether anything needs to
go into these sections. */ go into these sections. */
if (!CONST_STRNEQ (name, ".got")) if (!startswith (name, ".got"))
s->flags |= SEC_EXCLUDE; s->flags |= SEC_EXCLUDE;
} }
else if ((s->flags & SEC_HAS_CONTENTS) != 0) else if ((s->flags & SEC_HAS_CONTENTS) != 0)

View File

@ -1754,13 +1754,13 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
; ;
} }
else if (strcmp (name, ".opd") == 0 else if (strcmp (name, ".opd") == 0
|| CONST_STRNEQ (name, ".dlt") || startswith (name, ".dlt")
|| strcmp (name, ".stub") == 0 || strcmp (name, ".stub") == 0
|| strcmp (name, ".got") == 0) || strcmp (name, ".got") == 0)
{ {
/* Strip this section if we don't need it; see the comment below. */ /* Strip this section if we don't need it; see the comment below. */
} }
else if (CONST_STRNEQ (name, ".rela")) else if (startswith (name, ".rela"))
{ {
if (sec->size != 0) if (sec->size != 0)
{ {

View File

@ -809,9 +809,9 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
static inline bfd_boolean static inline bfd_boolean
is_unwind_section_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name) is_unwind_section_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
{ {
return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind) return ((startswith (name, ELF_STRING_ia64_unwind)
&& ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info)) && ! startswith (name, ELF_STRING_ia64_unwind_info))
|| CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once)); || startswith (name, ELF_STRING_ia64_unwind_once));
} }
@ -1847,9 +1847,9 @@ get_reloc_section (bfd *abfd,
if (srel_name == NULL) if (srel_name == NULL)
return NULL; return NULL;
BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela") BFD_ASSERT ((startswith (srel_name, ".rela")
&& strcmp (bfd_section_name (sec), srel_name+5) == 0) && strcmp (bfd_section_name (sec), srel_name+5) == 0)
|| (CONST_STRNEQ (srel_name, ".rel") || (startswith (srel_name, ".rel")
&& strcmp (bfd_section_name (sec), srel_name+4) == 0)); && strcmp (bfd_section_name (sec), srel_name+4) == 0));
dynobj = ia64_info->root.dynobj; dynobj = ia64_info->root.dynobj;
@ -2745,7 +2745,7 @@ elf64_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (strcmp (name, ".got.plt") == 0) if (strcmp (name, ".got.plt") == 0)
strip = FALSE; strip = FALSE;
else if (CONST_STRNEQ (name, ".rel")) else if (startswith (name, ".rel"))
{ {
if (!strip) if (!strip)
{ {
@ -4387,7 +4387,7 @@ elf64_ia64_object_p (bfd *abfd)
if (elf_sec_group (sec) == NULL if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP)) && ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE)) == (SEC_LINK_ONCE | SEC_CODE))
&& CONST_STRNEQ (sec->name, ".gnu.linkonce.t.")) && startswith (sec->name, ".gnu.linkonce.t."))
{ {
name = sec->name + 16; name = sec->name + 16;

View File

@ -2139,7 +2139,7 @@ mmix_elf_add_symbol_hook (bfd *abfd,
(*secp)->flags |= SEC_LINKER_CREATED; (*secp)->flags |= SEC_LINKER_CREATED;
} }
else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.' else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.'
&& CONST_STRNEQ (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) && startswith (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX))
{ {
/* See if we have another one. */ /* See if we have another one. */
struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash, struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,

View File

@ -10226,7 +10226,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
/* Not sized yet. */ /* Not sized yet. */
continue; continue;
} }
else if (CONST_STRNEQ (s->name, ".rela")) else if (startswith (s->name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {

View File

@ -1873,7 +1873,7 @@ elf_s390_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->elf.srelplt) if (s->size != 0 && s != htab->elf.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -4129,7 +4129,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
const char *name; const char *name;
name = bfd_section_name (s); name = bfd_section_name (s);
if (CONST_STRNEQ (name, ".gnu.warning.")) if (startswith (name, ".gnu.warning."))
{ {
char *msg; char *msg;
bfd_size_type sz; bfd_size_type sz;
@ -5693,7 +5693,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
asection *stab; asection *stab;
for (stab = abfd->sections; stab; stab = stab->next) for (stab = abfd->sections; stab; stab = stab->next)
if (CONST_STRNEQ (stab->name, ".stab") if (startswith (stab->name, ".stab")
&& (!stab->name[5] || && (!stab->name[5] ||
(stab->name[5] == '.' && ISDIGIT (stab->name[6]))) (stab->name[5] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0 && (stab->flags & SEC_MERGE) == 0
@ -13698,7 +13698,7 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
if (!debug_frag_seen if (!debug_frag_seen
&& (isec->flags & SEC_DEBUGGING) && (isec->flags & SEC_DEBUGGING)
&& CONST_STRNEQ (isec->name, ".debug_line.")) && startswith (isec->name, ".debug_line."))
debug_frag_seen = TRUE; debug_frag_seen = TRUE;
else if (strcmp (bfd_section_name (isec), else if (strcmp (bfd_section_name (isec),
"__patchable_function_entries") == 0 "__patchable_function_entries") == 0
@ -14015,7 +14015,7 @@ bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED,
for (sec = ibfd->sections; sec; sec = sec->next) for (sec = ibfd->sections; sec; sec = sec->next)
{ {
if (CONST_STRNEQ (bfd_section_name (sec), ".eh_frame_entry") if (startswith (bfd_section_name (sec), ".eh_frame_entry")
&& init_reloc_cookie_rels (&cookie, info, ibfd, sec)) && init_reloc_cookie_rels (&cookie, info, ibfd, sec))
{ {
_bfd_elf_parse_eh_frame_entry (info, sec, &cookie); _bfd_elf_parse_eh_frame_entry (info, sec, &cookie);
@ -14722,7 +14722,7 @@ _bfd_elf_section_already_linked (bfd *abfd,
else else
{ {
/* Otherwise we should have a .gnu.linkonce.<type>.<key> section. */ /* Otherwise we should have a .gnu.linkonce.<type>.<key> section. */
if (CONST_STRNEQ (name, ".gnu.linkonce.") if (startswith (name, ".gnu.linkonce.")
&& (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL) && (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
key++; key++;
else else
@ -14821,10 +14821,10 @@ _bfd_elf_section_already_linked (bfd *abfd,
`.gnu.linkonce.r.F' section. The order of sections in a bfd does not `.gnu.linkonce.r.F' section. The order of sections in a bfd does not
matter as here were are looking only for cross-bfd sections. */ matter as here were are looking only for cross-bfd sections. */
if ((flags & SEC_GROUP) == 0 && CONST_STRNEQ (name, ".gnu.linkonce.r.")) if ((flags & SEC_GROUP) == 0 && startswith (name, ".gnu.linkonce.r."))
for (l = already_linked_list->entry; l != NULL; l = l->next) for (l = already_linked_list->entry; l != NULL; l = l->next)
if ((l->sec->flags & SEC_GROUP) == 0 if ((l->sec->flags & SEC_GROUP) == 0
&& CONST_STRNEQ (l->sec->name, ".gnu.linkonce.t.")) && startswith (l->sec->name, ".gnu.linkonce.t."))
{ {
if (abfd != l->sec->owner) if (abfd != l->sec->owner)
sec->output_section = bfd_abs_section_ptr; sec->output_section = bfd_abs_section_ptr;

View File

@ -9047,7 +9047,7 @@ elfNN_aarch64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (bfd_section_name (s), ".rela")) else if (startswith (bfd_section_name (s), ".rela"))
{ {
if (s->size != 0 && s != htab->root.srelplt) if (s->size != 0 && s != htab->root.srelplt)
relocs = TRUE; relocs = TRUE;

View File

@ -893,9 +893,9 @@ is_unwind_section_name (bfd *abfd, const char *name)
&& !strcmp (name, ELF_STRING_ia64_unwind_hdr)) && !strcmp (name, ELF_STRING_ia64_unwind_hdr))
return FALSE; return FALSE;
return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind) return ((startswith (name, ELF_STRING_ia64_unwind)
&& ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info)) && ! startswith (name, ELF_STRING_ia64_unwind_info))
|| CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once)); || startswith (name, ELF_STRING_ia64_unwind_once));
} }
/* Handle an IA-64 specific section when reading an object file. This /* Handle an IA-64 specific section when reading an object file. This
@ -3161,7 +3161,7 @@ elfNN_ia64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (strcmp (name, ".got.plt") == 0) if (strcmp (name, ".got.plt") == 0)
strip = FALSE; strip = FALSE;
else if (CONST_STRNEQ (name, ".rel")) else if (startswith (name, ".rel"))
{ {
if (!strip) if (!strip)
{ {
@ -4859,7 +4859,7 @@ elfNN_ia64_object_p (bfd *abfd)
if (elf_sec_group (sec) == NULL if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP)) && ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE)) == (SEC_LINK_ONCE | SEC_CODE))
&& CONST_STRNEQ (sec->name, ".gnu.linkonce.t.")) && startswith (sec->name, ".gnu.linkonce.t."))
{ {
name = sec->name + 16; name = sec->name + 16;

View File

@ -1030,9 +1030,9 @@ static bfd *reldyn_sorting_bfd;
#define CALL_STUB ".mips16.call." #define CALL_STUB ".mips16.call."
#define CALL_FP_STUB ".mips16.call.fp." #define CALL_FP_STUB ".mips16.call.fp."
#define FN_STUB_P(name) CONST_STRNEQ (name, FN_STUB) #define FN_STUB_P(name) startswith (name, FN_STUB)
#define CALL_STUB_P(name) CONST_STRNEQ (name, CALL_STUB) #define CALL_STUB_P(name) startswith (name, CALL_STUB)
#define CALL_FP_STUB_P(name) CONST_STRNEQ (name, CALL_FP_STUB) #define CALL_FP_STUB_P(name) startswith (name, CALL_FP_STUB)
/* The format of the first PLT entry in an O32 executable. */ /* The format of the first PLT entry in an O32 executable. */
static const bfd_vma mips_o32_exec_plt0_entry[] = static const bfd_vma mips_o32_exec_plt0_entry[] =
@ -7411,7 +7411,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE; return FALSE;
break; break;
case SHT_MIPS_GPTAB: case SHT_MIPS_GPTAB:
if (! CONST_STRNEQ (name, ".gptab.")) if (! startswith (name, ".gptab."))
return FALSE; return FALSE;
break; break;
case SHT_MIPS_UCODE: case SHT_MIPS_UCODE:
@ -7434,7 +7434,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE; return FALSE;
break; break;
case SHT_MIPS_CONTENT: case SHT_MIPS_CONTENT:
if (! CONST_STRNEQ (name, ".MIPS.content")) if (! startswith (name, ".MIPS.content"))
return FALSE; return FALSE;
break; break;
case SHT_MIPS_OPTIONS: case SHT_MIPS_OPTIONS:
@ -7447,8 +7447,8 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE); flags = (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_SAME_SIZE);
break; break;
case SHT_MIPS_DWARF: case SHT_MIPS_DWARF:
if (! CONST_STRNEQ (name, ".debug_") if (! startswith (name, ".debug_")
&& ! CONST_STRNEQ (name, ".zdebug_")) && ! startswith (name, ".zdebug_"))
return FALSE; return FALSE;
break; break;
case SHT_MIPS_SYMBOL_LIB: case SHT_MIPS_SYMBOL_LIB:
@ -7456,8 +7456,8 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE; return FALSE;
break; break;
case SHT_MIPS_EVENTS: case SHT_MIPS_EVENTS:
if (! CONST_STRNEQ (name, ".MIPS.events") if (! startswith (name, ".MIPS.events")
&& ! CONST_STRNEQ (name, ".MIPS.post_rel")) && ! startswith (name, ".MIPS.post_rel"))
return FALSE; return FALSE;
break; break;
case SHT_MIPS_XHASH: case SHT_MIPS_XHASH:
@ -7594,7 +7594,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
} }
else if (strcmp (name, ".conflict") == 0) else if (strcmp (name, ".conflict") == 0)
hdr->sh_type = SHT_MIPS_CONFLICT; hdr->sh_type = SHT_MIPS_CONFLICT;
else if (CONST_STRNEQ (name, ".gptab.")) else if (startswith (name, ".gptab."))
{ {
hdr->sh_type = SHT_MIPS_GPTAB; hdr->sh_type = SHT_MIPS_GPTAB;
hdr->sh_entsize = sizeof (Elf32_External_gptab); hdr->sh_entsize = sizeof (Elf32_External_gptab);
@ -7651,7 +7651,7 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_type = SHT_MIPS_IFACE; hdr->sh_type = SHT_MIPS_IFACE;
hdr->sh_flags |= SHF_MIPS_NOSTRIP; hdr->sh_flags |= SHF_MIPS_NOSTRIP;
} }
else if (CONST_STRNEQ (name, ".MIPS.content")) else if (startswith (name, ".MIPS.content"))
{ {
hdr->sh_type = SHT_MIPS_CONTENT; hdr->sh_type = SHT_MIPS_CONTENT;
hdr->sh_flags |= SHF_MIPS_NOSTRIP; hdr->sh_flags |= SHF_MIPS_NOSTRIP;
@ -7663,20 +7663,20 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
hdr->sh_entsize = 1; hdr->sh_entsize = 1;
hdr->sh_flags |= SHF_MIPS_NOSTRIP; hdr->sh_flags |= SHF_MIPS_NOSTRIP;
} }
else if (CONST_STRNEQ (name, ".MIPS.abiflags")) else if (startswith (name, ".MIPS.abiflags"))
{ {
hdr->sh_type = SHT_MIPS_ABIFLAGS; hdr->sh_type = SHT_MIPS_ABIFLAGS;
hdr->sh_entsize = sizeof (Elf_External_ABIFlags_v0); hdr->sh_entsize = sizeof (Elf_External_ABIFlags_v0);
} }
else if (CONST_STRNEQ (name, ".debug_") else if (startswith (name, ".debug_")
|| CONST_STRNEQ (name, ".zdebug_")) || startswith (name, ".zdebug_"))
{ {
hdr->sh_type = SHT_MIPS_DWARF; hdr->sh_type = SHT_MIPS_DWARF;
/* Irix facilities such as libexc expect a single .debug_frame /* Irix facilities such as libexc expect a single .debug_frame
per executable, the system ones have NOSTRIP set and the linker per executable, the system ones have NOSTRIP set and the linker
doesn't merge sections with different flags so ... */ doesn't merge sections with different flags so ... */
if (SGI_COMPAT (abfd) && CONST_STRNEQ (name, ".debug_frame")) if (SGI_COMPAT (abfd) && startswith (name, ".debug_frame"))
hdr->sh_flags |= SHF_MIPS_NOSTRIP; hdr->sh_flags |= SHF_MIPS_NOSTRIP;
} }
else if (strcmp (name, ".MIPS.symlib") == 0) else if (strcmp (name, ".MIPS.symlib") == 0)
@ -7685,8 +7685,8 @@ _bfd_mips_elf_fake_sections (bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec)
/* The sh_link and sh_info fields are set in /* The sh_link and sh_info fields are set in
final_write_processing. */ final_write_processing. */
} }
else if (CONST_STRNEQ (name, ".MIPS.events") else if (startswith (name, ".MIPS.events")
|| CONST_STRNEQ (name, ".MIPS.post_rel")) || startswith (name, ".MIPS.post_rel"))
{ {
hdr->sh_type = SHT_MIPS_EVENTS; hdr->sh_type = SHT_MIPS_EVENTS;
hdr->sh_flags |= SHF_MIPS_NOSTRIP; hdr->sh_flags |= SHF_MIPS_NOSTRIP;
@ -10007,7 +10007,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
if ((s->flags & SEC_LINKER_CREATED) == 0) if ((s->flags & SEC_LINKER_CREATED) == 0)
continue; continue;
if (CONST_STRNEQ (name, ".rel")) if (startswith (name, ".rel"))
{ {
if (s->size != 0) if (s->size != 0)
{ {
@ -10044,14 +10044,14 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
} }
else if (bfd_link_executable (info) else if (bfd_link_executable (info)
&& ! mips_elf_hash_table (info)->use_rld_obj_head && ! mips_elf_hash_table (info)->use_rld_obj_head
&& CONST_STRNEQ (name, ".rld_map")) && startswith (name, ".rld_map"))
{ {
/* We add a room for __rld_map. It will be filled in by the /* We add a room for __rld_map. It will be filled in by the
rtld to contain a pointer to the _r_debug structure. */ rtld to contain a pointer to the _r_debug structure. */
s->size += MIPS_ELF_RLD_MAP_SIZE (output_bfd); s->size += MIPS_ELF_RLD_MAP_SIZE (output_bfd);
} }
else if (SGI_COMPAT (output_bfd) else if (SGI_COMPAT (output_bfd)
&& CONST_STRNEQ (name, ".compact_rel")) && startswith (name, ".compact_rel"))
s->size += mips_elf_hash_table (info)->compact_rel_size; s->size += mips_elf_hash_table (info)->compact_rel_size;
else if (s == htab->root.splt) else if (s == htab->root.splt)
{ {
@ -10063,7 +10063,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
&& s->size > 0) && s->size > 0)
s->size += 4; s->size += 4;
} }
else if (! CONST_STRNEQ (name, ".init") else if (! startswith (name, ".init")
&& s != htab->root.sgot && s != htab->root.sgot
&& s != htab->root.sgotplt && s != htab->root.sgotplt
&& s != htab->sstubs && s != htab->sstubs
@ -12422,7 +12422,7 @@ _bfd_mips_final_write_processing (bfd *abfd)
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_section_name ((*hdrpp)->bfd_section); name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL BFD_ASSERT (name != NULL
&& CONST_STRNEQ (name, ".gptab.")); && startswith (name, ".gptab."));
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1); sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
BFD_ASSERT (sec != NULL); BFD_ASSERT (sec != NULL);
(*hdrpp)->sh_info = elf_section_data (sec)->this_idx; (*hdrpp)->sh_info = elf_section_data (sec)->this_idx;
@ -12432,7 +12432,7 @@ _bfd_mips_final_write_processing (bfd *abfd)
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_section_name ((*hdrpp)->bfd_section); name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL BFD_ASSERT (name != NULL
&& CONST_STRNEQ (name, ".MIPS.content")); && startswith (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd, sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.content" - 1); name + sizeof ".MIPS.content" - 1);
BFD_ASSERT (sec != NULL); BFD_ASSERT (sec != NULL);
@ -12452,12 +12452,12 @@ _bfd_mips_final_write_processing (bfd *abfd)
BFD_ASSERT ((*hdrpp)->bfd_section != NULL); BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_section_name ((*hdrpp)->bfd_section); name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL); BFD_ASSERT (name != NULL);
if (CONST_STRNEQ (name, ".MIPS.events")) if (startswith (name, ".MIPS.events"))
sec = bfd_get_section_by_name (abfd, sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.events" - 1); name + sizeof ".MIPS.events" - 1);
else else
{ {
BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel")); BFD_ASSERT (startswith (name, ".MIPS.post_rel"));
sec = bfd_get_section_by_name (abfd, sec = bfd_get_section_by_name (abfd,
(name (name
+ sizeof ".MIPS.post_rel" - 1)); + sizeof ".MIPS.post_rel" - 1));
@ -15085,7 +15085,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
mdebug_sec = o; mdebug_sec = o;
} }
if (CONST_STRNEQ (o->name, ".gptab.")) if (startswith (o->name, ".gptab."))
{ {
const char *subname; const char *subname;
unsigned int c; unsigned int c;

View File

@ -2540,7 +2540,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
/* Strip this section if we don't need it; see the /* Strip this section if we don't need it; see the
comment below. */ comment below. */
} }
else if (CONST_STRNEQ (s->name, ".rela")) else if (startswith (s->name, ".rela"))
{ {
if (s->size != 0) if (s->size != 0)
{ {

View File

@ -686,13 +686,13 @@ elf_x86_link_hash_table_free (bfd *obfd)
static bfd_boolean static bfd_boolean
elf_i386_is_reloc_section (const char *secname) elf_i386_is_reloc_section (const char *secname)
{ {
return CONST_STRNEQ (secname, ".rel"); return startswith (secname, ".rel");
} }
static bfd_boolean static bfd_boolean
elf_x86_64_is_reloc_section (const char *secname) elf_x86_64_is_reloc_section (const char *secname)
{ {
return CONST_STRNEQ (secname, ".rela"); return startswith (secname, ".rela");
} }
/* Create an x86 ELF linker hash table. */ /* Create an x86 ELF linker hash table. */

View File

@ -145,7 +145,7 @@ thread_section_p (bfd *abfd ATTRIBUTE_UNUSED,
asection *sect, asection *sect,
void *obj ATTRIBUTE_UNUSED) void *obj ATTRIBUTE_UNUSED)
{ {
return CONST_STRNEQ (sect->name, ".reg/"); return startswith (sect->name, ".reg/");
} }
/* this function builds a bfd target if the file is a corefile. /* this function builds a bfd target if the file is a corefile.

View File

@ -977,7 +977,7 @@ typedef struct
/* Macro: Returns true if the bfd is a PE executable as opposed to a /* Macro: Returns true if the bfd is a PE executable as opposed to a
PE object file. */ PE object file. */
#define bfd_pei_p(abfd) \ #define bfd_pei_p(abfd) \
(CONST_STRNEQ ((abfd)->xvec->name, "pei-")) (startswith ((abfd)->xvec->name, "pei-"))
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -579,7 +579,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
#define REAL "__real_" #define REAL "__real_"
if (*l == '_' if (*l == '_'
&& CONST_STRNEQ (l, REAL) && startswith (l, REAL)
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1, && bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
FALSE, FALSE) != NULL) FALSE, FALSE) != NULL)
{ {
@ -623,7 +623,7 @@ unwrap_hash_lookup (struct bfd_link_info *info,
|| *l == info->wrap_char) || *l == info->wrap_char)
++l; ++l;
if (CONST_STRNEQ (l, WRAP)) if (startswith (l, WRAP))
{ {
l += sizeof WRAP - 1; l += sizeof WRAP - 1;
@ -964,7 +964,7 @@ _bfd_generic_link_add_archive_symbols
if (h == NULL if (h == NULL
&& info->pei386_auto_import && info->pei386_auto_import
&& CONST_STRNEQ (arsym->name, "__imp_")) && startswith (arsym->name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, arsym->name + 6, h = bfd_link_hash_lookup (info->hash, arsym->name + 6,
FALSE, FALSE, TRUE); FALSE, FALSE, TRUE);
if (h == NULL) if (h == NULL)
@ -1536,7 +1536,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
s = name + 1; s = name + 1;
while (*s == '_') while (*s == '_')
++s; ++s;
if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX)) if (s[0] == 'G' && startswith (s, CONS_PREFIX))
{ {
char c; char c;

View File

@ -2505,7 +2505,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec)
bfd_set_error (bfd_error_bad_value); bfd_set_error (bfd_error_bad_value);
return FALSE; return FALSE;
} }
else if (CONST_STRNEQ (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX)) else if (startswith (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX))
{ {
int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)); int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX));

View File

@ -84,7 +84,7 @@ osf_core_core_file_p (bfd *abfd)
if (val != sizeof core_header) if (val != sizeof core_header)
return NULL; return NULL;
if (! CONST_STRNEQ (core_header.magic, "Core")) if (! startswith (core_header.magic, "Core"))
return NULL; return NULL;
core_hdr (abfd) = (struct osf_core_struct *) core_hdr (abfd) = (struct osf_core_struct *)

View File

@ -219,7 +219,7 @@ bfd_pef_print_symbol (bfd *abfd,
default: default:
bfd_print_symbol_vandf (abfd, (void *) file, symbol); bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s", symbol->section->name, symbol->name); fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
if (CONST_STRNEQ (symbol->name, "__traceback_")) if (startswith (symbol->name, "__traceback_"))
{ {
unsigned char *buf; unsigned char *buf;
size_t offset = symbol->value + 4; size_t offset = symbol->value + 4;

View File

@ -835,7 +835,7 @@ static void
pex64_print_all_pdata_sections (bfd *abfd, asection *pdata, void *arg) pex64_print_all_pdata_sections (bfd *abfd, asection *pdata, void *arg)
{ {
struct pex64_paps *paps = arg; struct pex64_paps *paps = arg;
if (CONST_STRNEQ (pdata->name, ".pdata")) if (startswith (pdata->name, ".pdata"))
{ {
if (pex64_bfd_print_pdata_section (abfd, paps->obj, pdata)) if (pex64_bfd_print_pdata_section (abfd, paps->obj, pdata))
paps->pdata_count++; paps->pdata_count++;

View File

@ -4803,12 +4803,12 @@ som_slurp_symbol_table (bfd *abfd)
&& sym->symbol.name[strlen (sym->symbol.name) - 1] == '$' && sym->symbol.name[strlen (sym->symbol.name) - 1] == '$'
&& !strcmp (sym->symbol.name, sym->symbol.section->name)) && !strcmp (sym->symbol.name, sym->symbol.section->name))
sym->symbol.flags |= BSF_SECTION_SYM; sym->symbol.flags |= BSF_SECTION_SYM;
else if (CONST_STRNEQ (sym->symbol.name, "L$0\002")) else if (startswith (sym->symbol.name, "L$0\002"))
{ {
sym->symbol.flags |= BSF_SECTION_SYM; sym->symbol.flags |= BSF_SECTION_SYM;
sym->symbol.name = sym->symbol.section->name; sym->symbol.name = sym->symbol.section->name;
} }
else if (CONST_STRNEQ (sym->symbol.name, "L$0\001")) else if (startswith (sym->symbol.name, "L$0\001"))
sym->symbol.flags |= BSF_DEBUGGING; sym->symbol.flags |= BSF_DEBUGGING;
/* Note increment at bottom of loop, since we skip some symbols /* Note increment at bottom of loop, since we skip some symbols
@ -6186,7 +6186,7 @@ som_slurp_armap (bfd *abfd)
return FALSE; return FALSE;
/* For archives without .o files there is no symbol table. */ /* For archives without .o files there is no symbol table. */
if (! CONST_STRNEQ (nextname, "/ ")) if (! startswith (nextname, "/ "))
{ {
abfd->has_armap = FALSE; abfd->has_armap = FALSE;
return TRUE; return TRUE;

View File

@ -536,7 +536,7 @@ wasm_compute_custom_section_file_position (bfd *abfd,
if (idx != 0) if (idx != 0)
return; return;
if (CONST_STRNEQ (asect->name, WASM_SECTION_PREFIX)) if (startswith (asect->name, WASM_SECTION_PREFIX))
{ {
const char *name = asect->name + strlen (WASM_SECTION_PREFIX); const char *name = asect->name + strlen (WASM_SECTION_PREFIX);
bfd_size_type payload_len = asect->size; bfd_size_type payload_len = asect->size;

View File

@ -1,3 +1,17 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* dlltool.c (scan_drectve_symbols): Replace usage of CONST_STRNEQ with startswith.
* emul_aix.c (ar_emul_aix_parse_arg): Likewise.
* objcopy.c (is_mergeable_note_section): Likewise.
* objdump.c (dump_dwarf_section): Likewise.
* prdbg.c (pr_method_type): Likewise.
(pr_class_baseclass): Likewise.
(tg_class_baseclass): Likewise.
* readelf.c (process_lto_symbol_tables): Likewise.
* stabs.c (ULLHIGH): Likewise.
(parse_stab_argtypes): Likewise.
(stab_demangle_function_name): Likewise.
2021-03-19 H.J. Lu <hongjiu.lu@intel.com> 2021-03-19 H.J. Lu <hongjiu.lu@intel.com>
* readelf.c (get_machine_name): Add EM_INTELGT. * readelf.c (get_machine_name): Add EM_INTELGT.

View File

@ -1367,7 +1367,7 @@ scan_drectve_symbols (bfd *abfd)
while (p < e) while (p < e)
{ {
if (p[0] == '-' if (p[0] == '-'
&& CONST_STRNEQ (p, "-export:")) && startswith (p, "-export:"))
{ {
char * name; char * name;
char * c; char * c;
@ -1399,7 +1399,7 @@ scan_drectve_symbols (bfd *abfd)
char *tag_start = ++p; char *tag_start = ++p;
while (p < e && *p != ' ' && *p != '-') while (p < e && *p != ' ' && *p != '-')
p++; p++;
if (CONST_STRNEQ (tag_start, "data")) if (startswith (tag_start, "data"))
flags &= ~BSF_FUNCTION; flags &= ~BSF_FUNCTION;
} }

View File

@ -91,25 +91,25 @@ ar_emul_aix_replace (bfd **after_bfd, bfd *new_bfd,
static bfd_boolean static bfd_boolean
ar_emul_aix_parse_arg (char *arg) ar_emul_aix_parse_arg (char *arg)
{ {
if (CONST_STRNEQ (arg, "-X32_64")) if (startswith (arg, "-X32_64"))
{ {
big_archive = TRUE; big_archive = TRUE;
X32 = TRUE; X32 = TRUE;
X64 = TRUE; X64 = TRUE;
} }
else if (CONST_STRNEQ (arg, "-X32")) else if (startswith (arg, "-X32"))
{ {
big_archive = TRUE; big_archive = TRUE;
X32 = TRUE; X32 = TRUE;
X64 = FALSE; X64 = FALSE;
} }
else if (CONST_STRNEQ (arg, "-X64")) else if (startswith (arg, "-X64"))
{ {
big_archive = TRUE; big_archive = TRUE;
X32 = FALSE; X32 = FALSE;
X64 = TRUE; X64 = TRUE;
} }
else if (CONST_STRNEQ (arg, "-g")) else if (startswith (arg, "-g"))
{ {
big_archive = FALSE; big_archive = FALSE;
X32 = TRUE; X32 = TRUE;

View File

@ -1316,7 +1316,7 @@ is_mergeable_note_section (bfd * abfd, asection * sec)
&& elf_section_data (sec)->this_hdr.sh_type == SHT_NOTE && elf_section_data (sec)->this_hdr.sh_type == SHT_NOTE
/* FIXME: We currently only support merging GNU_BUILD_NOTEs. /* FIXME: We currently only support merging GNU_BUILD_NOTEs.
We should add support for more note types. */ We should add support for more note types. */
&& (CONST_STRNEQ (sec->name, GNU_BUILD_ATTRS_SECTION_NAME))) && (startswith (sec->name, GNU_BUILD_ATTRS_SECTION_NAME)))
return TRUE; return TRUE;
return FALSE; return FALSE;

View File

@ -3748,7 +3748,7 @@ dump_dwarf_section (bfd *abfd, asection *section,
const char *match; const char *match;
int i; int i;
if (CONST_STRNEQ (name, ".gnu.linkonce.wi.")) if (startswith (name, ".gnu.linkonce.wi."))
match = ".debug_info"; match = ".debug_info";
else else
match = name; match = name;

View File

@ -937,10 +937,10 @@ pr_method_type (void *p, bfd_boolean domain, int argcount, bfd_boolean varargs)
domain_type = pop_type (info); domain_type = pop_type (info);
if (domain_type == NULL) if (domain_type == NULL)
return FALSE; return FALSE;
if (CONST_STRNEQ (domain_type, "class ") if (startswith (domain_type, "class ")
&& strchr (domain_type + sizeof "class " - 1, ' ') == NULL) && strchr (domain_type + sizeof "class " - 1, ' ') == NULL)
domain_type += sizeof "class " - 1; domain_type += sizeof "class " - 1;
else if (CONST_STRNEQ (domain_type, "union class ") else if (startswith (domain_type, "union class ")
&& (strchr (domain_type + sizeof "union class " - 1, ' ') && (strchr (domain_type + sizeof "union class " - 1, ' ')
== NULL)) == NULL))
domain_type += sizeof "union class " - 1; domain_type += sizeof "union class " - 1;
@ -1349,7 +1349,7 @@ pr_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual,
if (t == NULL) if (t == NULL)
return FALSE; return FALSE;
if (CONST_STRNEQ (t, "class ")) if (startswith (t, "class "))
t += sizeof "class " - 1; t += sizeof "class " - 1;
/* Push it back on to take advantage of the prepend_type and /* Push it back on to take advantage of the prepend_type and
@ -2238,7 +2238,7 @@ tg_class_baseclass (void *p, bfd_vma bitpos ATTRIBUTE_UNUSED,
if (t == NULL) if (t == NULL)
return FALSE; return FALSE;
if (CONST_STRNEQ (t, "class ")) if (startswith (t, "class "))
t += sizeof "class " - 1; t += sizeof "class " - 1;
/* Push it back on to take advantage of the prepend_type and /* Push it back on to take advantage of the prepend_type and

View File

@ -12708,7 +12708,7 @@ process_lto_symbol_tables (Filedata * filedata)
i < filedata->file_header.e_shnum; i < filedata->file_header.e_shnum;
i++, section++) i++, section++)
if (SECTION_NAME_VALID (section) if (SECTION_NAME_VALID (section)
&& CONST_STRNEQ (SECTION_NAME (section), ".gnu.lto_.symtab.")) && startswith (SECTION_NAME (section), ".gnu.lto_.symtab."))
res &= display_lto_symtab (filedata, section); res &= display_lto_symtab (filedata, section);
return res; return res;

View File

@ -1760,12 +1760,12 @@ parse_stab_range_type (void * dhandle,
#define ULLHIGH "01777777777777777777777;" #define ULLHIGH "01777777777777777777777;"
if (index_type == DEBUG_TYPE_NULL) if (index_type == DEBUG_TYPE_NULL)
{ {
if (CONST_STRNEQ (s2, LLLOW) if (startswith (s2, LLLOW)
&& CONST_STRNEQ (s3, LLHIGH)) && startswith (s3, LLHIGH))
return debug_make_int_type (dhandle, 8, FALSE); return debug_make_int_type (dhandle, 8, FALSE);
if (! ov2 if (! ov2
&& n2 == 0 && n2 == 0
&& CONST_STRNEQ (s3, ULLHIGH)) && startswith (s3, ULLHIGH))
return debug_make_int_type (dhandle, 8, TRUE); return debug_make_int_type (dhandle, 8, TRUE);
} }
@ -2987,7 +2987,7 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
&& (ISDIGIT (argtypes[2]) && (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q' || argtypes[2] == 'Q'
|| argtypes[2] == 't')) || argtypes[2] == 't'))
|| CONST_STRNEQ (argtypes, "__ct")); || startswith (argtypes, "__ct"));
is_constructor = (is_full_physname_constructor is_constructor = (is_full_physname_constructor
|| (tagname != NULL || (tagname != NULL
@ -2995,7 +2995,7 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
is_destructor = ((argtypes[0] == '_' is_destructor = ((argtypes[0] == '_'
&& (argtypes[1] == '$' || argtypes[1] == '.') && (argtypes[1] == '$' || argtypes[1] == '.')
&& argtypes[2] == '_') && argtypes[2] == '_')
|| CONST_STRNEQ (argtypes, "__dt")); || startswith (argtypes, "__dt"));
is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z'; is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
if (!(is_destructor || is_full_physname_constructor || is_v3)) if (!(is_destructor || is_full_physname_constructor || is_v3))
@ -3995,7 +3995,7 @@ stab_demangle_function_name (struct stab_demangle_info *minfo,
*pp = scan + 2; *pp = scan + 2;
if (*pp - name >= 5 if (*pp - name >= 5
&& CONST_STRNEQ (name, "type") && startswith (name, "type")
&& (name[4] == '$' || name[4] == '.')) && (name[4] == '$' || name[4] == '.'))
{ {
const char *tem; const char *tem;

View File

@ -1,3 +1,9 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* config/tc-i386.c (md_parse_option): Replace usage of CONST_STRNEQ with startswith.
(x86_64_section_word): Likewise.
* config/tc-sparc.c (md_parse_option): Likewise.
2021-03-19 Alan Modra <amodra@gmail.com> 2021-03-19 Alan Modra <amodra@gmail.com>
* app.c (do_scrub_chars): Don't lose spaces before a slash. * app.c (do_scrub_chars): Don't lose spaces before a slash.

View File

@ -13016,7 +13016,7 @@ md_parse_option (int c, const char *arg)
list = bfd_target_list (); list = bfd_target_list ();
for (l = list; *l != NULL; l++) for (l = list; *l != NULL; l++)
if (CONST_STRNEQ (*l, "elf64-x86-64") if (startswith (*l, "elf64-x86-64")
|| strcmp (*l, "coff-x86-64") == 0 || strcmp (*l, "coff-x86-64") == 0
|| strcmp (*l, "pe-x86-64") == 0 || strcmp (*l, "pe-x86-64") == 0
|| strcmp (*l, "pei-x86-64") == 0 || strcmp (*l, "pei-x86-64") == 0
@ -13040,7 +13040,7 @@ md_parse_option (int c, const char *arg)
list = bfd_target_list (); list = bfd_target_list ();
for (l = list; *l != NULL; l++) for (l = list; *l != NULL; l++)
if (CONST_STRNEQ (*l, "elf32-x86-64")) if (startswith (*l, "elf32-x86-64"))
{ {
default_arch = "x86_64:32"; default_arch = "x86_64:32";
break; break;
@ -14366,7 +14366,7 @@ x86_64_section_letter (int letter, const char **ptr_msg)
bfd_vma bfd_vma
x86_64_section_word (char *str, size_t len) x86_64_section_word (char *str, size_t len)
{ {
if (len == 5 && flag_code == CODE_64BIT && CONST_STRNEQ (str, "large")) if (len == 5 && flag_code == CODE_64BIT && startswith (str, "large"))
return SHF_X86_64_LARGE; return SHF_X86_64_LARGE;
return -1; return -1;

View File

@ -548,12 +548,12 @@ md_parse_option (int c, const char *arg)
{ {
if (sparc_arch_size == 32) if (sparc_arch_size == 32)
{ {
if (CONST_STRNEQ (*l, "elf32-sparc")) if (startswith (*l, "elf32-sparc"))
break; break;
} }
else else
{ {
if (CONST_STRNEQ (*l, "elf64-sparc")) if (startswith (*l, "elf64-sparc"))
break; break;
} }
} }

View File

@ -1,3 +1,8 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* arm-tdep.c (show_disassembly_style_sfunc): Replace usage of CONST_STRNEQ with startswith.
(_initialize_arm_tdep): Likewise.
2021-03-20 Tom Tromey <tom@tromey.com> 2021-03-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (xcoff_initial_scan): Create partial symtabs. * xcoffread.c (xcoff_initial_scan): Create partial symtabs.

View File

@ -8535,7 +8535,7 @@ show_disassembly_style_sfunc (struct ui_file *file, int from_tty,
const char *opt; const char *opt;
FOR_EACH_DISASSEMBLER_OPTION (opt, options) FOR_EACH_DISASSEMBLER_OPTION (opt, options)
if (CONST_STRNEQ (opt, "reg-names-")) if (startswith (opt, "reg-names-"))
{ {
style = &opt[strlen ("reg-names-")]; style = &opt[strlen ("reg-names-")];
len = strcspn (style, ","); len = strcspn (style, ",");
@ -9575,14 +9575,14 @@ _initialize_arm_tdep ()
= &disassembler_options_arm ()->options; = &disassembler_options_arm ()->options;
int num_disassembly_styles = 0; int num_disassembly_styles = 0;
for (i = 0; disasm_options->name[i] != NULL; i++) for (i = 0; disasm_options->name[i] != NULL; i++)
if (CONST_STRNEQ (disasm_options->name[i], "reg-names-")) if (startswith (disasm_options->name[i], "reg-names-"))
num_disassembly_styles++; num_disassembly_styles++;
/* Initialize the array that will be passed to add_setshow_enum_cmd(). */ /* Initialize the array that will be passed to add_setshow_enum_cmd(). */
valid_disassembly_styles = XNEWVEC (const char *, valid_disassembly_styles = XNEWVEC (const char *,
num_disassembly_styles + 1); num_disassembly_styles + 1);
for (i = j = 0; disasm_options->name[i] != NULL; i++) for (i = j = 0; disasm_options->name[i] != NULL; i++)
if (CONST_STRNEQ (disasm_options->name[i], "reg-names-")) if (startswith (disasm_options->name[i], "reg-names-"))
{ {
size_t offset = strlen ("reg-names-"); size_t offset = strlen ("reg-names-");
const char *style = disasm_options->name[i]; const char *style = disasm_options->name[i];

View File

@ -1,3 +1,28 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* emultempl/aix.em: Replace usage of CONST_STRNEQ with startswith.
* emultempl/beos.em: Likewise.
* emultempl/elf.em: Likewise.
* emultempl/pe.em: Likewise.
* emultempl/pep.em: Likewise.
* emultempl/xtensaelf.em: Likewise.
* ldctor.c (ctor_prio): Likewise.
* ldelf.c (ldelf_try_needed): Likewise.
(ldelf_parse_ld_so_conf): Likewise.
(ldelf_after_open): Likewise.
(output_rel_find): Likewise.
(ldelf_place_orphan): Likewise.
* ldfile.c (ldfile_add_library_path): Likewise.
* ldlang.c (lang_add_input_file): Likewise.
* ldmain.c (get_sysroot): Likewise.
(get_emulation): Likewise.
(add_archive_element): Likewise.
* ldwrite.c (unsplittable_name): Likewise.
(clone_section): Likewise.
* lexsup.c (parse_args): Likewise.
* pe-dll.c (is_import): Likewise.
(pe_implied_import_dll): Likewise.
2021-03-19 H.J. Lu <hongjiu.lu@intel.com> 2021-03-19 H.J. Lu <hongjiu.lu@intel.com>
PR ld/27590 PR ld/27590

View File

@ -287,7 +287,7 @@ gld${EMULATION_NAME}_parse_args (int argc, char **argv)
if (indx == 0) if (indx == 0)
indx = 1; indx = 1;
if (indx < argc && CONST_STRNEQ (argv[indx], "-b")) if (indx < argc && startswith (argv[indx], "-b"))
{ {
char *s; char *s;

View File

@ -461,8 +461,8 @@ sort_by_section_name (const void *a, const void *b)
FIXME stripping images with a .rsrc section still needs to be fixed. */ FIXME stripping images with a .rsrc section still needs to be fixed. */
if (i != 0) if (i != 0)
{ {
if ((CONST_STRNEQ (sna, ".stab")) if ((startswith (sna, ".stab"))
&& (!CONST_STRNEQ (snb, ".stab"))) && (!startswith (snb, ".stab")))
return 1; return 1;
} }
return i; return i;
@ -536,7 +536,7 @@ sort_sections (lang_statement_union_type *s)
{ {
/* Is this the .idata section? */ /* Is this the .idata section? */
if (sec->spec.name != NULL if (sec->spec.name != NULL
&& CONST_STRNEQ (sec->spec.name, ".idata")) && startswith (sec->spec.name, ".idata"))
{ {
/* Sort the children. We want to sort any objects in /* Sort the children. We want to sort any objects in
the same archive. In order to handle the case of the same archive. In order to handle the case of

View File

@ -712,7 +712,7 @@ fragment <<EOF
link_info.unresolved_syms_in_objects = RM_IGNORE; link_info.unresolved_syms_in_objects = RM_IGNORE;
else if (strcmp (optarg, "muldefs") == 0) else if (strcmp (optarg, "muldefs") == 0)
link_info.allow_multiple_definition = TRUE; link_info.allow_multiple_definition = TRUE;
else if (CONST_STRNEQ (optarg, "max-page-size=")) else if (startswith (optarg, "max-page-size="))
{ {
char *end; char *end;
@ -722,7 +722,7 @@ fragment <<EOF
einfo (_("%F%P: invalid maximum page size \`%s'\n"), einfo (_("%F%P: invalid maximum page size \`%s'\n"),
optarg + 14); optarg + 14);
} }
else if (CONST_STRNEQ (optarg, "common-page-size=")) else if (startswith (optarg, "common-page-size="))
{ {
char *end; char *end;
link_info.commonpagesize = strtoul (optarg + 17, &end, 0); link_info.commonpagesize = strtoul (optarg + 17, &end, 0);
@ -731,7 +731,7 @@ fragment <<EOF
einfo (_("%F%P: invalid common page size \`%s'\n"), einfo (_("%F%P: invalid common page size \`%s'\n"),
optarg + 17); optarg + 17);
} }
else if (CONST_STRNEQ (optarg, "stack-size=")) else if (startswith (optarg, "stack-size="))
{ {
char *end; char *end;
link_info.stacksize = strtoul (optarg + 11, &end, 0); link_info.stacksize = strtoul (optarg + 11, &end, 0);
@ -760,11 +760,11 @@ fragment <<EOF
{ {
link_info.flags_1 |= DF_1_GLOBAUDIT; link_info.flags_1 |= DF_1_GLOBAUDIT;
} }
else if (CONST_STRNEQ (optarg, "start-stop-gc")) else if (startswith (optarg, "start-stop-gc"))
link_info.start_stop_gc = TRUE; link_info.start_stop_gc = TRUE;
else if (CONST_STRNEQ (optarg, "nostart-stop-gc")) else if (startswith (optarg, "nostart-stop-gc"))
link_info.start_stop_gc = FALSE; link_info.start_stop_gc = FALSE;
else if (CONST_STRNEQ (optarg, "start-stop-visibility=")) else if (startswith (optarg, "start-stop-visibility="))
{ {
if (strcmp (optarg, "start-stop-visibility=default") == 0) if (strcmp (optarg, "start-stop-visibility=default") == 0)
link_info.start_stop_visibility = STV_DEFAULT; link_info.start_stop_visibility = STV_DEFAULT;

View File

@ -1529,7 +1529,7 @@ gld_${EMULATION_NAME}_after_open (void)
{ {
if (strcmp (sec->name, ".idata\$2") == 0) if (strcmp (sec->name, ".idata\$2") == 0)
idata2 = 1; idata2 = 1;
if (CONST_STRNEQ (sec->name, ".idata\$")) if (startswith (sec->name, ".idata\$"))
is_imp = 1; is_imp = 1;
reloc_count += sec->reloc_count; reloc_count += sec->reloc_count;
} }

View File

@ -1501,7 +1501,7 @@ gld_${EMULATION_NAME}_after_open (void)
{ {
if (strcmp (sec->name, ".idata\$2") == 0) if (strcmp (sec->name, ".idata\$2") == 0)
idata2 = 1; idata2 = 1;
if (CONST_STRNEQ (sec->name, ".idata\$")) if (startswith (sec->name, ".idata\$"))
is_imp = 1; is_imp = 1;
reloc_count += sec->reloc_count; reloc_count += sec->reloc_count;
} }

View File

@ -262,7 +262,7 @@ replace_instruction_table_sections (bfd *abfd, asection *sec)
insn_sec_name = INSN_SEC_BASE_NAME; insn_sec_name = INSN_SEC_BASE_NAME;
prop_sec_name = PROP_SEC_BASE_NAME; prop_sec_name = PROP_SEC_BASE_NAME;
} }
else if (CONST_STRNEQ (sec_name, LINKONCE_SEC_OLD_TEXT_BASE_NAME)) else if (startswith (sec_name, LINKONCE_SEC_OLD_TEXT_BASE_NAME))
{ {
insn_sec_name = sec_name; insn_sec_name = sec_name;
owned_prop_sec_name = (char *) xmalloc (strlen (sec_name) + 20); owned_prop_sec_name = (char *) xmalloc (strlen (sec_name) + 20);
@ -1320,7 +1320,7 @@ is_inconsistent_linkonce_section (asection *sec)
/* Check if this is an Xtensa property section or an exception table /* Check if this is an Xtensa property section or an exception table
for Tensilica's XCC compiler. */ for Tensilica's XCC compiler. */
name = sec_name + linkonce_len; name = sec_name + linkonce_len;
if (CONST_STRNEQ (name, "prop.")) if (startswith (name, "prop."))
name = strchr (name + 5, '.') ? strchr (name + 5, '.') + 1 : name + 5; name = strchr (name + 5, '.') ? strchr (name + 5, '.') + 1 : name + 5;
else if (name[1] == '.' else if (name[1] == '.'
&& (name[0] == 'p' || name[0] == 'e' || name[0] == 'h')) && (name[0] == 'p' || name[0] == 'e' || name[0] == 'h'))

View File

@ -131,7 +131,7 @@ ctor_prio (const char *name)
while (*name == '_') while (*name == '_')
++name; ++name;
if (!CONST_STRNEQ (name, "GLOBAL_")) if (!startswith (name, "GLOBAL_"))
return -1; return -1;
name += sizeof "GLOBAL_" - 1; name += sizeof "GLOBAL_" - 1;

View File

@ -321,7 +321,7 @@ ldelf_try_needed (struct dt_needed *needed, int force, int is_linux)
struct bfd_link_needed_list *l; struct bfd_link_needed_list *l;
for (l = needs; l != NULL; l = l->next) for (l = needs; l != NULL; l = l->next)
if (CONST_STRNEQ (l->name, "libc.so")) if (startswith (l->name, "libc.so"))
break; break;
if (l == NULL) if (l == NULL)
{ {
@ -837,7 +837,7 @@ ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *info, const char *filename)
if (p[0] == '\0') if (p[0] == '\0')
continue; continue;
if (CONST_STRNEQ (p, "include") && (p[7] == ' ' || p[7] == '\t')) if (startswith (p, "include") && (p[7] == ' ' || p[7] == '\t'))
{ {
char *dir, c; char *dir, c;
p += 8; p += 8;
@ -1089,7 +1089,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
if (bfd_is_abs_section (s->output_section)) if (bfd_is_abs_section (s->output_section))
continue; continue;
if (CONST_STRNEQ (name, ".eh_frame_entry")) if (startswith (name, ".eh_frame_entry"))
type = COMPACT_EH_HDR; type = COMPACT_EH_HDR;
else if (strcmp (name, ".eh_frame") == 0 && s->size > 8) else if (strcmp (name, ".eh_frame") == 0 && s->size > 8)
type = DWARF2_EH_HDR; type = DWARF2_EH_HDR;
@ -1820,7 +1820,7 @@ output_rel_find (int isdyn, int rela)
lookup = lookup->next) lookup = lookup->next)
{ {
if (lookup->constraint >= 0 if (lookup->constraint >= 0
&& CONST_STRNEQ (lookup->name, ".rel")) && startswith (lookup->name, ".rel"))
{ {
int lookrela = lookup->name[4] == 'a'; int lookrela = lookup->name[4] == 'a';
@ -1971,7 +1971,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
default: default:
break; break;
} }
else if (CONST_STRNEQ (secname, ".rel")) else if (startswith (secname, ".rel"))
{ {
secname = secname[4] == 'a' ? ".rela.dyn" : ".rel.dyn"; secname = secname[4] == 'a' ? ".rela.dyn" : ".rel.dyn";
isdyn = 1; isdyn = 1;
@ -2084,7 +2084,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
/* If this is a final link, then always put .gnu.warning.SYMBOL /* If this is a final link, then always put .gnu.warning.SYMBOL
sections into the .text section to get them out of the way. */ sections into the .text section to get them out of the way. */
if (bfd_link_executable (&link_info) if (bfd_link_executable (&link_info)
&& CONST_STRNEQ (s->name, ".gnu.warning.") && startswith (s->name, ".gnu.warning.")
&& hold[orphan_text].os != NULL) && hold[orphan_text].os != NULL)
{ {
os = hold[orphan_text].os; os = hold[orphan_text].os;
@ -2124,7 +2124,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
else if ((flags & SEC_LOAD) != 0 else if ((flags & SEC_LOAD) != 0
&& (elfinput && (elfinput
? sh_type == SHT_NOTE ? sh_type == SHT_NOTE
: CONST_STRNEQ (secname, ".note"))) : startswith (secname, ".note")))
place = &hold[orphan_interp]; place = &hold[orphan_interp];
else if ((flags & (SEC_LOAD | SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) == 0) else if ((flags & (SEC_LOAD | SEC_HAS_CONTENTS | SEC_THREAD_LOCAL)) == 0)
place = &hold[orphan_bss]; place = &hold[orphan_bss];
@ -2137,7 +2137,7 @@ ldelf_place_orphan (asection *s, const char *secname, int constraint)
else if ((flags & SEC_LOAD) != 0 else if ((flags & SEC_LOAD) != 0
&& (elfinput && (elfinput
? sh_type == SHT_RELA || sh_type == SHT_REL ? sh_type == SHT_RELA || sh_type == SHT_REL
: CONST_STRNEQ (secname, ".rel"))) : startswith (secname, ".rel")))
place = &hold[orphan_rel]; place = &hold[orphan_rel];
else if ((flags & SEC_CODE) == 0) else if ((flags & SEC_CODE) == 0)
place = &hold[orphan_rodata]; place = &hold[orphan_rodata];

View File

@ -113,7 +113,7 @@ ldfile_add_library_path (const char *name, bfd_boolean cmdline)
now. */ now. */
if (name[0] == '=') if (name[0] == '=')
new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL); new_dirs->name = concat (ld_sysroot, name + 1, (const char *) NULL);
else if (CONST_STRNEQ (name, "$SYSROOT")) else if (startswith (name, "$SYSROOT"))
new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL); new_dirs->name = concat (ld_sysroot, name + strlen ("$SYSROOT"), (const char *) NULL);
else else
new_dirs->name = xstrdup (name); new_dirs->name = xstrdup (name);

View File

@ -1186,7 +1186,7 @@ lang_add_input_file (const char *name,
const char *target) const char *target)
{ {
if (name != NULL if (name != NULL
&& (*name == '=' || CONST_STRNEQ (name, "$SYSROOT"))) && (*name == '=' || startswith (name, "$SYSROOT")))
{ {
lang_input_statement_type *ret; lang_input_statement_type *ret;
char *sysrooted_name char *sysrooted_name

View File

@ -648,7 +648,7 @@ get_sysroot (int argc, char **argv)
const char *path = NULL; const char *path = NULL;
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
if (CONST_STRNEQ (argv[i], "--sysroot=")) if (startswith (argv[i], "--sysroot="))
path = argv[i] + strlen ("--sysroot="); path = argv[i] + strlen ("--sysroot=");
if (!path) if (!path)
@ -681,7 +681,7 @@ get_emulation (int argc, char **argv)
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
if (CONST_STRNEQ (argv[i], "-m")) if (startswith (argv[i], "-m"))
{ {
if (argv[i][2] == '\0') if (argv[i][2] == '\0')
{ {
@ -935,7 +935,7 @@ add_archive_element (struct bfd_link_info *info,
h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE); h = bfd_link_hash_lookup (info->hash, name, FALSE, FALSE, TRUE);
if (h == NULL if (h == NULL
&& info->pei386_auto_import && info->pei386_auto_import
&& CONST_STRNEQ (name, "__imp_")) && startswith (name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE); h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
if (h == NULL) if (h == NULL)

View File

@ -281,7 +281,7 @@ build_link_order (lang_statement_union_type *statement)
static bfd_boolean static bfd_boolean
unsplittable_name (const char *name) unsplittable_name (const char *name)
{ {
if (CONST_STRNEQ (name, ".stab")) if (startswith (name, ".stab"))
{ {
/* There are several stab like string sections. We pattern match on /* There are several stab like string sections. We pattern match on
".stab...str" */ ".stab...str" */
@ -326,7 +326,7 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count)
{ {
/* Some section names cannot be truncated, as the name is /* Some section names cannot be truncated, as the name is
used to locate some other section. */ used to locate some other section. */
if (CONST_STRNEQ (name, ".stab") if (startswith (name, ".stab")
|| strcmp (name, "$GDB_SYMBOLS$") == 0) || strcmp (name, "$GDB_SYMBOLS$") == 0)
{ {
einfo (_ ("%F%P: cannot create split section name for %s\n"), name); einfo (_ ("%F%P: cannot create split section name for %s\n"), name);

View File

@ -1560,7 +1560,7 @@ parse_args (unsigned argc, char **argv)
link_info.discard = discard_all; link_info.discard = discard_all;
break; break;
case 'Y': case 'Y':
if (CONST_STRNEQ (optarg, "P,")) if (startswith (optarg, "P,"))
optarg += 2; optarg += 2;
free (default_dirlist); free (default_dirlist);
default_dirlist = xstrdup (optarg); default_dirlist = xstrdup (optarg);

View File

@ -545,7 +545,7 @@ pe_dll_add_excludes (const char *new_excludes, const exclude_type type)
static bfd_boolean static bfd_boolean
is_import (const char* n) is_import (const char* n)
{ {
return (CONST_STRNEQ (n, "__imp_")); return (startswith (n, "__imp_"));
} }
/* abfd is a bfd containing n (or NULL) /* abfd is a bfd containing n (or NULL)
@ -3531,7 +3531,7 @@ pe_implied_import_dll (const char *filename)
/* Skip unwanted symbols, which are /* Skip unwanted symbols, which are
exported in buggy auto-import releases. */ exported in buggy auto-import releases. */
if (! CONST_STRNEQ (erva + name_rva, "__nm_")) if (! startswith (erva + name_rva, "__nm_"))
{ {
int is_dup = 0; int is_dup = 0;
/* is_data is true if the address is in the data, rdata or bss /* is_data is true if the address is in the data, rdata or bss

View File

@ -1,3 +1,21 @@
2021-03-22 Martin Liska <mliska@suse.cz>
* aarch64-dis.c (parse_aarch64_dis_option): Replace usage of CONST_STRNEQ with startswith.
* arc-dis.c (parse_option): Likewise.
* arm-dis.c (parse_arm_disassembler_options): Likewise.
* cris-dis.c (print_with_operands): Likewise.
* h8300-dis.c (bfd_h8_disassemble): Likewise.
* i386-dis.c (print_insn): Likewise.
* ia64-gen.c (fetch_insn_class): Likewise.
(parse_resource_users): Likewise.
(in_iclass): Likewise.
(lookup_specifier): Likewise.
(insert_opcode_dependencies): Likewise.
* mips-dis.c (parse_mips_ase_option): Likewise.
(parse_mips_dis_option): Likewise.
* s390-dis.c (disassemble_init_s390): Likewise.
* wasm32-dis.c (parse_wasm32_disassembler_options): Likewise.
2021-03-16 Kuan-Lin Chen <kuanlinchentw@gmail.com> 2021-03-16 Kuan-Lin Chen <kuanlinchentw@gmail.com>
* riscv-opc.c (riscv_opcodes): Add zba, zbb and zbc instructions. * riscv-opc.c (riscv_opcodes): Add zba, zbb and zbc instructions.

View File

@ -58,32 +58,32 @@ static void
parse_aarch64_dis_option (const char *option, unsigned int len ATTRIBUTE_UNUSED) parse_aarch64_dis_option (const char *option, unsigned int len ATTRIBUTE_UNUSED)
{ {
/* Try to match options that are simple flags */ /* Try to match options that are simple flags */
if (CONST_STRNEQ (option, "no-aliases")) if (startswith (option, "no-aliases"))
{ {
no_aliases = 1; no_aliases = 1;
return; return;
} }
if (CONST_STRNEQ (option, "aliases")) if (startswith (option, "aliases"))
{ {
no_aliases = 0; no_aliases = 0;
return; return;
} }
if (CONST_STRNEQ (option, "no-notes")) if (startswith (option, "no-notes"))
{ {
no_notes = 1; no_notes = 1;
return; return;
} }
if (CONST_STRNEQ (option, "notes")) if (startswith (option, "notes"))
{ {
no_notes = 0; no_notes = 0;
return; return;
} }
#ifdef DEBUG_AARCH64 #ifdef DEBUG_AARCH64
if (CONST_STRNEQ (option, "debug_dump")) if (startswith (option, "debug_dump"))
{ {
debug_dump = 1; debug_dump = 1;
return; return;

View File

@ -795,7 +795,7 @@ parse_option (const char *option)
add_to_decodelist (FLOAT, DP); add_to_decodelist (FLOAT, DP);
add_to_decodelist (FLOAT, CVT); add_to_decodelist (FLOAT, CVT);
} }
else if (CONST_STRNEQ (option, "hex")) else if (startswith (option, "hex"))
print_hex = TRUE; print_hex = TRUE;
else else
/* xgettext:c-format */ /* xgettext:c-format */

View File

@ -11600,7 +11600,7 @@ parse_arm_disassembler_options (const char *options)
FOR_EACH_DISASSEMBLER_OPTION (opt, options) FOR_EACH_DISASSEMBLER_OPTION (opt, options)
{ {
if (CONST_STRNEQ (opt, "reg-names-")) if (startswith (opt, "reg-names-"))
{ {
unsigned int i; unsigned int i;
for (i = 0; i < NUM_ARM_OPTIONS; i++) for (i = 0; i < NUM_ARM_OPTIONS; i++)
@ -11615,11 +11615,11 @@ parse_arm_disassembler_options (const char *options)
opcodes_error_handler (_("unrecognised register name set: %s"), opcodes_error_handler (_("unrecognised register name set: %s"),
opt); opt);
} }
else if (CONST_STRNEQ (opt, "force-thumb")) else if (startswith (opt, "force-thumb"))
force_thumb = 1; force_thumb = 1;
else if (CONST_STRNEQ (opt, "no-force-thumb")) else if (startswith (opt, "no-force-thumb"))
force_thumb = 0; force_thumb = 0;
else if (CONST_STRNEQ (opt, "coproc")) else if (startswith (opt, "coproc"))
{ {
const char *procptr = opt + sizeof ("coproc") - 1; const char *procptr = opt + sizeof ("coproc") - 1;
char *endptr; char *endptr;
@ -11637,10 +11637,10 @@ parse_arm_disassembler_options (const char *options)
continue; continue;
} }
endptr += 1; endptr += 1;
if (CONST_STRNEQ (endptr, "generic")) if (startswith (endptr, "generic"))
cde_coprocs &= ~(1 << coproc_number); cde_coprocs &= ~(1 << coproc_number);
else if (CONST_STRNEQ (endptr, "cde") else if (startswith (endptr, "cde")
|| CONST_STRNEQ (endptr, "CDE")) || startswith (endptr, "CDE"))
cde_coprocs |= (1 << coproc_number); cde_coprocs |= (1 << coproc_number);
else else
{ {

View File

@ -786,7 +786,7 @@ print_with_operands (const struct cris_opcode *opcodep,
better way). */ better way). */
if (opcodep->name[0] == 'j') if (opcodep->name[0] == 'j')
{ {
if (CONST_STRNEQ (opcodep->name, "jsr")) if (startswith (opcodep->name, "jsr"))
/* It's "jsr" or "jsrc". */ /* It's "jsr" or "jsrc". */
info->insn_type = dis_jsr; info->insn_type = dis_jsr;
else else
@ -1360,16 +1360,16 @@ print_with_operands (const struct cris_opcode *opcodep,
itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */ itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */
if (TRACE_CASE && case_offset_counter == 0) if (TRACE_CASE && case_offset_counter == 0)
{ {
if (CONST_STRNEQ (opcodep->name, "sub")) if (startswith (opcodep->name, "sub"))
case_offset = last_immediate; case_offset = last_immediate;
/* It could also be an "add", if there are negative case-values. */ /* It could also be an "add", if there are negative case-values. */
else if (CONST_STRNEQ (opcodep->name, "add")) else if (startswith (opcodep->name, "add"))
/* The first case is the negated operand to the add. */ /* The first case is the negated operand to the add. */
case_offset = -last_immediate; case_offset = -last_immediate;
/* A bound insn will tell us the number of cases. */ /* A bound insn will tell us the number of cases. */
else if (CONST_STRNEQ (opcodep->name, "bound")) else if (startswith (opcodep->name, "bound"))
no_of_case_offsets = last_immediate + 1; no_of_case_offsets = last_immediate + 1;
/* A jump or jsr or branch breaks the chain of insns for a /* A jump or jsr or branch breaks the chain of insns for a

View File

@ -655,7 +655,7 @@ bfd_h8_disassemble (bfd_vma addr, disassemble_info *info, int mach)
regno[1]); regno[1]);
return qi->length; return qi->length;
} }
if (CONST_STRNEQ (q->name, "mova")) if (startswith (q->name, "mova"))
{ {
const op_type *args = q->args.nib; const op_type *args = q->args.nib;

View File

@ -9413,38 +9413,38 @@ print_insn (bfd_vma pc, disassemble_info *info)
for (p = info->disassembler_options; p != NULL; ) for (p = info->disassembler_options; p != NULL; )
{ {
if (CONST_STRNEQ (p, "amd64")) if (startswith (p, "amd64"))
isa64 = amd64; isa64 = amd64;
else if (CONST_STRNEQ (p, "intel64")) else if (startswith (p, "intel64"))
isa64 = intel64; isa64 = intel64;
else if (CONST_STRNEQ (p, "x86-64")) else if (startswith (p, "x86-64"))
{ {
address_mode = mode_64bit; address_mode = mode_64bit;
priv.orig_sizeflag |= AFLAG | DFLAG; priv.orig_sizeflag |= AFLAG | DFLAG;
} }
else if (CONST_STRNEQ (p, "i386")) else if (startswith (p, "i386"))
{ {
address_mode = mode_32bit; address_mode = mode_32bit;
priv.orig_sizeflag |= AFLAG | DFLAG; priv.orig_sizeflag |= AFLAG | DFLAG;
} }
else if (CONST_STRNEQ (p, "i8086")) else if (startswith (p, "i8086"))
{ {
address_mode = mode_16bit; address_mode = mode_16bit;
priv.orig_sizeflag &= ~(AFLAG | DFLAG); priv.orig_sizeflag &= ~(AFLAG | DFLAG);
} }
else if (CONST_STRNEQ (p, "intel")) else if (startswith (p, "intel"))
{ {
intel_syntax = 1; intel_syntax = 1;
if (CONST_STRNEQ (p + 5, "-mnemonic")) if (startswith (p + 5, "-mnemonic"))
intel_mnemonic = 1; intel_mnemonic = 1;
} }
else if (CONST_STRNEQ (p, "att")) else if (startswith (p, "att"))
{ {
intel_syntax = 0; intel_syntax = 0;
if (CONST_STRNEQ (p + 3, "-mnemonic")) if (startswith (p + 3, "-mnemonic"))
intel_mnemonic = 0; intel_mnemonic = 0;
} }
else if (CONST_STRNEQ (p, "addr")) else if (startswith (p, "addr"))
{ {
if (address_mode == mode_64bit) if (address_mode == mode_64bit)
{ {
@ -9461,14 +9461,14 @@ print_insn (bfd_vma pc, disassemble_info *info)
priv.orig_sizeflag |= AFLAG; priv.orig_sizeflag |= AFLAG;
} }
} }
else if (CONST_STRNEQ (p, "data")) else if (startswith (p, "data"))
{ {
if (p[4] == '1' && p[5] == '6') if (p[4] == '1' && p[5] == '6')
priv.orig_sizeflag &= ~DFLAG; priv.orig_sizeflag &= ~DFLAG;
else if (p[4] == '3' && p[5] == '2') else if (p[4] == '3' && p[5] == '2')
priv.orig_sizeflag |= DFLAG; priv.orig_sizeflag |= DFLAG;
} }
else if (CONST_STRNEQ (p, "suffix")) else if (startswith (p, "suffix"))
priv.orig_sizeflag |= SUFFIX_ALWAYS; priv.orig_sizeflag |= SUFFIX_ALWAYS;
p = strchr (p, ','); p = strchr (p, ',');

View File

@ -467,7 +467,7 @@ fetch_insn_class (const char *full_name, int create)
int ind; int ind;
int is_class = 0; int is_class = 0;
if (CONST_STRNEQ (full_name, "IC:")) if (startswith (full_name, "IC:"))
{ {
name = xstrdup (full_name + 3); name = xstrdup (full_name + 3);
is_class = 1; is_class = 1;
@ -746,7 +746,7 @@ parse_resource_users (const char *ref, int **usersp, int *nusersp,
are read. Only create new classes if it's *not* an insn class, are read. Only create new classes if it's *not* an insn class,
or if it's a composite class (which wouldn't necessarily be in the IC or if it's a composite class (which wouldn't necessarily be in the IC
table). */ table). */
if (! CONST_STRNEQ (name, "IC:") || xsect != NULL) if (! startswith (name, "IC:") || xsect != NULL)
create = 1; create = 1;
iclass = fetch_insn_class (name, create); iclass = fetch_insn_class (name, create);
@ -1039,7 +1039,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
if (ic->comment) if (ic->comment)
{ {
if (CONST_STRNEQ (ic->comment, "Format")) if (startswith (ic->comment, "Format"))
{ {
/* Assume that the first format seen is the most restrictive, and /* Assume that the first format seen is the most restrictive, and
only keep a later one if it looks like it's more restrictive. */ only keep a later one if it looks like it's more restrictive. */
@ -1055,7 +1055,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
else else
format = ic->comment; format = ic->comment;
} }
else if (CONST_STRNEQ (ic->comment, "Field")) else if (startswith (ic->comment, "Field"))
{ {
if (field) if (field)
warn (_("overlapping field %s->%s\n"), warn (_("overlapping field %s->%s\n"),
@ -1069,7 +1069,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
instructions. */ instructions. */
if (ic->nsubs == 0 && ic->nxsubs == 0) if (ic->nsubs == 0 && ic->nxsubs == 0)
{ {
int is_mov = CONST_STRNEQ (idesc->name, "mov"); int is_mov = startswith (idesc->name, "mov");
int plain_mov = strcmp (idesc->name, "mov") == 0; int plain_mov = strcmp (idesc->name, "mov") == 0;
int len = strlen(ic->name); int len = strlen(ic->name);
@ -1128,32 +1128,32 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
if (resolved && format) if (resolved && format)
{ {
if (CONST_STRNEQ (idesc->name, "dep") if (startswith (idesc->name, "dep")
&& strstr (format, "I13") != NULL) && strstr (format, "I13") != NULL)
resolved = idesc->operands[1] == IA64_OPND_IMM8; resolved = idesc->operands[1] == IA64_OPND_IMM8;
else if (CONST_STRNEQ (idesc->name, "chk") else if (startswith (idesc->name, "chk")
&& strstr (format, "M21") != NULL) && strstr (format, "M21") != NULL)
resolved = idesc->operands[0] == IA64_OPND_F2; resolved = idesc->operands[0] == IA64_OPND_F2;
else if (CONST_STRNEQ (idesc->name, "lfetch")) else if (startswith (idesc->name, "lfetch"))
resolved = (strstr (format, "M14 M15") != NULL resolved = (strstr (format, "M14 M15") != NULL
&& (idesc->operands[1] == IA64_OPND_R2 && (idesc->operands[1] == IA64_OPND_R2
|| idesc->operands[1] == IA64_OPND_IMM9b)); || idesc->operands[1] == IA64_OPND_IMM9b));
else if (CONST_STRNEQ (idesc->name, "br.call") else if (startswith (idesc->name, "br.call")
&& strstr (format, "B5") != NULL) && strstr (format, "B5") != NULL)
resolved = idesc->operands[1] == IA64_OPND_B2; resolved = idesc->operands[1] == IA64_OPND_B2;
else if (CONST_STRNEQ (idesc->name, "br.call") else if (startswith (idesc->name, "br.call")
&& strstr (format, "B3") != NULL) && strstr (format, "B3") != NULL)
resolved = idesc->operands[1] == IA64_OPND_TGT25c; resolved = idesc->operands[1] == IA64_OPND_TGT25c;
else if (CONST_STRNEQ (idesc->name, "brp") else if (startswith (idesc->name, "brp")
&& strstr (format, "B7") != NULL) && strstr (format, "B7") != NULL)
resolved = idesc->operands[0] == IA64_OPND_B2; resolved = idesc->operands[0] == IA64_OPND_B2;
else if (strcmp (ic->name, "invala") == 0) else if (strcmp (ic->name, "invala") == 0)
resolved = strcmp (idesc->name, ic->name) == 0; resolved = strcmp (idesc->name, ic->name) == 0;
else if (CONST_STRNEQ (idesc->name, "st") else if (startswith (idesc->name, "st")
&& (strstr (format, "M5") != NULL && (strstr (format, "M5") != NULL
|| strstr (format, "M10") != NULL)) || strstr (format, "M10") != NULL))
resolved = idesc->flags & IA64_OPCODE_POSTINC; resolved = idesc->flags & IA64_OPCODE_POSTINC;
else if (CONST_STRNEQ (idesc->name, "ld") else if (startswith (idesc->name, "ld")
&& (strstr (format, "M2 M3") != NULL && (strstr (format, "M2 M3") != NULL
|| strstr (format, "M12") != NULL || strstr (format, "M12") != NULL
|| strstr (format, "M7 M8") != NULL)) || strstr (format, "M7 M8") != NULL))
@ -1166,7 +1166,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
plain brl matches brl.cond. */ plain brl matches brl.cond. */
if (!resolved if (!resolved
&& (strcmp (idesc->name, "brl") == 0 && (strcmp (idesc->name, "brl") == 0
|| CONST_STRNEQ (idesc->name, "brl.")) || startswith (idesc->name, "brl."))
&& strcmp (ic->name, "brl.cond") == 0) && strcmp (ic->name, "brl.cond") == 0)
{ {
resolved = 1; resolved = 1;
@ -1175,7 +1175,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
/* Misc br variations ('.cond' is optional). */ /* Misc br variations ('.cond' is optional). */
if (!resolved if (!resolved
&& (strcmp (idesc->name, "br") == 0 && (strcmp (idesc->name, "br") == 0
|| CONST_STRNEQ (idesc->name, "br.")) || startswith (idesc->name, "br."))
&& strcmp (ic->name, "br.cond") == 0) && strcmp (ic->name, "br.cond") == 0)
{ {
if (format) if (format)
@ -1188,7 +1188,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
} }
/* probe variations. */ /* probe variations. */
if (!resolved && CONST_STRNEQ (idesc->name, "probe")) if (!resolved && startswith (idesc->name, "probe"))
{ {
resolved = strcmp (ic->name, "probe") == 0 resolved = strcmp (ic->name, "probe") == 0
&& !((strstr (idesc->name, "fault") != NULL) && !((strstr (idesc->name, "fault") != NULL)
@ -1222,7 +1222,7 @@ in_iclass (struct ia64_opcode *idesc, struct iclass *ic,
} }
/* Some variants of mov and mov.[im]. */ /* Some variants of mov and mov.[im]. */
if (!resolved && CONST_STRNEQ (ic->name, "mov_")) if (!resolved && startswith (ic->name, "mov_"))
resolved = in_iclass_mov_x (idesc, ic, format, field); resolved = in_iclass_mov_x (idesc, ic, format, field);
} }
@ -1487,13 +1487,13 @@ lookup_specifier (const char *name)
warn (_("Don't know how to specify # dependency %s\n"), warn (_("Don't know how to specify # dependency %s\n"),
name); name);
} }
else if (CONST_STRNEQ (name, "AR[FPSR]")) else if (startswith (name, "AR[FPSR]"))
return IA64_RS_AR_FPSR; return IA64_RS_AR_FPSR;
else if (CONST_STRNEQ (name, "AR[")) else if (startswith (name, "AR["))
return IA64_RS_ARX; return IA64_RS_ARX;
else if (CONST_STRNEQ (name, "CR[")) else if (startswith (name, "CR["))
return IA64_RS_CRX; return IA64_RS_CRX;
else if (CONST_STRNEQ (name, "PSR.")) else if (startswith (name, "PSR."))
return IA64_RS_PSR; return IA64_RS_PSR;
else if (strcmp (name, "InService*") == 0) else if (strcmp (name, "InService*") == 0)
return IA64_RS_INSERVICE; return IA64_RS_INSERVICE;
@ -2444,7 +2444,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc,
int j; int j;
if (strcmp (opc->name, "cmp.eq.and") == 0 if (strcmp (opc->name, "cmp.eq.and") == 0
&& CONST_STRNEQ (rs->name, "PR%") && startswith (rs->name, "PR%")
&& rs->mode == 1) && rs->mode == 1)
no_class_found = 99; no_class_found = 99;
@ -2455,7 +2455,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc,
if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note)) if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note))
{ {
/* We can ignore ic_note 11 for non PR resources. */ /* We can ignore ic_note 11 for non PR resources. */
if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR")) if (ic_note == 11 && ! startswith (rs->name, "PR"))
ic_note = 0; ic_note = 0;
if (ic_note != 0 && rs->regnotes[j] != 0 if (ic_note != 0 && rs->regnotes[j] != 0
@ -2483,7 +2483,7 @@ insert_opcode_dependencies (struct ia64_opcode *opc,
if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note)) if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note))
{ {
/* We can ignore ic_note 11 for non PR resources. */ /* We can ignore ic_note 11 for non PR resources. */
if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR")) if (ic_note == 11 && ! startswith (rs->name, "PR"))
ic_note = 0; ic_note = 0;
if (ic_note != 0 && rs->chknotes[j] != 0 if (ic_note != 0 && rs->chknotes[j] != 0

View File

@ -923,7 +923,7 @@ set_default_mips_dis_options (struct disassemble_info *info)
static bfd_boolean static bfd_boolean
parse_mips_ase_option (const char *option) parse_mips_ase_option (const char *option)
{ {
if (CONST_STRNEQ (option, "msa")) if (startswith (option, "msa"))
{ {
mips_ase |= ASE_MSA; mips_ase |= ASE_MSA;
if ((mips_isa & INSN_ISA_MASK) == ISA_MIPS64R2 if ((mips_isa & INSN_ISA_MASK) == ISA_MIPS64R2
@ -934,7 +934,7 @@ parse_mips_ase_option (const char *option)
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "virt")) if (startswith (option, "virt"))
{ {
mips_ase |= ASE_VIRT; mips_ase |= ASE_VIRT;
if (mips_isa & ISA_MIPS64R2 if (mips_isa & ISA_MIPS64R2
@ -945,38 +945,38 @@ parse_mips_ase_option (const char *option)
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "xpa")) if (startswith (option, "xpa"))
{ {
mips_ase |= ASE_XPA; mips_ase |= ASE_XPA;
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "ginv")) if (startswith (option, "ginv"))
{ {
mips_ase |= ASE_GINV; mips_ase |= ASE_GINV;
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "loongson-mmi")) if (startswith (option, "loongson-mmi"))
{ {
mips_ase |= ASE_LOONGSON_MMI; mips_ase |= ASE_LOONGSON_MMI;
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "loongson-cam")) if (startswith (option, "loongson-cam"))
{ {
mips_ase |= ASE_LOONGSON_CAM; mips_ase |= ASE_LOONGSON_CAM;
return TRUE; return TRUE;
} }
/* Put here for match ext2 frist */ /* Put here for match ext2 frist */
if (CONST_STRNEQ (option, "loongson-ext2")) if (startswith (option, "loongson-ext2"))
{ {
mips_ase |= ASE_LOONGSON_EXT2; mips_ase |= ASE_LOONGSON_EXT2;
return TRUE; return TRUE;
} }
if (CONST_STRNEQ (option, "loongson-ext")) if (startswith (option, "loongson-ext"))
{ {
mips_ase |= ASE_LOONGSON_EXT; mips_ase |= ASE_LOONGSON_EXT;
return TRUE; return TRUE;
@ -994,7 +994,7 @@ parse_mips_dis_option (const char *option, unsigned int len)
const struct mips_arch_choice *chosen_arch; const struct mips_arch_choice *chosen_arch;
/* Try to match options that are simple flags */ /* Try to match options that are simple flags */
if (CONST_STRNEQ (option, "no-aliases")) if (startswith (option, "no-aliases"))
{ {
no_aliases = 1; no_aliases = 1;
return; return;

View File

@ -65,11 +65,11 @@ disassemble_init_s390 (struct disassemble_info *info)
for (p = info->disassembler_options; p != NULL; ) for (p = info->disassembler_options; p != NULL; )
{ {
if (CONST_STRNEQ (p, "esa")) if (startswith (p, "esa"))
current_arch_mask = 1 << S390_OPCODE_ESA; current_arch_mask = 1 << S390_OPCODE_ESA;
else if (CONST_STRNEQ (p, "zarch")) else if (startswith (p, "zarch"))
current_arch_mask = 1 << S390_OPCODE_ZARCH; current_arch_mask = 1 << S390_OPCODE_ZARCH;
else if (CONST_STRNEQ (p, "insnlength")) else if (startswith (p, "insnlength"))
option_use_insn_len_bits_p = 1; option_use_insn_len_bits_p = 1;
else else
/* xgettext:c-format */ /* xgettext:c-format */

View File

@ -120,9 +120,9 @@ parse_wasm32_disassembler_options (struct disassemble_info *info,
while (opts != NULL) while (opts != NULL)
{ {
if (CONST_STRNEQ (opts, "registers")) if (startswith (opts, "registers"))
private->print_registers = TRUE; private->print_registers = TRUE;
else if (CONST_STRNEQ (opts, "globals")) else if (startswith (opts, "globals"))
private->print_well_known_globals = TRUE; private->print_well_known_globals = TRUE;
opts = strchr (opts, ','); opts = strchr (opts, ',');