]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - bfd/coffcode.h
Add startswith function and use it instead of CONST_STRNEQ.
[thirdparty/binutils-gdb.git] / bfd / coffcode.h
index bcd34d469b63435a3868cdbc1a0abc4525f9b5c3..d1ad669a6db72b2602b9b66509c93f904c1a910f 100644 (file)
@@ -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.  */