aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog101
-rw-r--r--bfd/archive.c18
-rw-r--r--bfd/archive64.c4
-rw-r--r--bfd/bfd-in.h12
-rw-r--r--bfd/bfd-in2.h12
-rw-r--r--bfd/bfd.c8
-rw-r--r--bfd/coff-stgo32.c4
-rw-r--r--bfd/coffcode.h58
-rw-r--r--bfd/coffgen.c16
-rw-r--r--bfd/cofflink.c12
-rw-r--r--bfd/compress.c4
-rw-r--r--bfd/dwarf2.c8
-rw-r--r--bfd/ecoff.c2
-rw-r--r--bfd/elf-m10300.c4
-rw-r--r--bfd/elf.c6
-rw-r--r--bfd/elf32-arm.c12
-rw-r--r--bfd/elf32-bfin.c4
-rw-r--r--bfd/elf32-cr16.c4
-rw-r--r--bfd/elf32-cris.c4
-rw-r--r--bfd/elf32-csky.c2
-rw-r--r--bfd/elf32-hppa.c2
-rw-r--r--bfd/elf32-iq2000.c6
-rw-r--r--bfd/elf32-lm32.c2
-rw-r--r--bfd/elf32-m32r.c2
-rw-r--r--bfd/elf32-m68k.c4
-rw-r--r--bfd/elf32-metag.c2
-rw-r--r--bfd/elf32-msp430.c4
-rw-r--r--bfd/elf32-nios2.c2
-rw-r--r--bfd/elf32-or1k.c2
-rw-r--r--bfd/elf32-ppc.c2
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-score.c6
-rw-r--r--bfd/elf32-score7.c6
-rw-r--r--bfd/elf32-sh.c2
-rw-r--r--bfd/elf32-tic6x.c6
-rw-r--r--bfd/elf32-vax.c4
-rw-r--r--bfd/elf32-xtensa.c22
-rw-r--r--bfd/elf64-alpha.c6
-rw-r--r--bfd/elf64-hppa.c4
-rw-r--r--bfd/elf64-ia64-vms.c14
-rw-r--r--bfd/elf64-mmix.c2
-rw-r--r--bfd/elf64-ppc.c2
-rw-r--r--bfd/elf64-s390.c2
-rw-r--r--bfd/elflink.c14
-rw-r--r--bfd/elfnn-aarch64.c2
-rw-r--r--bfd/elfnn-ia64.c10
-rw-r--r--bfd/elfxx-mips.c52
-rw-r--r--bfd/elfxx-sparc.c2
-rw-r--r--bfd/elfxx-x86.c4
-rw-r--r--bfd/hpux-core.c2
-rw-r--r--bfd/libcoff.h2
-rw-r--r--bfd/linker.c8
-rw-r--r--bfd/mmo.c2
-rw-r--r--bfd/osf-core.c2
-rw-r--r--bfd/pef.c2
-rw-r--r--bfd/pei-x86_64.c2
-rw-r--r--bfd/som.c6
-rw-r--r--bfd/wasm-module.c2
58 files changed, 297 insertions, 216 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6cdf3ac..c4172eb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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>
* peXXigen.c (_bfd_XXi_swap_scnhdr_out): Add missing
diff --git a/bfd/archive.c b/bfd/archive.c
index 81ef62f..2a9ca56 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -1175,12 +1175,12 @@ bfd_slurp_armap (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (CONST_STRNEQ (nextname, "__.SYMDEF ")
- || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
+ if (startswith (nextname, "__.SYMDEF ")
+ || startswith (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- else if (CONST_STRNEQ (nextname, "/ "))
+ else if (startswith (nextname, "/ "))
return do_slurp_coff_armap (abfd);
- else if (CONST_STRNEQ (nextname, "/SYM64/ "))
+ else if (startswith (nextname, "/SYM64/ "))
{
/* 64bit (Irix 6) archive. */
#ifdef BFD64
@@ -1190,7 +1190,7 @@ bfd_slurp_armap (bfd *abfd)
return FALSE;
#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.
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)
return FALSE;
extname[20] = 0;
- if (CONST_STRNEQ (extname, "__.SYMDEF SORTED")
- || CONST_STRNEQ (extname, "__.SYMDEF"))
+ if (startswith (extname, "__.SYMDEF SORTED")
+ || startswith (extname, "__.SYMDEF"))
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)
return FALSE;
- if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ")
- && ! CONST_STRNEQ (nextname, "// "))
+ if (! startswith (nextname, "ARFILENAMES/ ")
+ && ! startswith (nextname, "// "))
{
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
diff --git a/bfd/archive64.c b/bfd/archive64.c
index 42e24cd..6d76b4d 100644
--- a/bfd/archive64.c
+++ b/bfd/archive64.c
@@ -62,10 +62,10 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
return FALSE;
/* Archives with traditional armaps are still permitted. */
- if (CONST_STRNEQ (nextname, "/ "))
+ if (startswith (nextname, "/ "))
return bfd_slurp_armap (abfd);
- if (! CONST_STRNEQ (nextname, "/SYM64/ "))
+ if (! startswith (nextname, "/SYM64/ "))
{
abfd->has_armap = FALSE;
return TRUE;
diff --git a/bfd/bfd-in.h b/bfd/bfd-in.h
index 453ac48..fda9fe0 100644
--- a/bfd/bfd-in.h
+++ b/bfd/bfd-in.h
@@ -56,15 +56,7 @@ extern "C" {
comma and then the length of the string. Doing this by hand
is error prone, so using this macro is safer. */
#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
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
@@ -72,7 +64,6 @@ extern "C" {
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
-
#define BFD_SUPPORTS_PLUGINS @supports_plugins@
/* 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;
}
-#define CONST_STRNEQ(STR1,STR2) startswith (STR1, STR2)
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index c8bf687..8874da8 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -63,15 +63,7 @@ extern "C" {
comma and then the length of the string. Doing this by hand
is error prone, so using this macro is safer. */
#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
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
@@ -79,7 +71,6 @@ extern "C" {
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
-
#define BFD_SUPPORTS_PLUGINS @supports_plugins@
/* 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;
}
-#define CONST_STRNEQ(STR1,STR2) startswith (STR1, STR2)
/* Extracted from init.c. */
unsigned int bfd_init (void);
diff --git a/bfd/bfd.c b/bfd/bfd.c
index 2c62085..757fa5f 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1746,7 +1746,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
no place to store this information in the COFF back end.
Should enough other COFF targets add support for DWARF2,
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, "pei-i386") == 0
|| strcmp (name, "pe-x86-64") == 0
@@ -1757,7 +1757,7 @@ bfd_get_sign_extend_vma (bfd *abfd)
|| strcmp (name, "aix5coff64-rs6000") == 0)
return 1;
- if (CONST_STRNEQ (name, "mach-o"))
+ if (startswith (name, "mach-o"))
return 0;
bfd_set_error (bfd_error_wrong_format);
@@ -2660,7 +2660,7 @@ bfd_convert_section_size (bfd *ibfd, sec_ptr isec, bfd *obfd,
return 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);
/* 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;
/* 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,
ptr_size);
diff --git a/bfd/coff-stgo32.c b/bfd/coff-stgo32.c
index 7593b62..8f75eec 100644
--- a/bfd/coff-stgo32.c
+++ b/bfd/coff-stgo32.c
@@ -176,7 +176,7 @@ go32exe_create_stub (bfd *abfd)
close (f);
goto stub_end;
}
- if (! CONST_STRNEQ (magic, "go32stub"))
+ if (! startswith (magic, "go32stub"))
{
close (f);
goto stub_end;
@@ -306,7 +306,7 @@ go32exe_check_format (bfd *abfd)
header_end = H_GET_16 (abfd, filehdr_dos.e_cparhdr) * 16UL;
if (go32exe_temp_stub_size < header_end
|| 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;
/* Set origin to where the COFF header starts and seek there. */
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index bcd34d4..d1ad669 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -527,8 +527,8 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
styp_flags = STYP_LIT;
#endif /* _LIT */
}
- else if (CONST_STRNEQ (sec_name, DOT_DEBUG)
- || CONST_STRNEQ (sec_name, DOT_ZDEBUG))
+ else if (startswith (sec_name, DOT_DEBUG)
+ || startswith (sec_name, DOT_ZDEBUG))
{
/* Handle the XCOFF debug section and DWARF2 debug sections. */
if (!sec_name[6])
@@ -536,13 +536,13 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
else
styp_flags = STYP_DEBUG_INFO;
}
- else if (CONST_STRNEQ (sec_name, ".stab"))
+ else if (startswith (sec_name, ".stab"))
{
styp_flags = STYP_DEBUG_INFO;
}
#ifdef COFF_LONG_SECTION_NAMES
- else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)
- || CONST_STRNEQ (sec_name, GNU_LINKONCE_WT))
+ else if (startswith (sec_name, GNU_LINKONCE_WI)
+ || startswith (sec_name, GNU_LINKONCE_WT))
{
styp_flags = STYP_DEBUG_INFO;
}
@@ -642,13 +642,13 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
long styp_flags = 0;
bfd_boolean is_dbg = FALSE;
- if (CONST_STRNEQ (sec_name, DOT_DEBUG)
- || CONST_STRNEQ (sec_name, DOT_ZDEBUG)
+ if (startswith (sec_name, DOT_DEBUG)
+ || startswith (sec_name, DOT_ZDEBUG)
#ifdef COFF_LONG_SECTION_NAMES
- || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)
- || CONST_STRNEQ (sec_name, GNU_LINKONCE_WT)
+ || startswith (sec_name, GNU_LINKONCE_WI)
+ || startswith (sec_name, GNU_LINKONCE_WT)
#endif
- || CONST_STRNEQ (sec_name, ".stab"))
+ || startswith (sec_name, ".stab"))
is_dbg = TRUE;
/* caution: there are at least three groups of symbols that have
@@ -843,16 +843,16 @@ styp_to_sec_flags (bfd *abfd,
#endif
sec_flags |= SEC_ALLOC;
}
- else if (CONST_STRNEQ (name, DOT_DEBUG)
- || CONST_STRNEQ (name, DOT_ZDEBUG)
+ else if (startswith (name, DOT_DEBUG)
+ || startswith (name, DOT_ZDEBUG)
#ifdef _COMMENT
|| strcmp (name, _COMMENT) == 0
#endif
#ifdef COFF_LONG_SECTION_NAMES
- || CONST_STRNEQ (name, GNU_LINKONCE_WI)
- || CONST_STRNEQ (name, GNU_LINKONCE_WT)
+ || startswith (name, GNU_LINKONCE_WI)
+ || startswith (name, GNU_LINKONCE_WT)
#endif
- || CONST_STRNEQ (name, ".stab"))
+ || startswith (name, ".stab"))
{
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
@@ -880,8 +880,8 @@ styp_to_sec_flags (bfd *abfd,
#endif /* STYP_SDATA */
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
- && (CONST_STRNEQ (name, ".sbss")
- || CONST_STRNEQ (name, ".sdata")))
+ && (startswith (name, ".sbss")
+ || startswith (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA;
#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
are permitted. The GNU linker extension is to actually discard
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;
#endif
@@ -1203,18 +1203,18 @@ styp_to_sec_flags (bfd *abfd,
bfd_boolean result = TRUE;
bfd_boolean is_dbg = FALSE;
- if (CONST_STRNEQ (name, DOT_DEBUG)
- || CONST_STRNEQ (name, DOT_ZDEBUG)
+ if (startswith (name, DOT_DEBUG)
+ || startswith (name, DOT_ZDEBUG)
#ifdef COFF_LONG_SECTION_NAMES
- || CONST_STRNEQ (name, GNU_LINKONCE_WI)
- || CONST_STRNEQ (name, GNU_LINKONCE_WT)
+ || startswith (name, GNU_LINKONCE_WI)
+ || startswith (name, GNU_LINKONCE_WT)
/* FIXME: These definitions ought to be in a header file. */
#define GNU_DEBUGLINK ".gnu_debuglink"
#define GNU_DEBUGALTLINK ".gnu_debugaltlink"
- || CONST_STRNEQ (name, GNU_DEBUGLINK)
- || CONST_STRNEQ (name, GNU_DEBUGALTLINK)
+ || startswith (name, GNU_DEBUGLINK)
+ || startswith (name, GNU_DEBUGALTLINK)
#endif
- || CONST_STRNEQ (name, ".stab"))
+ || startswith (name, ".stab"))
is_dbg = TRUE;
/* Assume read only unless IMAGE_SCN_MEM_WRITE is specified. */
sec_flags = SEC_READONLY;
@@ -1347,8 +1347,8 @@ styp_to_sec_flags (bfd *abfd,
}
if ((bfd_applicable_section_flags (abfd) & SEC_SMALL_DATA) != 0
- && (CONST_STRNEQ (name, ".sbss")
- || CONST_STRNEQ (name, ".sdata")))
+ && (startswith (name, ".sbss")
+ || startswith (name, ".sdata")))
sec_flags |= SEC_SMALL_DATA;
#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
are permitted. The GNU linker extension is to actually discard
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;
#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
. PE object file. *}
.#define bfd_pei_p(abfd) \
-. (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
+. (startswith ((abfd)->xvec->name, "pei-"))
*/
/* See whether the magic number matches. */
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 526e26c..f493978 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -2635,7 +2635,7 @@ _bfd_coff_section_already_linked (bfd *abfd,
key = s_comdat->name;
else
{
- if (CONST_STRNEQ (name, ".gnu.linkonce.")
+ if (startswith (name, ".gnu.linkonce.")
&& (key = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
key++;
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
|| (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0)
o->gc_mark = 1;
- else if (CONST_STRNEQ (o->name, ".idata")
- || CONST_STRNEQ (o->name, ".pdata")
- || CONST_STRNEQ (o->name, ".xdata")
- || CONST_STRNEQ (o->name, ".rsrc"))
+ else if (startswith (o->name, ".idata")
+ || startswith (o->name, ".pdata")
+ || startswith (o->name, ".xdata")
+ || startswith (o->name, ".rsrc"))
o->gc_mark = 1;
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)
{
if (((o->flags & (SEC_EXCLUDE | SEC_KEEP)) == SEC_KEEP
- || CONST_STRNEQ (o->name, ".vectors")
- || CONST_STRNEQ (o->name, ".ctors")
- || CONST_STRNEQ (o->name, ".dtors"))
+ || startswith (o->name, ".vectors")
+ || startswith (o->name, ".ctors")
+ || startswith (o->name, ".dtors"))
&& !o->gc_mark)
{
if (!_bfd_coff_gc_mark (info, o, _bfd_coff_gc_mark_hook))
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 874354a..05c6fff 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -397,7 +397,7 @@ coff_link_add_symbols (bfd *abfd,
|| classification == COFF_SYMBOL_PE_SECTION)
&& coff_section_data (abfd, section) != NULL
&& coff_section_data (abfd, section)->comdat != NULL
- && CONST_STRNEQ (name, "??_")
+ && startswith (name, "??_")
&& strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0)
{
if (*sym_hash == NULL)
@@ -546,7 +546,7 @@ coff_link_add_symbols (bfd *abfd,
asection *stab;
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] == '.' && ISDIGIT (stab->name[6]))))
{
@@ -1274,7 +1274,7 @@ process_embedded_commands (bfd *output_bfd,
s++;
continue;
}
- if (CONST_STRNEQ (s, "-attr"))
+ if (startswith (s, "-attr"))
{
char *name;
char *attribs;
@@ -1314,14 +1314,14 @@ process_embedded_commands (bfd *output_bfd,
asec->flags |= SEC_READONLY;
}
}
- else if (CONST_STRNEQ (s, "-heap"))
+ else if (startswith (s, "-heap"))
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);
/* 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
is too late to do anything here, after they have
diff --git a/bfd/compress.c b/bfd/compress.c
index 2e73c76..054ea08 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -431,7 +431,7 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
if (compression_header_size == 0)
/* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */
- compressed = CONST_STRNEQ ((char*) header , "ZLIB");
+ compressed = startswith ((char*) header , "ZLIB");
else
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
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);
return FALSE;
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index 1d5ddef..9f895b1 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -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)
- if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
+ if (startswith (msec->name, GNU_LINKONCE_INFO))
return msec;
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)
return msec;
- if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
+ if (startswith (msec->name, GNU_LINKONCE_INFO))
return msec;
}
@@ -4375,7 +4375,7 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash)
continue;
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)
&& !is_debug_info)
@@ -4419,7 +4419,7 @@ place_sections (bfd *orig_bfd, struct dwarf2_debug *stash)
continue;
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)
&& !is_debug_info)
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index 98a00e5..dc12b18 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -2866,7 +2866,7 @@ _bfd_ecoff_slurp_armap (bfd *abfd)
bfd_slurp_armap, but that seems inappropriate since no other
target uses this format. Instead, we check directly for a COFF
armap. */
- if (CONST_STRNEQ (nextname, "/ "))
+ if (startswith (nextname, "/ "))
return bfd_slurp_armap (abfd);
/* See if the first element is an armap. */
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 32aa0be..752c121 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -5070,7 +5070,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
/* Remember whether there is a PLT. */
;
}
- else if (CONST_STRNEQ (name, ".rela"))
+ else if (startswith (name, ".rela"))
{
if (s->size != 0)
{
@@ -5084,7 +5084,7 @@ _bfd_mn10300_elf_size_dynamic_sections (bfd * output_bfd,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& ! streq (name, ".dynbss"))
/* It's not one of our sections, so don't allocate space. */
continue;
diff --git a/bfd/elf.c b/bfd/elf.c
index 381951d..3f99270 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1113,7 +1113,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
The symbols will be defined as weak, so that multiple definitions
are permitted. The GNU linker extension is to actually discard
all but one of the sections. */
- if (CONST_STRNEQ (name, ".gnu.linkonce")
+ if (startswith (name, ".gnu.linkonce")
&& elf_next_in_group (newsect) == NULL)
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
but without the trailing ``str'', and set its sh_link
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)
{
size_t len;
@@ -10190,7 +10190,7 @@ elfcore_grok_win32pstatus (bfd *abfd, Elf_Internal_Note *note)
if (note->descsz < 4)
return TRUE;
- if (! CONST_STRNEQ (note->namedata, "win32"))
+ if (! startswith (note->namedata, "win32"))
return TRUE;
type = bfd_get_32 (abfd, note->descdata);
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index d3b412c..bf0be0c 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -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,
symtab_hdr->sh_link,
cmse_sym->st_name);
- if (!sym_name || !CONST_STRNEQ (sym_name, CMSE_PREFIX))
+ if (!sym_name || !startswith (sym_name, CMSE_PREFIX))
continue;
/* 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]);
sym_name = (char *) cmse_hash->root.root.root.string;
- if (!CONST_STRNEQ (sym_name, CMSE_PREFIX))
+ if (!startswith (sym_name, CMSE_PREFIX))
continue;
/* 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
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_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. */
;
}
- else if (CONST_STRNEQ (name, ".rel"))
+ else if (startswith (name, ".rel"))
{
if (s->size != 0)
{
@@ -17564,8 +17564,8 @@ elf32_arm_final_write_processing (bfd *abfd)
static bfd_boolean
is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
{
- return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind)
- || CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once));
+ return (startswith (name, ELF_STRING_ARM_unwind)
+ || startswith (name, ELF_STRING_ARM_unwind_once));
}
diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
index 401683c..a0cb166 100644
--- a/bfd/elf32-bfin.c
+++ b/bfd/elf32-bfin.c
@@ -5186,7 +5186,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
strip = FALSE;
- if (CONST_STRNEQ (name, ".rela"))
+ if (startswith (name, ".rela"))
{
if (s->size == 0)
{
@@ -5210,7 +5210,7 @@ bfin_size_dynamic_sections (bfd * output_bfd ATTRIBUTE_UNUSED,
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. */
continue;
diff --git a/bfd/elf32-cr16.c b/bfd/elf32-cr16.c
index 9c101cb..4c327d5 100644
--- a/bfd/elf32-cr16.c
+++ b/bfd/elf32-cr16.c
@@ -2439,7 +2439,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
/* Remember whether there is a PLT. */
;
}
- else if (CONST_STRNEQ (name, ".rela"))
+ else if (startswith (name, ".rela"))
{
if (s->size != 0)
{
@@ -2453,7 +2453,7 @@ _bfd_cr16_elf_size_dynamic_sections (bfd * output_bfd,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0)
/* It's not one of our sections, so don't allocate space. */
continue;
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 0228920..080f958 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -3593,7 +3593,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->size += htab->dtpmod_refcount != 0
? 8 : 0;
}
- else if (CONST_STRNEQ (name, ".rela"))
+ else if (startswith (name, ".rela"))
{
if (strcmp (name, ".rela.got") == 0
&& htab->dtpmod_refcount != 0
@@ -3612,7 +3612,7 @@ elf_cris_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0
&& s != htab->root.sdynrelro)
{
diff --git a/bfd/elf32-csky.c b/bfd/elf32-csky.c
index 0b776e5..4e6db39 100644
--- a/bfd/elf32-csky.c
+++ b/bfd/elf32-csky.c
@@ -2045,7 +2045,7 @@ csky_elf_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
if (htab->elf.hplt != NULL)
strip_section = FALSE;
}
- else if (CONST_STRNEQ (bfd_section_name (s), ".rel") )
+ else if (startswith (bfd_section_name (s), ".rel") )
{
if (s->size != 0 )
relocs = TRUE;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index e47af49..ec354c8 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -2232,7 +2232,7 @@ elf32_hppa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|| sec == htab->etab.sdynbss
|| 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)
{
diff --git a/bfd/elf32-iq2000.c b/bfd/elf32-iq2000.c
index e17b0c6..b29be24 100644
--- a/bfd/elf32-iq2000.c
+++ b/bfd/elf32-iq2000.c
@@ -507,9 +507,9 @@ iq2000_elf_check_relocs (bfd *abfd,
case R_IQ2000_32:
/* For debug section, change to special harvard-aware relocations. */
- if (CONST_STRNEQ (sec->name, ".debug")
- || CONST_STRNEQ (sec->name, ".stab")
- || CONST_STRNEQ (sec->name, ".eh_frame"))
+ if (startswith (sec->name, ".debug")
+ || startswith (sec->name, ".stab")
+ || startswith (sec->name, ".eh_frame"))
{
((Elf_Internal_Rela *) rel)->r_info
= ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);
diff --git a/bfd/elf32-lm32.c b/bfd/elf32-lm32.c
index fa0b2fc..9d72150 100644
--- a/bfd/elf32-lm32.c
+++ b/bfd/elf32-lm32.c
@@ -2020,7 +2020,7 @@ lm32_elf_size_dynamic_sections (bfd *output_bfd,
/* Strip this section if we don't need it; see the
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)
relocs = TRUE;
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index e73bbde..95e0c17 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 16aa591..f2222d0 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -3171,7 +3171,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Remember whether there is a PLT. */
;
}
- else if (CONST_STRNEQ (name, ".rela"))
+ else if (startswith (name, ".rela"))
{
if (s->size != 0)
{
@@ -3182,7 +3182,7 @@ elf_m68k_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
diff --git a/bfd/elf32-metag.c b/bfd/elf32-metag.c
index 6545363..ac6d379 100644
--- a/bfd/elf32-metag.c
+++ b/bfd/elf32-metag.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index 1aafa84..eebe74a 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -1855,8 +1855,8 @@ msp430_elf_relax_delete_bytes (bfd * abfd, asection * sec, bfd_vma addr,
the start of the next section. */
|| (isym->st_value == toaddr
&& name != NULL
- && (CONST_STRNEQ (name, ".Letext")
- || CONST_STRNEQ (name, ".LFE")))))
+ && (startswith (name, ".Letext")
+ || startswith (name, ".LFE")))))
{
if (debug_relocs)
printf (" adjusting value of local symbol %s from 0x%lx ",
diff --git a/bfd/elf32-nios2.c b/bfd/elf32-nios2.c
index c1727cc..c925bc9 100644
--- a/bfd/elf32-nios2.c
+++ b/bfd/elf32-nios2.c
@@ -5825,7 +5825,7 @@ nios2_elf32_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".rela"))
+ if (startswith (name, ".rela"))
{
if (s->size != 0)
{
diff --git a/bfd/elf32-or1k.c b/bfd/elf32-or1k.c
index 65938e5..82a5b4a 100644
--- a/bfd/elf32-or1k.c
+++ b/bfd/elf32-or1k.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 65f59a3..fe8b6fd 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -5812,7 +5812,7 @@ ppc_elf_size_dynamic_sections (bfd *output_bfd,
{
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)
{
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 0cc1edb..55e6103 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -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
comment below. */
}
- else if (CONST_STRNEQ (bfd_section_name (s), ".rela"))
+ else if (startswith (bfd_section_name (s), ".rela"))
{
if (s->size != 0)
relocs = TRUE;
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 50c7405..e34169e 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -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. */
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".rel"))
+ if (startswith (name, ".rel"))
{
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;
}
}
- else if (CONST_STRNEQ (name, ".got"))
+ else if (startswith (name, ".got"))
{
/* s3_bfd_score_elf_always_size_sections() has already done
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 */
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. */
continue;
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index 2f63ab8..9e1b7da 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -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. */
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".rel"))
+ if (startswith (name, ".rel"))
{
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;
}
}
- else if (CONST_STRNEQ (name, ".got"))
+ else if (startswith (name, ".got"))
{
/* s7_bfd_score_elf_always_size_sections() has already done
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 */
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. */
continue;
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 19375b0..1014550 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elf32-tic6x.c b/bfd/elf32-tic6x.c
index 3d0640e..53ec572 100644
--- a/bfd/elf32-tic6x.c
+++ b/bfd/elf32-tic6x.c
@@ -1938,8 +1938,8 @@ elf32_tic6x_gc_mark_extra_sections (struct bfd_link_info *info,
static bfd_boolean
is_tic6x_elf_unwind_section_name (const char *name)
{
- return (CONST_STRNEQ (name, ELF_STRING_C6000_unwind)
- || CONST_STRNEQ (name, ELF_STRING_C6000_unwind_once));
+ return (startswith (name, ELF_STRING_C6000_unwind)
+ || 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)
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
&& s != htab->elf.srelplt)
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index c7fe7f2..ff83062 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1082,7 +1082,7 @@ elf_vax_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
/* Remember whether there is a PLT. */
;
}
- else if (CONST_STRNEQ (name, ".rela"))
+ else if (startswith (name, ".rela"))
{
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;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 6338bc9..abc244c 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -1691,7 +1691,7 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".rela"))
+ if (startswith (name, ".rela"))
{
if (s->size != 0)
{
@@ -1705,8 +1705,8 @@ elf_xtensa_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".plt.")
- && ! CONST_STRNEQ (name, ".got.plt.")
+ else if (! startswith (name, ".plt.")
+ && ! startswith (name, ".got.plt.")
&& strcmp (name, ".got") != 0
&& strcmp (name, ".plt") != 0
&& strcmp (name, ".got.plt") != 0
@@ -11144,8 +11144,8 @@ xtensa_is_property_section (asection *sec)
static bfd_boolean
xtensa_is_insntable_section (asection *sec)
{
- if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME)
- || CONST_STRNEQ (sec->name, ".gnu.linkonce.x."))
+ if (startswith (sec->name, XTENSA_INSN_SEC_NAME)
+ || startswith (sec->name, ".gnu.linkonce.x."))
return TRUE;
return FALSE;
@@ -11155,8 +11155,8 @@ xtensa_is_insntable_section (asection *sec)
static bfd_boolean
xtensa_is_littable_section (asection *sec)
{
- if (CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME)
- || CONST_STRNEQ (sec->name, ".gnu.linkonce.p."))
+ if (startswith (sec->name, XTENSA_LIT_SEC_NAME)
+ || startswith (sec->name, ".gnu.linkonce.p."))
return TRUE;
return FALSE;
@@ -11166,8 +11166,8 @@ xtensa_is_littable_section (asection *sec)
static bfd_boolean
xtensa_is_proptable_section (asection *sec)
{
- if (CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME)
- || CONST_STRNEQ (sec->name, ".gnu.linkonce.prop."))
+ if (startswith (sec->name, XTENSA_PROP_SEC_NAME)
+ || startswith (sec->name, ".gnu.linkonce.prop."))
return TRUE;
return FALSE;
@@ -11281,7 +11281,7 @@ xtensa_property_section_name (asection *sec, const char *base_name,
suffix = sec->name + linkonce_len;
/* For backward compatibility, replace "t." instead of inserting
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;
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
instructions that reference the corresponding ".got.plt*" sections. */
if ((sec->flags & SEC_LINKER_CREATED) != 0
- && CONST_STRNEQ (sec->name, ".plt"))
+ && startswith (sec->name, ".plt"))
{
asection *sgotplt;
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 3d21437..6fffc43 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -2859,7 +2859,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
of the dynobj section names depend upon the input files. */
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".rela"))
+ if (startswith (name, ".rela"))
{
if (s->size != 0)
{
@@ -2873,7 +2873,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
s->reloc_count = 0;
}
}
- else if (! CONST_STRNEQ (name, ".got")
+ else if (! startswith (name, ".got")
&& strcmp (name, ".plt") != 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
it is that function which decides whether anything needs to
go into these sections. */
- if (!CONST_STRNEQ (name, ".got"))
+ if (!startswith (name, ".got"))
s->flags |= SEC_EXCLUDE;
}
else if ((s->flags & SEC_HAS_CONTENTS) != 0)
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 50782fe..0ce85cc 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -1754,13 +1754,13 @@ elf64_hppa_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
;
}
else if (strcmp (name, ".opd") == 0
- || CONST_STRNEQ (name, ".dlt")
+ || startswith (name, ".dlt")
|| strcmp (name, ".stub") == 0
|| strcmp (name, ".got") == 0)
{
/* 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)
{
diff --git a/bfd/elf64-ia64-vms.c b/bfd/elf64-ia64-vms.c
index b69c9cd..317253f 100644
--- a/bfd/elf64-ia64-vms.c
+++ b/bfd/elf64-ia64-vms.c
@@ -809,9 +809,9 @@ elf64_ia64_relax_section (bfd *abfd, asection *sec,
static inline bfd_boolean
is_unwind_section_name (bfd *abfd ATTRIBUTE_UNUSED, const char *name)
{
- return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind)
- && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info))
- || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once));
+ return ((startswith (name, ELF_STRING_ia64_unwind)
+ && ! startswith (name, ELF_STRING_ia64_unwind_info))
+ || startswith (name, ELF_STRING_ia64_unwind_once));
}
@@ -1847,9 +1847,9 @@ get_reloc_section (bfd *abfd,
if (srel_name == 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)
- || (CONST_STRNEQ (srel_name, ".rel")
+ || (startswith (srel_name, ".rel")
&& strcmp (bfd_section_name (sec), srel_name+4) == 0));
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)
strip = FALSE;
- else if (CONST_STRNEQ (name, ".rel"))
+ else if (startswith (name, ".rel"))
{
if (!strip)
{
@@ -4387,7 +4387,7 @@ elf64_ia64_object_p (bfd *abfd)
if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE))
- && CONST_STRNEQ (sec->name, ".gnu.linkonce.t."))
+ && startswith (sec->name, ".gnu.linkonce.t."))
{
name = sec->name + 16;
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index f87b26e..62365e1 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2139,7 +2139,7 @@ mmix_elf_add_symbol_hook (bfd *abfd,
(*secp)->flags |= SEC_LINKER_CREATED;
}
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. */
struct bfd_link_hash_entry *h = bfd_link_hash_lookup (info->hash,
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index ab0e0d3..741f510 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -10226,7 +10226,7 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
/* Not sized yet. */
continue;
}
- else if (CONST_STRNEQ (s->name, ".rela"))
+ else if (startswith (s->name, ".rela"))
{
if (s->size != 0)
{
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 69a011f..01dcefe 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 6936267..c5db406 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4129,7 +4129,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
const char *name;
name = bfd_section_name (s);
- if (CONST_STRNEQ (name, ".gnu.warning."))
+ if (startswith (name, ".gnu.warning."))
{
char *msg;
bfd_size_type sz;
@@ -5693,7 +5693,7 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
asection *stab;
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] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0
@@ -13698,7 +13698,7 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
if (!debug_frag_seen
&& (isec->flags & SEC_DEBUGGING)
- && CONST_STRNEQ (isec->name, ".debug_line."))
+ && startswith (isec->name, ".debug_line."))
debug_frag_seen = TRUE;
else if (strcmp (bfd_section_name (isec),
"__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)
{
- 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))
{
_bfd_elf_parse_eh_frame_entry (info, sec, &cookie);
@@ -14722,7 +14722,7 @@ _bfd_elf_section_already_linked (bfd *abfd,
else
{
/* 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++;
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
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)
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)
sec->output_section = bfd_abs_section_ptr;
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 1ec405e..2fee93a 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -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
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)
relocs = TRUE;
diff --git a/bfd/elfnn-ia64.c b/bfd/elfnn-ia64.c
index aaa69c4..281a837 100644
--- a/bfd/elfnn-ia64.c
+++ b/bfd/elfnn-ia64.c
@@ -893,9 +893,9 @@ is_unwind_section_name (bfd *abfd, const char *name)
&& !strcmp (name, ELF_STRING_ia64_unwind_hdr))
return FALSE;
- return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind)
- && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info))
- || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once));
+ return ((startswith (name, ELF_STRING_ia64_unwind)
+ && ! startswith (name, ELF_STRING_ia64_unwind_info))
+ || startswith (name, ELF_STRING_ia64_unwind_once));
}
/* 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)
strip = FALSE;
- else if (CONST_STRNEQ (name, ".rel"))
+ else if (startswith (name, ".rel"))
{
if (!strip)
{
@@ -4859,7 +4859,7 @@ elfNN_ia64_object_p (bfd *abfd)
if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE))
- && CONST_STRNEQ (sec->name, ".gnu.linkonce.t."))
+ && startswith (sec->name, ".gnu.linkonce.t."))
{
name = sec->name + 16;
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 86e15b6..41abf49 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1030,9 +1030,9 @@ static bfd *reldyn_sorting_bfd;
#define CALL_STUB ".mips16.call."
#define CALL_FP_STUB ".mips16.call.fp."
-#define FN_STUB_P(name) CONST_STRNEQ (name, FN_STUB)
-#define CALL_STUB_P(name) CONST_STRNEQ (name, CALL_STUB)
-#define CALL_FP_STUB_P(name) CONST_STRNEQ (name, CALL_FP_STUB)
+#define FN_STUB_P(name) startswith (name, FN_STUB)
+#define CALL_STUB_P(name) startswith (name, CALL_STUB)
+#define CALL_FP_STUB_P(name) startswith (name, CALL_FP_STUB)
/* The format of the first PLT entry in an O32 executable. */
static const bfd_vma mips_o32_exec_plt0_entry[] =
@@ -7411,7 +7411,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_GPTAB:
- if (! CONST_STRNEQ (name, ".gptab."))
+ if (! startswith (name, ".gptab."))
return FALSE;
break;
case SHT_MIPS_UCODE:
@@ -7434,7 +7434,7 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_CONTENT:
- if (! CONST_STRNEQ (name, ".MIPS.content"))
+ if (! startswith (name, ".MIPS.content"))
return FALSE;
break;
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);
break;
case SHT_MIPS_DWARF:
- if (! CONST_STRNEQ (name, ".debug_")
- && ! CONST_STRNEQ (name, ".zdebug_"))
+ if (! startswith (name, ".debug_")
+ && ! startswith (name, ".zdebug_"))
return FALSE;
break;
case SHT_MIPS_SYMBOL_LIB:
@@ -7456,8 +7456,8 @@ _bfd_mips_elf_section_from_shdr (bfd *abfd,
return FALSE;
break;
case SHT_MIPS_EVENTS:
- if (! CONST_STRNEQ (name, ".MIPS.events")
- && ! CONST_STRNEQ (name, ".MIPS.post_rel"))
+ if (! startswith (name, ".MIPS.events")
+ && ! startswith (name, ".MIPS.post_rel"))
return FALSE;
break;
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)
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_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_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_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_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_entsize = sizeof (Elf_External_ABIFlags_v0);
}
- else if (CONST_STRNEQ (name, ".debug_")
- || CONST_STRNEQ (name, ".zdebug_"))
+ else if (startswith (name, ".debug_")
+ || startswith (name, ".zdebug_"))
{
hdr->sh_type = SHT_MIPS_DWARF;
/* Irix facilities such as libexc expect a single .debug_frame
per executable, the system ones have NOSTRIP set and the linker
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;
}
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
final_write_processing. */
}
- else if (CONST_STRNEQ (name, ".MIPS.events")
- || CONST_STRNEQ (name, ".MIPS.post_rel"))
+ else if (startswith (name, ".MIPS.events")
+ || startswith (name, ".MIPS.post_rel"))
{
hdr->sh_type = SHT_MIPS_EVENTS;
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)
continue;
- if (CONST_STRNEQ (name, ".rel"))
+ if (startswith (name, ".rel"))
{
if (s->size != 0)
{
@@ -10044,14 +10044,14 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
}
else if (bfd_link_executable (info)
&& ! 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
rtld to contain a pointer to the _r_debug structure. */
s->size += MIPS_ELF_RLD_MAP_SIZE (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;
else if (s == htab->root.splt)
{
@@ -10063,7 +10063,7 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd,
&& s->size > 0)
s->size += 4;
}
- else if (! CONST_STRNEQ (name, ".init")
+ else if (! startswith (name, ".init")
&& s != htab->root.sgot
&& s != htab->root.sgotplt
&& s != htab->sstubs
@@ -12422,7 +12422,7 @@ _bfd_mips_final_write_processing (bfd *abfd)
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && CONST_STRNEQ (name, ".gptab."));
+ && startswith (name, ".gptab."));
sec = bfd_get_section_by_name (abfd, name + sizeof ".gptab" - 1);
BFD_ASSERT (sec != NULL);
(*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);
name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && CONST_STRNEQ (name, ".MIPS.content"));
+ && startswith (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.content" - 1);
BFD_ASSERT (sec != NULL);
@@ -12452,12 +12452,12 @@ _bfd_mips_final_write_processing (bfd *abfd)
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_section_name ((*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL);
- if (CONST_STRNEQ (name, ".MIPS.events"))
+ if (startswith (name, ".MIPS.events"))
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.events" - 1);
else
{
- BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel"));
+ BFD_ASSERT (startswith (name, ".MIPS.post_rel"));
sec = bfd_get_section_by_name (abfd,
(name
+ sizeof ".MIPS.post_rel" - 1));
@@ -15085,7 +15085,7 @@ _bfd_mips_elf_final_link (bfd *abfd, struct bfd_link_info *info)
mdebug_sec = o;
}
- if (CONST_STRNEQ (o->name, ".gptab."))
+ if (startswith (o->name, ".gptab."))
{
const char *subname;
unsigned int c;
diff --git a/bfd/elfxx-sparc.c b/bfd/elfxx-sparc.c
index bbf129c..c498d1c 100644
--- a/bfd/elfxx-sparc.c
+++ b/bfd/elfxx-sparc.c
@@ -2540,7 +2540,7 @@ _bfd_sparc_elf_size_dynamic_sections (bfd *output_bfd,
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (CONST_STRNEQ (s->name, ".rela"))
+ else if (startswith (s->name, ".rela"))
{
if (s->size != 0)
{
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 93ad38c..6ff9fd5 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -686,13 +686,13 @@ elf_x86_link_hash_table_free (bfd *obfd)
static bfd_boolean
elf_i386_is_reloc_section (const char *secname)
{
- return CONST_STRNEQ (secname, ".rel");
+ return startswith (secname, ".rel");
}
static bfd_boolean
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. */
diff --git a/bfd/hpux-core.c b/bfd/hpux-core.c
index 03d0de3..d84df68 100644
--- a/bfd/hpux-core.c
+++ b/bfd/hpux-core.c
@@ -145,7 +145,7 @@ thread_section_p (bfd *abfd ATTRIBUTE_UNUSED,
asection *sect,
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.
diff --git a/bfd/libcoff.h b/bfd/libcoff.h
index bb9066f..f2ce3c5 100644
--- a/bfd/libcoff.h
+++ b/bfd/libcoff.h
@@ -977,7 +977,7 @@ typedef struct
/* Macro: Returns true if the bfd is a PE executable as opposed to a
PE object file. */
#define bfd_pei_p(abfd) \
- (CONST_STRNEQ ((abfd)->xvec->name, "pei-"))
+ (startswith ((abfd)->xvec->name, "pei-"))
#ifdef __cplusplus
}
#endif
diff --git a/bfd/linker.c b/bfd/linker.c
index 7e0415c..6f6e684 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -579,7 +579,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
#define REAL "__real_"
if (*l == '_'
- && CONST_STRNEQ (l, REAL)
+ && startswith (l, REAL)
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
FALSE, FALSE) != NULL)
{
@@ -623,7 +623,7 @@ unwrap_hash_lookup (struct bfd_link_info *info,
|| *l == info->wrap_char)
++l;
- if (CONST_STRNEQ (l, WRAP))
+ if (startswith (l, WRAP))
{
l += sizeof WRAP - 1;
@@ -964,7 +964,7 @@ _bfd_generic_link_add_archive_symbols
if (h == NULL
&& info->pei386_auto_import
- && CONST_STRNEQ (arsym->name, "__imp_"))
+ && startswith (arsym->name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, arsym->name + 6,
FALSE, FALSE, TRUE);
if (h == NULL)
@@ -1536,7 +1536,7 @@ _bfd_generic_link_add_one_symbol (struct bfd_link_info *info,
s = name + 1;
while (*s == '_')
++s;
- if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX))
+ if (s[0] == 'G' && startswith (s, CONS_PREFIX))
{
char c;
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 4ba62d0..53883a3 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -2505,7 +2505,7 @@ mmo_internal_write_section (bfd *abfd, asection *sec)
bfd_set_error (bfd_error_bad_value);
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));
diff --git a/bfd/osf-core.c b/bfd/osf-core.c
index 17cc532..9997967 100644
--- a/bfd/osf-core.c
+++ b/bfd/osf-core.c
@@ -84,7 +84,7 @@ osf_core_core_file_p (bfd *abfd)
if (val != sizeof core_header)
return NULL;
- if (! CONST_STRNEQ (core_header.magic, "Core"))
+ if (! startswith (core_header.magic, "Core"))
return NULL;
core_hdr (abfd) = (struct osf_core_struct *)
diff --git a/bfd/pef.c b/bfd/pef.c
index 93bc933..c930411 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -219,7 +219,7 @@ bfd_pef_print_symbol (bfd *abfd,
default:
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
- if (CONST_STRNEQ (symbol->name, "__traceback_"))
+ if (startswith (symbol->name, "__traceback_"))
{
unsigned char *buf;
size_t offset = symbol->value + 4;
diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c
index 6ce808a..85c0ca2 100644
--- a/bfd/pei-x86_64.c
+++ b/bfd/pei-x86_64.c
@@ -835,7 +835,7 @@ static void
pex64_print_all_pdata_sections (bfd *abfd, asection *pdata, void *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))
paps->pdata_count++;
diff --git a/bfd/som.c b/bfd/som.c
index 872e933..01bcd16 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -4803,12 +4803,12 @@ som_slurp_symbol_table (bfd *abfd)
&& sym->symbol.name[strlen (sym->symbol.name) - 1] == '$'
&& !strcmp (sym->symbol.name, sym->symbol.section->name))
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.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;
/* Note increment at bottom of loop, since we skip some symbols
@@ -6186,7 +6186,7 @@ som_slurp_armap (bfd *abfd)
return FALSE;
/* For archives without .o files there is no symbol table. */
- if (! CONST_STRNEQ (nextname, "/ "))
+ if (! startswith (nextname, "/ "))
{
abfd->has_armap = FALSE;
return TRUE;
diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c
index a8f6547..da9616e 100644
--- a/bfd/wasm-module.c
+++ b/bfd/wasm-module.c
@@ -536,7 +536,7 @@ wasm_compute_custom_section_file_position (bfd *abfd,
if (idx != 0)
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);
bfd_size_type payload_len = asect->size;