+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * bfd-in.h (STRING_AND_COMMA): New macro. Takes one constant
+ string as its argument and emits the string followed by a comma
+ and then the length of the string.
+ (CONST_STRNEQ): New macro. Checks to see if a variable string
+ has a constant string as its initial characters.
+ (CONST_STRNCPY): New macro. Copies a constant string to the start
+ of a variable string.
+ * bfd-in2.h: Regenerate.
+ * archive.c: Make use of the new macros.
+ * archive64.c: Likewise.
+ * bfd.c: Likewise.
+ * coff-ppc.c: Likewise.
+ * coff-stgo32.c: Likewise.
+ * coffcode.h: Likewise.
+ * cofflink.c: Likewise.
+ * cpu-i960.c: Likewise.
+ * dwarf2.c: Likewise.
+ * ecoff.c: Likewise.
+ * elf-m10300.c: Likewise.
+ * elf.c: Likewise.
+ * elf32-arm.c: Likewise.
+ * elf32-bfin.c: Likewise.
+ * elf32-cris.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-i386.c: Likewise.
+ * elf32-iq2000.c: Likewise.
+ * elf32-m32r.c: Likewise.
+ * elf32-m68hc11.c: Likewise.
+ * elf32-m68hc12.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh-symbian.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sh64.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf32-xtensa.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-mmix.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sh64.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elflink.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elfxx-mips.c: Likewise.
+ * elfxx-sparc.c: Likewise.
+ * hpux-core.c: Likewise.
+ * i386linux.c: Likewise.
+ * ieee.c: Likewise.
+ * libpei.h: Likewise.
+ * linker.c: Likewise.
+ * m68klinux.c: Likewise.
+ * mmo.c: Likewise.
+ * nlmcode.h: Likewise.
+ * osf-core.c: Likewise.
+ * pef.c: Likewise.
+ * som.c: Likewise.
+ * sparclinux.c: Likewise.
+ * vms-hdr.c: Likewise.
+
2006-09-14 Alan Modra <amodra@bigpond.net.au>
PR 3182
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* old Linux archives */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- else if (!strncmp (nextname, "/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/ "))
return do_slurp_coff_armap (abfd);
- else if (!strncmp (nextname, "/SYM64/ ", 16))
+ else if (CONST_STRNEQ (nextname, "/SYM64/ "))
{
/* 64bit ELF (Irix 6) archive. */
#ifdef BFD64
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (!strncmp (nextname, "__.SYMDEF ", 16)
- || !strncmp (nextname, "__.SYMDEF/ ", 16)) /* Old Linux archives. */
+ if (CONST_STRNEQ (nextname, "__.SYMDEF ")
+ || CONST_STRNEQ (nextname, "__.SYMDEF/ ")) /* Old Linux archives. */
return do_slurp_bsd_armap (abfd);
- if (strncmp (nextname, "/ ", 16))
+ if (! CONST_STRNEQ (nextname, "/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
if (bfd_seek (abfd, (file_ptr) -16, SEEK_CUR) != 0)
return FALSE;
- if (strncmp (nextname, "ARFILENAMES/ ", 16) != 0 &&
- strncmp (nextname, "// ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "ARFILENAMES/ ")
+ && ! CONST_STRNEQ (nextname, "// "))
{
bfd_ardata (abfd)->extended_names = NULL;
bfd_ardata (abfd)->extended_names_size = 0;
/* MIPS-specific support for 64-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2006
Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
/* This file supports the 64-bit (MIPS) ELF archives. */
return FALSE;
/* Archives with traditional armaps are still permitted. */
- if (strncmp (nextname, "/ ", 16) == 0)
+ if (CONST_STRNEQ (nextname, "/ "))
return bfd_slurp_armap (abfd);
- if (strncmp (nextname, "/SYM64/ ", 16) != 0)
+ if (! CONST_STRNEQ (nextname, "/SYM64/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* 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. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+#define CONST_STRNCPY(STR1,STR2) strncpy ((STR1), (STR2), sizeof (STR2) - 1)
+
+
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
#endif
#endif
+/* This is a utility macro to handle the situation where the code
+ wants to place a constant string into the code, followed by a
+ comma and then the length of the string. Doing this by hand
+ is error prone, so using this macro is safer. The macro will
+ also safely handle the case where a NULL is passed as the arg. */
+#define STRING_COMMA_LEN(STR) (STR), ((STR) ? sizeof (STR) - 1 : 0)
+/* 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. */
+#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
+#define CONST_STRNCPY(STR1,STR2) strncpy ((STR1), (STR2), sizeof (STR2) - 1)
+
+
/* The word size used by BFD on the host. This may be 64 with a 32
bit target if the host is 64 bit, or if other 64 bit targets have
been selected with --enable-targets, or if --enable-64-bit-bfd. */
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 (strncmp (name, "coff-go32", sizeof ("coff-go32") - 1) == 0
+ if (CONST_STRNEQ (name, "coff-go32")
|| strcmp (name, "pe-i386") == 0
|| strcmp (name, "pei-i386") == 0
|| strcmp (name, "pe-arm-wince-little") == 0
DUMP_RELOC2 (howto->name, rel);
- if (strncmp(".idata$2",input_section->name,8) == 0 && first_thunk_address == 0)
+ if (CONST_STRNEQ (input_section->name, ".idata$2") && first_thunk_address == 0)
{
/* Set magic values. */
int idata5offset;
/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of BFD, the Binary File Descriptor library.
close (f);
goto stub_end;
}
- if (memcmp (magic, "go32stub", 8) != 0)
+ if (! CONST_STRNEQ (magic, "go32stub"))
{
close (f);
goto stub_end;
styp_flags = STYP_LIT;
#endif /* _LIT */
}
- else if (!strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1))
+ else if (CONST_STRNEQ (sec_name, DOT_DEBUG))
{
/* Handle the XCOFF debug section and DWARF2 debug sections. */
if (!sec_name[6])
else
styp_flags = STYP_DEBUG_INFO;
}
- else if (!strncmp (sec_name, ".stab", 5))
+ else if (CONST_STRNEQ (sec_name, ".stab"))
{
styp_flags = STYP_DEBUG_INFO;
}
#ifdef COFF_LONG_SECTION_NAMES
- else if (!strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1))
+ else if (CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
{
styp_flags = STYP_DEBUG_INFO;
}
but there are more IMAGE_SCN_* flags. */
/* FIXME: There is no gas syntax to specify the debug section flag. */
- if (strncmp (sec_name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0
- || strncmp (sec_name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0)
+ if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+ || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI))
sec_flags = SEC_DEBUGGING;
/* skip LOAD */
#endif
sec_flags |= SEC_ALLOC;
}
- else if (strncmp (name, DOT_DEBUG, sizeof (DOT_DEBUG) - 1) == 0
+ else if (CONST_STRNEQ (name, DOT_DEBUG)
#ifdef _COMMENT
|| strcmp (name, _COMMENT) == 0
#endif
#ifdef COFF_LONG_SECTION_NAMES
- || strncmp (name, GNU_LINKONCE_WI, sizeof (GNU_LINKONCE_WI) - 1) == 0
+ || CONST_STRNEQ (name, GNU_LINKONCE_WI)
#endif
- || strncmp (name, ".stab", 5) == 0)
+ || CONST_STRNEQ (name, ".stab"))
{
#ifdef COFF_PAGE_SIZE
sec_flags |= SEC_DEBUGGING;
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 (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
/* The MS PE spec sets the DISCARDABLE flag on .reloc sections
but we do not want them to be labelled as debug section, since
then strip would remove them. */
- if (strncmp (name, ".reloc", sizeof ".reloc" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".reloc"))
sec_flags |= SEC_DEBUGGING;
break;
case IMAGE_SCN_MEM_SHARED:
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 (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.linkonce"))
sec_flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
#endif
/* Auto import. */
if (!h
&& info->pei386_auto_import
- && !strncmp (name,"__imp_", 6))
+ && CONST_STRNEQ (name, "__imp_"))
h = bfd_link_hash_lookup (info->hash, name + 6, FALSE, FALSE, TRUE);
/* We are only interested in symbols that are currently
|| classification == COFF_SYMBOL_PE_SECTION)
&& coff_section_data (abfd, section) != NULL
&& coff_section_data (abfd, section)->comdat != NULL
- && strncmp (name, "??_", 3) == 0
+ && CONST_STRNEQ (name, "??_")
&& strcmp (name, coff_section_data (abfd, section)->comdat->name) == 0)
{
if (*sym_hash == NULL)
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (".stab", stab->name)
&& (!stab->name[5]
|| (stab->name[5] == '.' && ISDIGIT (stab->name[6]))))
{
s++;
continue;
}
- if (strncmp (s, "-attr", 5) == 0)
+ if (CONST_STRNEQ (s, "-attr"))
{
char *name;
char *attribs;
asec->flags |= SEC_READONLY;
}
}
- else if (strncmp (s,"-heap", 5) == 0)
- s = dores_com (s+5, output_bfd, 1);
+ else if (CONST_STRNEQ (s, "-heap"))
+ s = dores_com (s + 5, output_bfd, 1);
- else if (strncmp (s,"-stack", 6) == 0)
- s = dores_com (s+6, output_bfd, 0);
+ else if (CONST_STRNEQ (s, "-stack"))
+ s = dores_com (s + 6, output_bfd, 0);
else
s++;
/* BFD library support routines for the i960 architecture.
- Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002
+ Copyright 1990, 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2006
Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
}
/* In some bfds the cpu-id is written as "80960KA", "80960KB",
"80960CA" or "80960MC". */
- else if (strncmp ("80960", string, 5) == 0)
+ else if (CONST_STRNEQ (string, "80960"))
{
string += 5;
if (strcmp (msec->name, DWARF2_DEBUG_INFO) == 0)
return msec;
- if (strncmp (msec->name, GNU_LINKONCE_INFO, strlen (GNU_LINKONCE_INFO)) == 0)
+ if (CONST_STRNEQ (msec->name, GNU_LINKONCE_INFO))
return msec;
msec = msec->next;
bfd_slurp_armap, but that seems inappropriate since no other
target uses this format. Instead, we check directly for a COFF
armap. */
- if (strneq (nextname, "/ ", 16))
+ if (CONST_STRNEQ (nextname, "/ "))
return bfd_slurp_armap (abfd);
/* See if the first element is an armap. */
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include "bfd.h"
#include "sysdep.h"
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
/* It's not one of our sections, so don't allocate space. */
continue;
int len;
} debug_sections [] =
{
- { "debug", 5 }, /* 'd' */
+ { STRING_COMMA_LEN ("debug") }, /* 'd' */
{ NULL, 0 }, /* 'e' */
{ NULL, 0 }, /* 'f' */
- { "gnu.linkonce.wi.", 16 }, /* 'g' */
+ { STRING_COMMA_LEN ("gnu.linkonce.wi.") }, /* 'g' */
{ NULL, 0 }, /* 'h' */
{ NULL, 0 }, /* 'i' */
{ NULL, 0 }, /* 'j' */
{ NULL, 0 }, /* 'k' */
- { "line", 4 }, /* 'l' */
+ { STRING_COMMA_LEN ("line") }, /* 'l' */
{ NULL, 0 }, /* 'm' */
{ NULL, 0 }, /* 'n' */
{ NULL, 0 }, /* 'o' */
{ NULL, 0 }, /* 'p' */
{ NULL, 0 }, /* 'q' */
{ NULL, 0 }, /* 'r' */
- { "stab", 4 } /* 's' */
+ { STRING_COMMA_LEN ("stab") } /* 's' */
};
if (name [0] == '.')
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 (strncmp (name, ".gnu.linkonce", sizeof ".gnu.linkonce" - 1) == 0
+ if (CONST_STRNEQ (name, ".gnu.linkonce")
&& elf_next_in_group (newsect) == NULL)
flags |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
static const struct bfd_elf_special_section special_sections_b[] =
{
- { ".bss", 4, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".bss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_c[] =
{
- { ".comment", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".comment"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_d[] =
{
- { ".data", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".data1", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".debug", 6, 0, SHT_PROGBITS, 0 },
- { ".debug_line", 11, 0, SHT_PROGBITS, 0 },
- { ".debug_info", 11, 0, SHT_PROGBITS, 0 },
- { ".debug_abbrev", 13, 0, SHT_PROGBITS, 0 },
- { ".debug_aranges", 14, 0, SHT_PROGBITS, 0 },
- { ".dynamic", 8, 0, SHT_DYNAMIC, SHF_ALLOC },
- { ".dynstr", 7, 0, SHT_STRTAB, SHF_ALLOC },
- { ".dynsym", 7, 0, SHT_DYNSYM, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".data"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".data1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".debug"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_line"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_info"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_abbrev"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".debug_aranges"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, SHF_ALLOC },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_f[] =
{
- { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_g[] =
{
- { ".gnu.linkonce.b",15, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".got", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".gnu.version", 12, 0, SHT_GNU_versym, 0 },
- { ".gnu.version_d", 14, 0, SHT_GNU_verdef, 0 },
- { ".gnu.version_r", 14, 0, SHT_GNU_verneed, 0 },
- { ".gnu.liblist", 12, 0, SHT_GNU_LIBLIST, SHF_ALLOC },
- { ".gnu.conflict", 13, 0, SHT_RELA, SHF_ALLOC },
- { ".gnu.hash", 9, 0, SHT_GNU_HASH, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".gnu.linkonce.b"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".gnu.version"), 0, SHT_GNU_versym, 0 },
+ { STRING_COMMA_LEN (".gnu.version_d"), 0, SHT_GNU_verdef, 0 },
+ { STRING_COMMA_LEN (".gnu.version_r"), 0, SHT_GNU_verneed, 0 },
+ { STRING_COMMA_LEN (".gnu.liblist"), 0, SHT_GNU_LIBLIST, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.conflict"), 0, SHT_RELA, SHF_ALLOC },
+ { STRING_COMMA_LEN (".gnu.hash"), 0, SHT_GNU_HASH, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_h[] =
{
- { ".hash", 5, 0, SHT_HASH, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_i[] =
{
- { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".interp", 7, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".interp"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_l[] =
{
- { ".line", 5, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".line"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_n[] =
{
- { ".note.GNU-stack",15, 0, SHT_PROGBITS, 0 },
- { ".note", 5, -1, SHT_NOTE, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".note.GNU-stack"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".note"), -1, SHT_NOTE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_p[] =
{
- { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_r[] =
{
- { ".rodata", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".rodata1", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".rela", 5, -1, SHT_RELA, 0 },
- { ".rel", 4, -1, SHT_REL, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".rodata"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rodata1"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".rela"), -1, SHT_RELA, 0 },
+ { STRING_COMMA_LEN (".rel"), -1, SHT_REL, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_s[] =
{
- { ".shstrtab", 9, 0, SHT_STRTAB, 0 },
- { ".strtab", 7, 0, SHT_STRTAB, 0 },
- { ".symtab", 7, 0, SHT_SYMTAB, 0 },
- { ".stabstr", 5, 3, SHT_STRTAB, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".shstrtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".strtab"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".symtab"), 0, SHT_SYMTAB, 0 },
+ { STRING_COMMA_LEN (".stabstr"), 3, SHT_STRTAB, 0 },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section special_sections_t[] =
{
- { ".text", 5, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".tbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { ".tdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".text"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_TLS },
+ { NULL, 0, 0, 0, 0 }
};
static const struct bfd_elf_special_section *special_sections[] =
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 (strncmp (sec->name, ".stab", sizeof ".stab" - 1) == 0
+ if (CONST_STRNEQ (sec->name, ".stab")
&& strcmp (sec->name + strlen (sec->name) - 3, "str") == 0)
{
size_t len;
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
+ && CONST_STRNEQ (s->name, ".note"))
{
/* We need a PT_NOTE segment. */
++segs;
for (s = abfd->sections; s != NULL; s = s->next)
{
if ((s->flags & SEC_LOAD) != 0
- && strncmp (s->name, ".note", 5) == 0)
+ && CONST_STRNEQ (s->name, ".note"))
{
amt = sizeof (struct elf_segment_map);
m = bfd_zalloc (abfd, amt);
in.descdata = in.namedata + BFD_ALIGN (in.namesz, 4);
in.descpos = offset + (in.descdata - buf);
- if (strncmp (in.namedata, "NetBSD-CORE", 11) == 0)
+ if (CONST_STRNEQ (in.namedata, "NetBSD-CORE"))
{
if (! elfcore_grok_netbsd_note (abfd, &in))
goto error;
}
- else if (strncmp (in.namedata, "QNX", 3) == 0)
+ else if (CONST_STRNEQ (in.namedata, "QNX"))
{
if (! elfcore_grok_nto_note (abfd, &in))
goto error;
/* If both are .gnu.linkonce sections, they have to have the same
section name. */
- if (strncmp (sec1->name, ".gnu.linkonce",
- sizeof ".gnu.linkonce" - 1) == 0
- && strncmp (sec2->name, ".gnu.linkonce",
- sizeof ".gnu.linkonce" - 1) == 0)
+ if (CONST_STRNEQ (sec1->name, ".gnu.linkonce")
+ && CONST_STRNEQ (sec2->name, ".gnu.linkonce"))
return strcmp (sec1->name + sizeof ".gnu.linkonce",
sec2->name + sizeof ".gnu.linkonce") == 0;
const char *name, asection *s)
{
if (htab->use_rel)
- return strncmp (name, ".rel", 4) == 0 && strcmp (s->name, name + 4) == 0;
+ return CONST_STRNEQ (name, ".rel") && strcmp (s->name, name + 4) == 0;
else
- return strncmp (name, ".rela", 5) == 0 && strcmp (s->name, name + 5) == 0;
+ return CONST_STRNEQ (name, ".rela") && strcmp (s->name, name + 5) == 0;
}
/* Create .got, .gotplt, and .rel(a).got sections in DYNOBJ, and set up
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (name, ".rel"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
static bfd_boolean
is_arm_elf_unwind_section_name (bfd * abfd ATTRIBUTE_UNUSED, const char * name)
{
- size_t len1, len2;
-
- len1 = sizeof (ELF_STRING_ARM_unwind) - 1;
- len2 = sizeof (ELF_STRING_ARM_unwind_once) - 1;
- return (strncmp (name, ELF_STRING_ARM_unwind, len1) == 0
- || strncmp (name, ELF_STRING_ARM_unwind_once, len2) == 0);
+ return (CONST_STRNEQ (name, ELF_STRING_ARM_unwind)
+ || CONST_STRNEQ (name, ELF_STRING_ARM_unwind_once));
}
the loadable read-only segment. The post-linker may wish to
refer to these sections, but they are not part of the final
program image. */
- { ".dynamic", 8, 0, SHT_DYNAMIC, 0 },
- { ".dynstr", 7, 0, SHT_STRTAB, 0 },
- { ".dynsym", 7, 0, SHT_DYNSYM, 0 },
- { ".got", 4, 0, SHT_PROGBITS, 0 },
- { ".hash", 5, 0, SHT_HASH, 0 },
+ { STRING_COMMA_LEN (".dynamic"), 0, SHT_DYNAMIC, 0 },
+ { STRING_COMMA_LEN (".dynstr"), 0, SHT_STRTAB, 0 },
+ { STRING_COMMA_LEN (".dynsym"), 0, SHT_DYNSYM, 0 },
+ { STRING_COMMA_LEN (".got"), 0, SHT_PROGBITS, 0 },
+ { STRING_COMMA_LEN (".hash"), 0, SHT_HASH, 0 },
/* These sections do not need to be writable as the SymbianOS
postlinker will arrange things so that no dynamic relocation is
required. */
- { ".init_array", 11, 0, SHT_INIT_ARRAY, SHF_ALLOC },
- { ".fini_array", 11, 0, SHT_FINI_ARRAY, SHF_ALLOC },
- { ".preinit_array", 14, 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".init_array"), 0, SHT_INIT_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".fini_array"), 0, SHT_FINI_ARRAY, SHF_ALLOC },
+ { STRING_COMMA_LEN (".preinit_array"), 0, SHT_PREINIT_ARRAY, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
static void
strip = FALSE;
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size == 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0)
+ else if (! CONST_STRNEQ (name, ".got"))
{
/* It's not one of our sections, so don't allocate space. */
continue;
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
else if (sec == htab->sgot
|| sec == htab->sdynbss)
;
- else if (strncmp (bfd_get_section_name (dynobj, sec), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, sec), ".rela"))
{
if (sec->size != 0)
{
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec), name + 5) == 0);
sreloc = bfd_get_section_by_name (dynobj, name);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rel", 4) != 0
+ if (! CONST_STRNEQ (name, ".rel")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 4) != 0)
{
if (htab->elf.hplt != NULL)
strip_section = FALSE;
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rel", 4) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rel"))
{
if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
relocs = TRUE;
/* IQ2000-specific support for 32-bit ELF.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
case R_IQ2000_32:
/* For debug section, change to special harvard-aware relocations. */
- if (memcmp (sec->name, ".debug", 6) == 0
- || memcmp (sec->name, ".stab", 5) == 0
- || memcmp (sec->name, ".eh_frame", 9) == 0)
+ if (CONST_STRNEQ (sec->name, ".debug")
+ || CONST_STRNEQ (sec->name, ".stab")
+ || CONST_STRNEQ (sec->name, ".eh_frame"))
{
((Elf_Internal_Rela *) rel)->r_info
= ELF32_R_INFO (ELF32_R_SYM (rel->r_info), R_IQ2000_32_DEBUG);
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
static const struct bfd_elf_special_section m32r_elf_special_sections[] =
{
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
static bfd_boolean
/* Motorola 68HC11-specific support for 32-bit ELF
- Copyright 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
(Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
vectors. */
static const struct bfd_elf_special_section elf32_m68hc11_special_sections[] =
{
- { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".eeprom"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".page0"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".softregs"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".vectors"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
\f
#define ELF_ARCH bfd_arch_m68hc11
/* Motorola 68HC12-specific support for 32-bit ELF
- Copyright 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
Contributed by Stephane Carrez (stcarrez@nerim.fr)
(Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com))
vectors. */
static const struct bfd_elf_special_section elf32_m68hc12_special_sections[] =
{
- { ".eeprom", 7, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".page0", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".softregs", 9, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".vectors", 8, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".eeprom"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".page0"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".softregs"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".vectors"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
\f
#define ELF_ARCH bfd_arch_m68hc12
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
/* Motorola MCore specific support for 32-bit ELF
- Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
static const struct bfd_elf_special_section mcore_elf_special_sections[]=
{
- { ".ctors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".dtors", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".ctors"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".dtors"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_BIG_SYM bfd_elf32_mcore_big_vec
static const struct bfd_elf_special_section ppc_elf_special_sections[] =
{
- { ".plt", 4, 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sbss2", 6, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata2", 7, -2, SHT_PROGBITS, SHF_ALLOC },
- { ".tags", 5, 0, SHT_ORDERED, SHF_ALLOC },
- { ".PPC.EMB.apuinfo", 16, 0, SHT_NOTE, 0 },
- { ".PPC.EMB.sbss0", 14, 0, SHT_PROGBITS, SHF_ALLOC },
- { ".PPC.EMB.sdata0", 15, 0, SHT_PROGBITS, SHF_ALLOC },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sbss2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata2"), -2, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".tags"), 0, SHT_ORDERED, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.apuinfo"), 0, SHT_NOTE, 0 },
+ { STRING_COMMA_LEN (".PPC.EMB.sbss0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { STRING_COMMA_LEN (".PPC.EMB.sdata0"), 0, SHT_PROGBITS, SHF_ALLOC },
+ { NULL, 0, 0, 0, 0 }
};
/* This is what we want for new plt/got. */
static struct bfd_elf_special_section ppc_alt_plt =
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC };
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC };
static const struct bfd_elf_special_section *
ppc_elf_get_sec_type_attr (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
{
/* Strip these too. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
{
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (! ((strncmp (name, ".sdata", 6) == 0
+ if (! ((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
(*_bfd_error_handler)
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (! (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0))
+ if (! (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2")))
{
(*_bfd_error_handler)
(_("%B: the target (%s) of a %s relocation is "
BFD_ASSERT (sec != NULL);
name = bfd_get_section_name (abfd, sec->output_section);
- if (((strncmp (name, ".sdata", 6) == 0
+ if (((CONST_STRNEQ (name, ".sdata")
&& (name[6] == 0 || name[6] == '.'))
- || (strncmp (name, ".sbss", 5) == 0
+ || (CONST_STRNEQ (name, ".sbss")
&& (name[5] == 0 || name[5] == '.'))))
{
reg = 13;
+ sh->root.u.def.section->output_section->vma);
}
- else if (strncmp (name, ".sdata2", 7) == 0
- || strncmp (name, ".sbss2", 6) == 0)
+ else if (CONST_STRNEQ (name, ".sdata2")
+ || CONST_STRNEQ (name, ".sbss2"))
{
reg = 2;
sh = htab->sdata[1].sym;
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
relocs = TRUE;
/* Renesas / SuperH specific support for Symbian 32-bit ELF files
- Copyright 2004, 2005
+ Copyright 2004, 2005, 2006
Free Software Foundation, Inc.
Contributed by Red Hat
break;
case 'I':
- if (strncmp (s, DIRECTIVE_IMPORT, strlen (DIRECTIVE_IMPORT)))
+ if (! CONST_STRNEQ (s, DIRECTIVE_IMPORT))
result = FALSE;
else
{
name_end_char = * new_name_end;
* new_name_end = 0;
- /* Check to see if 'AS '... is present. If se we have an IMPORT AS
- directive, otherwise we have an IMPORT directive. */
- if (strncmp (s, DIRECTIVE_AS, strlen (DIRECTIVE_AS)))
+ /* Check to see if 'AS '... is present. If so we have an
+ IMPORT AS directive, otherwise we have an IMPORT directive. */
+ if (! CONST_STRNEQ (s, DIRECTIVE_AS))
{
/* Skip the new-line at the end of the name. */
if (SYMBIAN_DEBUG && name_end_char != '\n')
break;
case 'E':
- if (strncmp (s, DIRECTIVE_EXPORT, strlen (DIRECTIVE_EXPORT)))
+ if (! CONST_STRNEQ (s, DIRECTIVE_EXPORT))
result = FALSE;
else
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt && s != htab->srelplt2)
relocs = TRUE;
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
static const struct bfd_elf_special_section sh64_elf_special_sections[] =
{
- { ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".cranges"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
#undef TARGET_BIG_SYM
static const struct bfd_elf_special_section v850_elf_special_sections[] =
{
- { ".call_table_data", 16, 0, SHT_PROGBITS, (SHF_ALLOC
- + SHF_WRITE) },
- { ".call_table_text", 16, 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_EXECINSTR) },
- { ".rosdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
- + SHF_V850_GPREL) },
- { ".rozdata", 8, -2, SHT_PROGBITS, (SHF_ALLOC
- + SHF_V850_R0REL) },
- { ".sbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".scommon", 8, -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".sdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_GPREL) },
- { ".tbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_EPREL) },
- { ".tcommon", 8, -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".tdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_EPREL) },
- { ".zbss", 5, -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".zcommon", 8, -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { ".zdata", 6, -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
- + SHF_V850_R0REL) },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".call_table_data"), 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE) },
+ { STRING_COMMA_LEN (".call_table_text"), 0, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_EXECINSTR) },
+ { STRING_COMMA_LEN (".rosdata"), -2, SHT_PROGBITS, (SHF_ALLOC
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".rozdata"), -2, SHT_PROGBITS, (SHF_ALLOC
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".scommon"), -2, SHT_V850_SCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_GPREL) },
+ { STRING_COMMA_LEN (".tbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_EPREL) },
+ { STRING_COMMA_LEN (".tcommon"), -2, SHT_V850_TCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".tdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_EPREL) },
+ { STRING_COMMA_LEN (".zbss"), -2, SHT_NOBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".zcommon"), -2, SHT_V850_ZCOMMON, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { STRING_COMMA_LEN (".zdata"), -2, SHT_PROGBITS, (SHF_ALLOC + SHF_WRITE
+ + SHF_V850_R0REL) },
+ { NULL, 0, 0, 0, 0 }
};
\f
#define TARGET_LITTLE_SYM bfd_elf32_v850_vec
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".plt.", 5) != 0
- && strncmp (name, ".got.plt.", 9) != 0
+ else if (! CONST_STRNEQ (name, ".plt.")
+ && ! CONST_STRNEQ (name, ".got.plt.")
&& strcmp (name, ".got") != 0
&& strcmp (name, ".plt") != 0
&& strcmp (name, ".got.plt") != 0
}
is_full_prop_section =
- ((strncmp (sec->name, XTENSA_PROP_SEC_NAME,
- sizeof (XTENSA_PROP_SEC_NAME) - 1) == 0)
- || (strncmp (sec->name, ".gnu.linkonce.prop.",
- sizeof ".gnu.linkonce.prop." - 1) == 0));
+ ( CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME)
+ || CONST_STRNEQ (sec->name, ".gnu.linkonce.prop."));
if (internal_relocs)
{
static int linkonce_len = sizeof (".gnu.linkonce.") - 1;
-static int insn_sec_len = sizeof (XTENSA_INSN_SEC_NAME) - 1;
-static int lit_sec_len = sizeof (XTENSA_LIT_SEC_NAME) - 1;
-static int prop_sec_len = sizeof (XTENSA_PROP_SEC_NAME) - 1;
-
static bfd_boolean
xtensa_is_property_section (asection *sec)
{
- if (strncmp (XTENSA_INSN_SEC_NAME, sec->name, insn_sec_len) == 0
- || strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0
- || strncmp (XTENSA_PROP_SEC_NAME, sec->name, prop_sec_len) == 0)
+ if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME)
+ || CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME)
+ || CONST_STRNEQ (sec->name, XTENSA_PROP_SEC_NAME))
return TRUE;
if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0
- && (strncmp (&sec->name[linkonce_len], "x.", 2) == 0
- || strncmp (&sec->name[linkonce_len], "p.", 2) == 0
- || strncmp (&sec->name[linkonce_len], "prop.", 5) == 0))
+ && (CONST_STRNEQ (&sec->name[linkonce_len], "x.")
+ || CONST_STRNEQ (&sec->name[linkonce_len], "p.")
+ || CONST_STRNEQ (&sec->name[linkonce_len], "prop.")))
return TRUE;
return FALSE;
static bfd_boolean
xtensa_is_littable_section (asection *sec)
{
- if (strncmp (XTENSA_LIT_SEC_NAME, sec->name, lit_sec_len) == 0)
+ if (CONST_STRNEQ (sec->name, XTENSA_LIT_SEC_NAME))
return TRUE;
if (strncmp (".gnu.linkonce.", sec->name, linkonce_len) == 0
suffix = sec->name + linkonce_len;
/* For backward compatibility, replace "t." instead of inserting
the new linkonce_kind (but not for "prop" sections). */
- if (strncmp (suffix, "t.", 2) == 0 && linkonce_kind[1] == '.')
+ if (CONST_STRNEQ (suffix, "t.") && linkonce_kind[1] == '.')
suffix += 2;
strcat (prop_sec_name + linkonce_len, suffix);
}
flagword
xtensa_get_property_predef_flags (asection *sec)
{
- if (strncmp (sec->name, XTENSA_INSN_SEC_NAME,
- sizeof (XTENSA_INSN_SEC_NAME) - 1) == 0
- || strncmp (sec->name, ".gnu.linkonce.x.",
- sizeof ".gnu.linkonce.x." - 1) == 0)
+ if (CONST_STRNEQ (sec->name, XTENSA_INSN_SEC_NAME)
+ || CONST_STRNEQ (sec->name, ".gnu.linkonce.x."))
return (XTENSA_PROP_INSN
| XTENSA_PROP_INSN_NO_TRANSFORM
| XTENSA_PROP_INSN_NO_REORDER);
/* ".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
- && strncmp (sec->name, ".plt", 4) == 0)
+ && CONST_STRNEQ (sec->name, ".plt"))
{
asection *sgotplt;
module loader so that the literals are not placed after the text. */
static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
{
- { ".fini.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".init.literal", 13, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { ".literal", 8, 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini.literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".init.literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { STRING_COMMA_LEN (".literal"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR },
+ { NULL, 0, 0, 0, 0 }
};
\f
#ifndef ELF_ARCH
if (rel_sec_name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (rel_sec_name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (rel_sec_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
rel_sec_name+5) == 0);
}
of the dynobj section names depend upon the input files. */
name = bfd_get_section_name (dynobj, s);
- if (strncmp (name, ".rela", 5) == 0)
+ if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".plt") != 0
&& strcmp (name, ".dynbss") != 0)
{
\f
static const struct bfd_elf_special_section elf64_alpha_special_sections[] =
{
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_ALPHA_GPREL },
+ { NULL, 0, 0, 0, 0 }
};
/* ECOFF swapping routines. These are used when dealing with the
if (srel_name == NULL)
return FALSE;
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
+ BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
- srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
+ srel_name + 5) == 0)
+ || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec),
- srel_name+4) == 0));
+ srel_name + 4) == 0));
dynobj = hppa_info->root.dynobj;
if (!dynobj)
plt = s->size != 0;
}
else if (strcmp (name, ".opd") == 0
- || strncmp (name, ".dlt", 4) == 0
+ || CONST_STRNEQ (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 (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
static const struct bfd_elf_special_section elf64_hppa_special_sections[] =
{
- { ".fini", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".init", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".plt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".dlt", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".sdata", 6, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".sbss", 5, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
- { ".tbss", 5, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".fini"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".init"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".plt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".dlt"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".sdata"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".sbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_PARISC_SHORT },
+ { STRING_COMMA_LEN (".tbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_HP_TLS },
+ { NULL, 0, 0, 0, 0 }
};
/* The hash bucket size is the standard one, namely 4. */
(*secp)->flags |= SEC_LINKER_CREATED;
}
else if ((*namep)[0] == '_' && (*namep)[1] == '_' && (*namep)[2] == '.'
- && strncmp (*namep, MMIX_LOC_SECTION_START_SYMBOL_PREFIX,
- strlen (MMIX_LOC_SECTION_START_SYMBOL_PREFIX)) == 0)
+ && CONST_STRNEQ (*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,
static const struct bfd_elf_special_section ppc64_elf_special_sections[]=
{
- { ".plt", 4, 0, SHT_NOBITS, 0 },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".toc", 4, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".toc1", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
- { ".tocbss", 7, 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".plt"), 0, SHT_NOBITS, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".toc1"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE },
+ { STRING_COMMA_LEN (".tocbss"), 0, SHT_NOBITS, SHF_ALLOC + SHF_WRITE },
+ { NULL, 0, 0, 0, 0 }
};
struct _ppc64_elf_section_data
|| h == &htab->tls_get_addr_fd->elf)
sec->has_tls_reloc = 1;
else if (htab->tls_get_addr == NULL
- && !strncmp (h->root.root.string, ".__tls_get_addr", 15)
+ && CONST_STRNEQ (h->root.root.string, ".__tls_get_addr")
&& (h->root.root.string[15] == 0
|| h->root.root.string[15] == '@'))
{
sec->has_tls_reloc = 1;
}
else if (htab->tls_get_addr_fd == NULL
- && !strncmp (h->root.root.string, "__tls_get_addr", 14)
+ && CONST_STRNEQ (h->root.root.string, "__tls_get_addr")
&& (h->root.root.string[14] == 0
|| h->root.root.string[14] == '@'))
{
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0)
{
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (input_bfd,
input_section),
name + 5) == 0);
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
/* Remember whether there is a PLT. */
plt = s->size != 0;
}
- else if (strncmp (name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (name, ".rela"))
{
if (s->size != 0)
{
s->reloc_count = 0;
}
}
- else if (strncmp (name, ".got", 4) != 0
+ else if (! CONST_STRNEQ (name, ".got")
&& strcmp (name, ".dynbss") != 0)
{
/* It's not one of our sections, so don't allocate space. */
static const struct bfd_elf_special_section sh64_elf64_special_sections[]=
{
- { ".cranges", 8, 0, SHT_PROGBITS, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".cranges"), 0, SHT_PROGBITS, 0 },
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_BIG_SYM bfd_elf64_sh64_vec
if (name == NULL)
return FALSE;
- if (strncmp (name, ".rela", 5) != 0
+ if (! CONST_STRNEQ (name, ".rela")
|| strcmp (bfd_get_section_name (abfd, sec),
name + 5) != 0)
{
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (bfd_get_section_name (dynobj, s), ".rela", 5) == 0)
+ else if (CONST_STRNEQ (bfd_get_section_name (dynobj, s), ".rela"))
{
if (s->size != 0 && s != htab->srelplt)
relocs = TRUE;
static const struct bfd_elf_special_section
elf64_x86_64_special_sections[]=
{
- { ".gnu.linkonce.lb", 16, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".gnu.linkonce.lr", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
- { ".gnu.linkonce.lt", 16, -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE},
- { ".lbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".ldata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
- { ".lrodata", 8, -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".gnu.linkonce.lb"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lr"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".gnu.linkonce.lt"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_EXECINSTR + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".ldata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_X86_64_LARGE},
+ { STRING_COMMA_LEN (".lrodata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_X86_64_LARGE},
+ { NULL, 0, 0, 0, 0 }
};
#define TARGET_LITTLE_SYM bfd_elf64_x86_64_vec
const char *name;
name = bfd_get_section_name (abfd, s);
- if (strncmp (name, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0)
+ if (CONST_STRNEQ (name, ".gnu.warning."))
{
char *msg;
bfd_size_type sz;
asection *stab;
for (stab = abfd->sections; stab; stab = stab->next)
- if (strncmp (".stab", stab->name, 5) == 0
+ if (CONST_STRNEQ (stab->name, ".stab")
&& (!stab->name[5] ||
(stab->name[5] == '.' && ISDIGIT (stab->name[6])))
&& (stab->flags & SEC_MERGE) == 0
for (o = sub->sections; o != NULL; o = o->next)
if (!o->gc_mark && o->gc_mark_from_eh && (o->flags & SEC_CODE) == 0)
{
- if (strncmp (o->name, ".gcc_except_table.", 18) == 0)
+ if (CONST_STRNEQ (o->name, ".gcc_except_table."))
{
unsigned long len;
char *fn_name;
fn_name = bfd_malloc (len + 6);
if (fn_name == NULL)
return FALSE;
- memcpy (fn_name, ".text.", 6);
+ memcpy (fn_name, STRING_COMMA_LEN (".text."));
memcpy (fn_name + 6, o->name + 18, len);
fn_text = bfd_get_section_by_name (sub, fn_name);
free (fn_name);
name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, ".gnu.linkonce.", sizeof (".gnu.linkonce.") - 1) == 0
+ if (CONST_STRNEQ (name, ".gnu.linkonce.")
&& (p = strchr (name + sizeof (".gnu.linkonce.") - 1, '.')) != NULL)
p++;
else
/* Return TRUE if NAME is an unwind table section name. */
static inline bfd_boolean
-is_unwind_section_name (abfd, name)
- bfd *abfd;
- const char *name;
+is_unwind_section_name (bfd *abfd, const char *name)
{
- size_t len1, len2, len3;
-
if (elfNN_ia64_hpux_vec (abfd->xvec)
&& !strcmp (name, ELF_STRING_ia64_unwind_hdr))
return FALSE;
- len1 = sizeof (ELF_STRING_ia64_unwind) - 1;
- len2 = sizeof (ELF_STRING_ia64_unwind_info) - 1;
- len3 = sizeof (ELF_STRING_ia64_unwind_once) - 1;
- return ((strncmp (name, ELF_STRING_ia64_unwind, len1) == 0
- && strncmp (name, ELF_STRING_ia64_unwind_info, len2) != 0)
- || strncmp (name, ELF_STRING_ia64_unwind_once, len3) == 0);
+ return ((CONST_STRNEQ (name, ELF_STRING_ia64_unwind)
+ && ! CONST_STRNEQ (name, ELF_STRING_ia64_unwind_info))
+ || CONST_STRNEQ (name, ELF_STRING_ia64_unwind_once));
}
/* Handle an IA-64 specific section when reading an object file. This
if (srel_name == NULL)
return NULL;
- BFD_ASSERT ((strncmp (srel_name, ".rela", 5) == 0
+ BFD_ASSERT ((CONST_STRNEQ (srel_name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+5) == 0)
- || (strncmp (srel_name, ".rel", 4) == 0
+ || (CONST_STRNEQ (srel_name, ".rel")
&& strcmp (bfd_get_section_name (abfd, sec),
srel_name+4) == 0));
if (strcmp (name, ".got.plt") == 0)
strip = FALSE;
- else if (strncmp (name, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (name, ".rel"))
{
if (!strip)
{
static const struct bfd_elf_special_section elfNN_ia64_special_sections[] =
{
- { ".sbss", 5, -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { ".sdata", 6, -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".sbss"), -1, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { STRING_COMMA_LEN (".sdata"), -1, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_IA_64_SHORT },
+ { NULL, 0, 0, 0, 0 }
};
static bfd_boolean
if (elf_sec_group (sec) == NULL
&& ((sec->flags & (SEC_LINK_ONCE | SEC_CODE | SEC_GROUP))
== (SEC_LINK_ONCE | SEC_CODE))
- && strncmp (sec->name, ".gnu.linkonce.t.", 16) == 0)
+ && CONST_STRNEQ (sec->name, ".gnu.linkonce.t."))
{
name = sec->name + 16;
sec = NULL;
for (o = input_bfd->sections; o != NULL; o = o->next)
{
- if (strncmp (bfd_get_section_name (input_bfd, o),
- CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ if (CONST_STRNEQ (bfd_get_section_name (input_bfd, o),
+ CALL_FP_STUB))
{
sec = h->call_fp_stub;
break;
{
const char *name = bfd_get_section_name (abfd, section);
- return (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0
- || strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0);
+ return (CONST_STRNEQ (name, FN_STUB)
+ || CONST_STRNEQ (name, CALL_STUB)
+ || CONST_STRNEQ (name, CALL_FP_STUB));
}
\f
/* Add room for N relocations to the .rel(a).dyn section in ABFD. */
return FALSE;
break;
case SHT_MIPS_GPTAB:
- if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) != 0)
+ if (! CONST_STRNEQ (name, ".gptab."))
return FALSE;
break;
case SHT_MIPS_UCODE:
return FALSE;
break;
case SHT_MIPS_CONTENT:
- if (strncmp (name, ".MIPS.content", sizeof ".MIPS.content" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".MIPS.content"))
return FALSE;
break;
case SHT_MIPS_OPTIONS:
return FALSE;
break;
case SHT_MIPS_DWARF:
- if (strncmp (name, ".debug_", sizeof ".debug_" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".debug_"))
return FALSE;
break;
case SHT_MIPS_SYMBOL_LIB:
return FALSE;
break;
case SHT_MIPS_EVENTS:
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) != 0
- && strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) != 0)
+ if (! CONST_STRNEQ (name, ".MIPS.events")
+ && ! CONST_STRNEQ (name, ".MIPS.post_rel"))
return FALSE;
break;
default:
}
else if (strcmp (name, ".conflict") == 0)
hdr->sh_type = SHT_MIPS_CONFLICT;
- else if (strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ else if (CONST_STRNEQ (name, ".gptab."))
{
hdr->sh_type = SHT_MIPS_GPTAB;
hdr->sh_entsize = sizeof (Elf32_External_gptab);
hdr->sh_type = SHT_MIPS_IFACE;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
}
- else if (strncmp (name, ".MIPS.content", strlen (".MIPS.content")) == 0)
+ else if (CONST_STRNEQ (name, ".MIPS.content"))
{
hdr->sh_type = SHT_MIPS_CONTENT;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
hdr->sh_entsize = 1;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
}
- else if (strncmp (name, ".debug_", sizeof ".debug_" - 1) == 0)
+ else if (CONST_STRNEQ (name, ".debug_"))
hdr->sh_type = SHT_MIPS_DWARF;
else if (strcmp (name, ".MIPS.symlib") == 0)
{
/* The sh_link and sh_info fields are set in
final_write_processing. */
}
- else if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0
- || strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0)
+ else if (CONST_STRNEQ (name, ".MIPS.events")
+ || CONST_STRNEQ (name, ".MIPS.post_rel"))
{
hdr->sh_type = SHT_MIPS_EVENTS;
hdr->sh_flags |= SHF_MIPS_NOSTRIP;
/* Check for the mips16 stub sections. */
name = bfd_get_section_name (abfd, sec);
- if (strncmp (name, FN_STUB, sizeof FN_STUB - 1) == 0)
+ if (CONST_STRNEQ (name, FN_STUB))
{
unsigned long r_symndx;
/* We can ignore stub sections when looking for relocs. */
if ((o->flags & SEC_RELOC) == 0
|| o->reloc_count == 0
- || strncmp (bfd_get_section_name (abfd, o), FN_STUB,
- sizeof FN_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_STUB,
- sizeof CALL_STUB - 1) == 0
- || strncmp (bfd_get_section_name (abfd, o), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) == 0)
+ || CONST_STRNEQ (bfd_get_section_name (abfd, o), FN_STUB)
+ || CONST_STRNEQ (bfd_get_section_name (abfd, o), CALL_STUB)
+ || CONST_STRNEQ (bfd_get_section_name (abfd, o), CALL_FP_STUB))
continue;
sec_relocs
mips_elf_hash_table (info)->mips16_stubs_seen = TRUE;
}
}
- else if (strncmp (name, CALL_STUB, sizeof CALL_STUB - 1) == 0
- || strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ else if (CONST_STRNEQ (name, CALL_STUB)
+ || CONST_STRNEQ (name, CALL_FP_STUB))
{
unsigned long r_symndx;
struct mips_elf_link_hash_entry *h;
/* H is the symbol this stub is for. */
- if (strncmp (name, CALL_FP_STUB, sizeof CALL_FP_STUB - 1) == 0)
+ if (CONST_STRNEQ (name, CALL_FP_STUB))
loc = &h->call_fp_stub;
else
loc = &h->call_stub;
References from a stub section do not count. */
if (h != NULL
&& r_type != R_MIPS16_26
- && strncmp (bfd_get_section_name (abfd, sec), FN_STUB,
- sizeof FN_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_STUB,
- sizeof CALL_STUB - 1) != 0
- && strncmp (bfd_get_section_name (abfd, sec), CALL_FP_STUB,
- sizeof CALL_FP_STUB - 1) != 0)
+ && ! CONST_STRNEQ (bfd_get_section_name (abfd, sec), FN_STUB)
+ && ! CONST_STRNEQ (bfd_get_section_name (abfd, sec), CALL_STUB)
+ && ! CONST_STRNEQ (bfd_get_section_name (abfd, sec), CALL_FP_STUB))
{
struct mips_elf_link_hash_entry *mh;
if ((s->flags & SEC_LINKER_CREATED) == 0)
continue;
- if (strncmp (name, ".rel", 4) == 0)
+ if (CONST_STRNEQ (name, ".rel"))
{
if (s->size != 0)
{
mips_elf_allocate_dynamic_relocations (dynobj, info, count);
}
}
- else if (!htab->is_vxworks && strncmp (name, ".got", 4) == 0)
+ else if (!htab->is_vxworks && CONST_STRNEQ (name, ".got"))
{
/* _bfd_mips_elf_always_size_sections() has already done
most of the work, but some symbols may have been mapped
}
else if (! info->shared
&& ! mips_elf_hash_table (info)->use_rld_obj_head
- && strncmp (name, ".rld_map", 8) == 0)
+ && CONST_STRNEQ (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 += 4;
}
else if (SGI_COMPAT (output_bfd)
- && strncmp (name, ".compact_rel", 12) == 0)
+ && CONST_STRNEQ (name, ".compact_rel"))
s->size += mips_elf_hash_table (info)->compact_rel_size;
- else if (strncmp (name, ".init", 5) != 0
+ else if (! CONST_STRNEQ (name, ".init")
&& s != htab->sgotplt
&& s != htab->splt)
{
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && strncmp (name, ".gptab.", sizeof ".gptab." - 1) == 0);
+ && CONST_STRNEQ (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;
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL
- && strncmp (name, ".MIPS.content",
- sizeof ".MIPS.content" - 1) == 0);
+ && CONST_STRNEQ (name, ".MIPS.content"));
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.content" - 1);
BFD_ASSERT (sec != NULL);
BFD_ASSERT ((*hdrpp)->bfd_section != NULL);
name = bfd_get_section_name (abfd, (*hdrpp)->bfd_section);
BFD_ASSERT (name != NULL);
- if (strncmp (name, ".MIPS.events", sizeof ".MIPS.events" - 1) == 0)
+ if (CONST_STRNEQ (name, ".MIPS.events"))
sec = bfd_get_section_by_name (abfd,
name + sizeof ".MIPS.events" - 1);
else
{
- BFD_ASSERT (strncmp (name, ".MIPS.post_rel",
- sizeof ".MIPS.post_rel" - 1) == 0);
+ BFD_ASSERT (CONST_STRNEQ (name, ".MIPS.post_rel"));
sec = bfd_get_section_by_name (abfd,
(name
+ sizeof ".MIPS.post_rel" - 1));
mdebug_sec = o;
}
- if (strncmp (o->name, ".gptab.", sizeof ".gptab." - 1) == 0)
+ if (CONST_STRNEQ (o->name, ".gptab."))
{
const char *subname;
unsigned int c;
const struct bfd_elf_special_section _bfd_mips_elf_special_sections[] =
{
- { ".lit4", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".lit8", 5, 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".mdebug", 7, 0, SHT_MIPS_DEBUG, 0 },
- { ".sbss", 5, -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".sdata", 6, -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
- { ".ucode", 6, 0, SHT_MIPS_UCODE, 0 },
- { NULL, 0, 0, 0, 0 }
+ { STRING_COMMA_LEN (".lit4"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".lit8"), 0, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".mdebug"), 0, SHT_MIPS_DEBUG, 0 },
+ { STRING_COMMA_LEN (".sbss"), -2, SHT_NOBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".sdata"), -2, SHT_PROGBITS, SHF_ALLOC + SHF_WRITE + SHF_MIPS_GPREL },
+ { STRING_COMMA_LEN (".ucode"), 0, SHT_MIPS_UCODE, 0 },
+ { NULL, 0, 0, 0, 0 }
};
/* Merge non visibility st_other attributes. Ensure that the
if (name == NULL)
return FALSE;
- BFD_ASSERT (strncmp (name, ".rela", 5) == 0
+ BFD_ASSERT (CONST_STRNEQ (name, ".rela")
&& strcmp (bfd_get_section_name (abfd, sec),
name + 5) == 0);
/* Strip this section if we don't need it; see the
comment below. */
}
- else if (strncmp (s->name, ".rela", 5) == 0)
+ else if (CONST_STRNEQ (s->name, ".rela"))
{
if (s->size != 0)
{
asection *sect,
void *obj ATTRIBUTE_UNUSED)
{
- return (strncmp (sect->name, ".reg/", 5) == 0);
+ return CONST_STRNEQ (sect->name, ".reg/");
}
/* this function builds a bfd target if the file is a corefile.
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
family[9] = '\0';
}
}
- else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
- || (strncmp (processor, "CPU32", 5) == 0))
+ else if ((CONST_STRNEQ (processor, "cpu32")) /* CPU32 and CPU32+ */
+ || (CONST_STRNEQ (processor, "CPU32")))
strcpy (family, "68332");
else
{
/* Support for the generic parts of PE/PEI; common header information.
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
Written by Cygnus Solutions.
#endif /* !COFF_WITH_pep */
/* Macro: Returns true if the bfd is a PE executable as opposed to a PE object file. */
-#define bfd_pe_executable_p(abfd) \
- (strncmp ((abfd)->xvec->name, "pei-", 4) == 0 \
- || strncmp ((abfd)->xvec->name, "efi-app-", 8) == 0)
+#define bfd_pe_executable_p(abfd) \
+ (CONST_STRNEQ ((abfd)->xvec->name, "pei-") \
+ || CONST_STRNEQ ((abfd)->xvec->name, "efi-app-"))
/* These functions are architecture dependent, and are in peicode.h:
coff_swap_reloc_in
#undef WRAP
-#undef REAL
+#undef REAL
#define REAL "__real_"
if (*l == '_'
- && strncmp (l, REAL, sizeof REAL - 1) == 0
+ && CONST_STRNEQ (l, REAL)
&& bfd_hash_lookup (info->wrap_hash, l + sizeof REAL - 1,
FALSE, FALSE) != NULL)
{
s = name + 1;
while (*s == '_')
++s;
- if (s[0] == 'G'
- && strncmp (s, CONS_PREFIX, CONS_PREFIX_LEN - 1) == 0)
+ if (s[0] == 'G' && CONST_STRNEQ (s, CONS_PREFIX))
{
char c;
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
bfd_set_error (bfd_error_bad_value);
return FALSE;
}
- else if (strncmp (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX,
- strlen (MMIX_OTHER_SPEC_SECTION_PREFIX)) == 0)
+ else if (CONST_STRNEQ (sec->name, MMIX_OTHER_SPEC_SECTION_PREFIX))
{
int n = atoi (sec->name + strlen (MMIX_OTHER_SPEC_SECTION_PREFIX));
+
mmo_write_tetra_raw (abfd, (LOP << 24) | (LOP_SPEC << 16) | n);
return (! abfd->tdata.mmo_data->have_error
&& mmo_write_chunk_list (abfd, mmo_section_data (sec)->head));
return FALSE;
if (bfd_seek (abfd, position, SEEK_SET) != 0)
return FALSE;
- if (strncmp (tempstr, "VeRsIoN#", 8) == 0)
+ if (CONST_STRNEQ (tempstr, "VeRsIoN#"))
{
Nlm_External_Version_Header thdr;
nlm_version_header (abfd)->day =
get_word (abfd, (bfd_byte *) thdr.day);
}
- else if (strncmp (tempstr, "MeSsAgEs", 8) == 0)
+ else if (CONST_STRNEQ (tempstr, "MeSsAgEs"))
{
Nlm_External_Extended_Header thdr;
nlm_extended_header (abfd)->reserved5 =
get_word (abfd, (bfd_byte *) thdr.reserved5);
}
- else if (strncmp (tempstr, "CoPyRiGhT=", 10) == 0)
+ else if (CONST_STRNEQ (tempstr, "CoPyRiGhT="))
{
amt = sizeof (nlm_copyright_header (abfd)->stamp);
if (bfd_bread ((void *) nlm_copyright_header (abfd)->stamp,
amt, abfd) != amt)
return FALSE;
}
- else if (strncmp (tempstr, "CuStHeAd", 8) == 0)
+ else if (CONST_STRNEQ (tempstr, "CuStHeAd"))
{
Nlm_External_Custom_Header thdr;
bfd_size_type hdrLength;
/* If we have found a Cygnus header, process it. Otherwise,
just save the associated data without trying to interpret
it. */
- if (strncmp (dataStamp, "CyGnUsEx", 8) == 0)
+ if (CONST_STRNEQ (dataStamp, "CyGnUsEx"))
{
file_ptr pos;
bfd_byte *contents;
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return FALSE;
- memcpy (nlm_cygnus_ext_header (abfd), "CyGnUsEx", 8);
+ memcpy (nlm_cygnus_ext_header (abfd), STRING_COMMA_LEN ("CyGnUsEx"));
nlm_cygnus_ext_header (abfd)->offset = dataOffset;
nlm_cygnus_ext_header (abfd)->length = dataLength;
{
Nlm_External_Version_Header thdr;
- memcpy (thdr.stamp, "VeRsIoN#", 8);
+ memcpy (thdr.stamp, STRING_COMMA_LEN ("VeRsIoN#"));
put_word (abfd, (bfd_vma) nlm_version_header (abfd)->majorVersion,
(bfd_byte *) thdr.majorVersion);
put_word (abfd, (bfd_vma) nlm_version_header (abfd)->minorVersion,
{
Nlm_External_Copyright_Header thdr;
- memcpy (thdr.stamp, "CoPyRiGhT=", 10);
+ memcpy (thdr.stamp, STRING_COMMA_LEN ("CoPyRiGhT="));
amt = sizeof (thdr.stamp);
if (bfd_bwrite ((void *) thdr.stamp, amt, abfd) != amt)
return FALSE;
{
Nlm_External_Extended_Header thdr;
- memcpy (thdr.stamp, "MeSsAgEs", 8);
+ memcpy (thdr.stamp, STRING_COMMA_LEN ("MeSsAgEs"));
put_word (abfd,
(bfd_vma) nlm_extended_header (abfd)->languageID,
(bfd_byte *) thdr.languageID);
ds = find_nonzero (nlm_custom_header (abfd)->dataStamp,
sizeof (nlm_custom_header (abfd)->dataStamp));
- memcpy (thdr.stamp, "CuStHeAd", 8);
+ memcpy (thdr.stamp, STRING_COMMA_LEN ("CuStHeAd"));
hdrLength = (2 * NLM_TARGET_LONG_SIZE + (ds ? 8 : 0)
+ nlm_custom_header (abfd)->hdrLength);
put_word (abfd, hdrLength, thdr.length);
{
Nlm_External_Custom_Header thdr;
- memcpy (thdr.stamp, "CuStHeAd", 8);
+ memcpy (thdr.stamp, STRING_COMMA_LEN ("CuStHeAd"));
put_word (abfd, (bfd_vma) 2 * NLM_TARGET_LONG_SIZE + 8,
(bfd_byte *) thdr.length);
put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->offset,
(bfd_byte *) thdr.dataOffset);
put_word (abfd, (bfd_vma) nlm_cygnus_ext_header (abfd)->length,
(bfd_byte *) thdr.dataLength);
- memcpy (thdr.dataStamp, "CyGnUsEx", 8);
+ memcpy (thdr.dataStamp, STRING_COMMA_LEN ("CyGnUsEx"));
amt = sizeof (thdr);
if (bfd_bwrite ((void *) &thdr, amt, abfd) != amt)
return FALSE;
if (val != sizeof core_header)
return NULL;
- if (strncmp (core_header.magic, "Core", 4) != 0)
+ if (! CONST_STRNEQ (core_header.magic, "Core"))
return NULL;
core_hdr (abfd) = (struct osf_core_struct *)
default:
bfd_print_symbol_vandf (abfd, (void *) file, symbol);
fprintf (file, " %-5s %s", symbol->section->name, symbol->name);
- if (strncmp (symbol->name, "__traceback_", strlen ("__traceback_")) == 0)
+ if (CONST_STRNEQ (symbol->name, "__traceback_"))
{
unsigned char *buf = alloca (symbol->udata.i);
size_t offset = symbol->value + 4;
&& sym->symbol.name[strlen (sym->symbol.name) - 1] == '$'
&& !strcmp (sym->symbol.name, sym->symbol.section->name))
sym->symbol.flags |= BSF_SECTION_SYM;
- else if (!strncmp (sym->symbol.name, "L$0\002", 4))
+ else if (CONST_STRNEQ (sym->symbol.name, "L$0\002"))
{
sym->symbol.flags |= BSF_SECTION_SYM;
sym->symbol.name = sym->symbol.section->name;
}
- else if (!strncmp (sym->symbol.name, "L$0\001", 4))
+ else if (CONST_STRNEQ (sym->symbol.name, "L$0\001"))
sym->symbol.flags |= BSF_DEBUGGING;
/* Note increment at bottom of loop, since we skip some symbols
return FALSE;
/* For archives without .o files there is no symbol table. */
- if (strncmp (nextname, "/ ", 16))
+ if (! CONST_STRNEQ (nextname, "/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
2003, 2004, 2006 Free Software Foundation, Inc.
-This file is part of BFD, the Binary File Descriptor library.
+ This file is part of BFD, the Binary File Descriptor library.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
-USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
+ USA. */
#define TARGET_PAGE_SIZE 4096
#define ZMAGIC_DISK_BLOCK_SIZE 1024
#define GOT_REF_PREFIX "__GOT_"
#endif
-#define IS_GOT_SYM(name) \
- (strncmp (name, GOT_REF_PREFIX, sizeof GOT_REF_PREFIX - 1) == 0)
+#define IS_GOT_SYM(name) (CONST_STRNEQ (name, GOT_REF_PREFIX))
/* See if a symbol name is a reference to the procedure linkage table. */
#define PLT_REF_PREFIX "__PLT_"
#endif
-#define IS_PLT_SYM(name) \
- (strncmp (name, PLT_REF_PREFIX, sizeof PLT_REF_PREFIX - 1) == 0)
+#define IS_PLT_SYM(name) (CONST_STRNEQ (name, PLT_REF_PREFIX))
/* This string is used to generate specialized error messages. */
This function is called via linux_link_hash_traverse. */
static bfd_boolean
-linux_tally_symbols (h, data)
- struct linux_link_hash_entry *h;
- PTR data;
+linux_tally_symbols (struct linux_link_hash_entry *h, void * data)
{
struct bfd_link_info *info = (struct bfd_link_info *) data;
struct fixup *f, *f1;
h = (struct linux_link_hash_entry *) h->root.root.u.i.link;
if (h->root.root.type == bfd_link_hash_undefined
- && strncmp (h->root.root.root.string, NEEDS_SHRLIB,
- sizeof NEEDS_SHRLIB - 1) == 0)
+ && CONST_STRNEQ (h->root.root.root.string, NEEDS_SHRLIB))
{
const char *name;
char *p;
/* vms-hdr.c -- BFD back-end for VMS/VAX (openVMS/VAX) and
EVAX (openVMS/Alpha) files.
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006
Free Software Foundation, Inc.
HDR record handling functions
/* LMN. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_LNM);
- _bfd_vms_output_dump (abfd, (unsigned char *)"GAS proGIS", 10);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("GAS proGIS"));
_bfd_vms_output_flush (abfd);
/* SRC. */
if (symbol->flags & BSF_FILE)
{
- if (strncmp ((char *)symbol->name, "<CASE:", 6) == 0)
+ if (CONST_STRNEQ ((char *)symbol->name, "<CASE:"))
{
PRIV (flag_hash_long_names) = symbol->name[6] - '0';
PRIV (flag_show_after_trunc) = symbol->name[7] - '0';
}
if (symnum == abfd->symcount)
- _bfd_vms_output_dump (abfd, (unsigned char *)"noname", 6);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("noname"));
_bfd_vms_output_flush (abfd);
/* TTL. */
_bfd_vms_output_begin (abfd, EOBJ_S_C_EMH, EMH_S_C_TTL);
- _bfd_vms_output_dump (abfd, (unsigned char *)"TTL", 3);
+ _bfd_vms_output_dump (abfd, (unsigned char *) STRING_COMMA_LEN ("TTL"));
_bfd_vms_output_flush (abfd);
/* CPR. */
+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * ar.c: Make use of new STRING_COMMA_LEN and CONST_STRNEQ
+ macros defined in bfd.h.
+ * dlltool.c: Likewise.
+ * emul_aix.c: Likewise.
+ * nlmconv.c: Likewise.
+ * objdump.c: Likewise.
+ * prdbg.c: Likewise.
+ * stabs.c: Likewise.
+ * readelf.c (const_strneq): New macro.
+ (process_section_headers, slurp_ia64_unwind_table,
+ slurp_hppa_unwind_table, display_debug_section, process_notes,
+ process_archive): Use the new macro.
+
2006-09-14 H.J. Lu <hongjiu.lu@intel.com>
PR binutils/3181
usage (0);
if (strcmp (argv[1], "-V") == 0
|| strcmp (argv[1], "-v") == 0
- || strncmp (argv[1], "--v", 3) == 0)
+ || CONST_STRNEQ (argv[1], "--v"))
print_version ("ranlib");
arg_index = 1;
if (strcmp (argv[1], "-t") == 0)
while (p < e)
{
if (p[0] == '-'
- && strncmp (p, "-export:", 8) == 0)
+ && CONST_STRNEQ (p, "-export:"))
{
char * name;
char * c;
char *tag_start = ++p;
while (p < e && *p != ' ' && *p != '-')
p++;
- if (strncmp (tag_start, "data", 4) == 0)
+ if (CONST_STRNEQ (tag_start, "data"))
flags &= ~BSF_FUNCTION;
}
/* Binutils emulation layer.
- Copyright 2002, 2003 Free Software Foundation, Inc.
+ Copyright 2002, 2003, 2006 Free Software Foundation, Inc.
Written by Tom Rix, Red Hat Inc.
This file is part of GNU Binutils.
static bfd_boolean
ar_emul_aix_parse_arg (char *arg)
{
- if (strncmp (arg, "-X32_64", 6) == 0)
+ if (CONST_STRNEQ (arg, "-X32_64"))
{
big_archive = TRUE;
X32 = TRUE;
X64 = TRUE;
}
- else if (strncmp (arg, "-X32", 3) == 0)
+ else if (CONST_STRNEQ (arg, "-X32"))
{
big_archive = TRUE;
X32 = TRUE;
X64 = FALSE;
}
- else if (strncmp (arg, "-X64", 3) == 0)
+ else if (CONST_STRNEQ (arg, "-X64"))
{
big_archive = TRUE;
X32 = FALSE;
X64 = TRUE;
}
- else if (strncmp (arg, "-g", 2) == 0)
+ else if (CONST_STRNEQ (arg, "-g"))
{
big_archive = FALSE;
X32 = TRUE;
/* nlmconv.c -- NLM conversion program
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Binutils.
|| ! bfd_set_section_flags (outbfd, help_section,
SEC_HAS_CONTENTS))
bfd_fatal (_("help section"));
- strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+ CONST_STRNCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
}
}
if (message_file != NULL)
|| ! bfd_set_section_flags (outbfd, message_section,
SEC_HAS_CONTENTS))
bfd_fatal (_("message section"));
- strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+ CONST_STRNCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
}
}
if (modules != NULL)
|| ! bfd_set_section_flags (outbfd, rpc_section,
SEC_HAS_CONTENTS))
bfd_fatal (_("rpc section"));
- strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+ CONST_STRNCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
}
}
if (sharelib_file != NULL)
|| ! bfd_set_section_flags (outbfd, shared_section,
SEC_HAS_CONTENTS))
bfd_fatal (_("shared section"));
- strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+ CONST_STRNCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
}
}
}
/* Check whether a version was given. */
- if (strncmp (version_hdr->stamp, "VeRsIoN#", 8) != 0)
+ if (!CONST_STRNEQ (version_hdr->stamp, "VeRsIoN#"))
non_fatal (_("warning: No version number given"));
/* At least for now, always create an extended header, because that
is what NLMLINK does. */
- strncpy (nlm_extended_header (outbfd)->stamp, "MeSsAgEs", 8);
+ CONST_STRNCPY (nlm_extended_header (outbfd)->stamp, "MeSsAgEs");
- strncpy (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx", 8);
+ CONST_STRNCPY (nlm_cygnus_ext_header (outbfd)->stamp, "CyGnUsEx");
/* If the date was not given, force it in. */
if (nlm_version_header (outbfd)->month == 0
nlm_version_header (outbfd)->month = ptm->tm_mon + 1;
nlm_version_header (outbfd)->day = ptm->tm_mday;
nlm_version_header (outbfd)->year = ptm->tm_year + 1900;
- strncpy (version_hdr->stamp, "VeRsIoN#", 8);
+ CONST_STRNCPY (version_hdr->stamp, "VeRsIoN#");
}
#ifdef NLMCONV_POWERPC
const char *match;
enum dwarf_section_display_enum i;
- if (strncmp (name, ".gnu.linkonce.wi.", 17) == 0)
+ if (CONST_STRNEQ (name, ".gnu.linkonce.wi."))
match = ".debug_info";
else
match = name;
/* prdbg.c -- Print out generic debugging information.
- Copyright 1995, 1996, 1999, 2002, 2003, 2004
+ Copyright 1995, 1996, 1999, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
Tags style generation written by Salvador E. Tropea <set@computer.org>.
domain_type = pop_type (info);
if (domain_type == NULL)
return FALSE;
- if (strncmp (domain_type, "class ", sizeof "class " - 1) == 0
+ if (CONST_STRNEQ (domain_type, "class ")
&& strchr (domain_type + sizeof "class " - 1, ' ') == NULL)
domain_type += sizeof "class " - 1;
- else if (strncmp (domain_type, "union class ",
- sizeof "union class ") == 0
+ else if (CONST_STRNEQ (domain_type, "union class ")
&& (strchr (domain_type + sizeof "union class " - 1, ' ')
== NULL))
domain_type += sizeof "union class " - 1;
if (t == NULL)
return FALSE;
- if (strncmp (t, "class ", sizeof "class " - 1) == 0)
+ if (CONST_STRNEQ (t, "class "))
t += sizeof "class " - 1;
/* Push it back on to take advantage of the prepend_type and
if (! full_name)
return FALSE;
memcpy (full_name, info->stack->next->type, len_class);
- memcpy (full_name + len_class, "::", 2);
+ memcpy (full_name + len_class, STRING_COMMA_LEN ("::"));
memcpy (full_name + len_class + 2, name, len_var + 1);
if (! substitute_type (info, full_name))
if (t == NULL)
return FALSE;
- if (strncmp (t, "class ", sizeof "class " - 1) == 0)
+ if (CONST_STRNEQ (t, "class "))
t += sizeof "class " - 1;
/* Push it back on to take advantage of the prepend_type and
/* This is just a bit of syntatic sugar. */
#define streq(a,b) (strcmp ((a), (b)) == 0)
#define strneq(a,b,n) (strncmp ((a), (b), (n)) == 0)
+#define const_strneq(a,b) (strncmp ((a), (b), sizeof (b) - 1) == 0)
\f
static void *
get_data (void *var, FILE *file, long offset, size_t size, size_t nmemb,
case EM_BLACKFIN:
rtype = elf_bfin_reloc_type (type);
break;
-
}
if (rtype == NULL)
char const *isa = _("unknown");
char const *mac = _("unknown mac");
char const *additional = NULL;
-
+
switch (e_flags & EF_M68K_ISA_MASK)
{
case EF_M68K_ISA_A_NODIV:
case EM_CYGNUS_M32R:
if ((e_flags & EF_M32R_ARCH) == E_M32R_ARCH)
strcat (buf, ", m32r");
-
break;
case EM_MIPS:
|| do_debug_lines || do_debug_pubnames || do_debug_aranges
|| do_debug_frames || do_debug_macinfo || do_debug_str
|| do_debug_loc || do_debug_ranges)
- && strneq (name, ".debug_", 7))
+ && const_strneq (name, ".debug_"))
{
name += 7;
}
/* linkonce section to be combined with .debug_info at link time. */
else if ((do_debugging || do_debug_info)
- && strneq (name, ".gnu.linkonce.wi.", 17))
+ && const_strneq (name, ".gnu.linkonce.wi."))
request_dump (i, DEBUG_DUMP);
else if (do_debug_frames && streq (name, ".eh_frame"))
request_dump (i, DEBUG_DUMP);
sym = aux->symtab + ELF64_R_SYM (rp->r_info);
}
- if (! strneq (relname, "R_IA64_SEGREL", 13))
+ if (! const_strneq (relname, "R_IA64_SEGREL"))
{
warn (_("Skipping unexpected relocation type %s\n"), relname);
continue;
}
/* R_PARISC_SEGREL32 or R_PARISC_SEGREL64. */
- if (strncmp (relname, "R_PARISC_SEGREL", 15) != 0)
+ if (! const_strneq (relname, "R_PARISC_SEGREL"))
{
warn (_("Skipping unexpected relocation type %s\n"), relname);
continue;
return 0;
}
- if (strneq (name, ".gnu.linkonce.wi.", 17))
+ if (const_strneq (name, ".gnu.linkonce.wi."))
name = ".debug_info";
/* See if we know how to display the contents of this section. */
note type strings. */
nt = get_note_type (pnote->type);
- else if (strneq (pnote->namedata, "NetBSD-CORE", 11))
+ else if (const_strneq (pnote->namedata, "NetBSD-CORE"))
/* NetBSD-specific core file notes. */
nt = get_netbsd_elfcore_note_type (pnote->type);
return 1;
}
- if (memcmp (arhdr.ar_name, "/ ", 16) == 0)
+ if (const_strneq (arhdr.ar_name, "/ "))
{
/* This is the archive symbol table. Skip it.
FIXME: We should have an option to dump it. */
}
}
- if (memcmp (arhdr.ar_name, "// ", 16) == 0)
+ if (const_strneq (arhdr.ar_name, "// "))
{
/* This is the archive string table holding long member
names. */
/* stabs.c -- Parse stabs debugging information
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
#define ULLHIGH "01777777777777777777777;"
if (index_type == DEBUG_TYPE_NULL)
{
- if (strncmp (s2, LLLOW, sizeof LLLOW - 1) == 0
- && strncmp (s3, LLHIGH, sizeof LLHIGH - 1) == 0)
+ if (CONST_STRNEQ (s2, LLLOW)
+ && CONST_STRNEQ (s3, LLHIGH))
return debug_make_int_type (dhandle, 8, FALSE);
if (! ov2
&& n2 == 0
- && strncmp (s3, ULLHIGH, sizeof ULLHIGH - 1) == 0)
+ && CONST_STRNEQ (s3, ULLHIGH))
return debug_make_int_type (dhandle, 8, TRUE);
}
&& (ISDIGIT (argtypes[2])
|| argtypes[2] == 'Q'
|| argtypes[2] == 't'))
- || strncmp (argtypes, "__ct", 4) == 0);
+ || CONST_STRNEQ (argtypes, "__ct"));
is_constructor = (is_full_physname_constructor
|| (tagname != NULL
is_destructor = ((argtypes[0] == '_'
&& (argtypes[1] == '$' || argtypes[1] == '.')
&& argtypes[2] == '_')
- || strncmp (argtypes, "__dt", 4) == 0);
+ || CONST_STRNEQ (argtypes, "__dt"));
is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
if (is_destructor || is_full_physname_constructor || is_v3)
*pp = scan + 2;
if (*pp - name >= 5
- && strncmp (name, "type", 4) == 0
+ && CONST_STRNEQ (name, "type")
&& (name[4] == '$' || name[4] == '.'))
{
const char *tem;
+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * ldctor.c: Make use of new STRING_COMMA_LEN and CONST_STRNEQ
+ macros defined in bfd.h.
+ * ldmain.c: Likewise.
+ * ldwrite.c: Likewise.
+ * lexsup.c: Likewise.
+ * pe-dll.c: Likewise.
+ * emultempl/aix.em: Likewise.
+ * emultempl/beos.em: Likewise.
+ * emultempl/elf32.em: Likewise.
+ * emultempl/pe.em: Likewise.
+ * emultempl/sunos.em: Likewise.
+ * emultempl/xtensaelf.em: Likewise.
+
2006-09-15 Nick Clifton <nickc@redhat.com>
PR ld/3107
/* AIX emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005
+ 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
AIX support by Ian Lance Taylor <ian@cygnus.com>
if (indx == 0)
indx = 1;
- if (indx < argc && strncmp (argv[indx], "-b", 2) == 0)
+ if (indx < argc && CONST_STRNEQ (argv[indx], "-b"))
{
char *s;
cat >e${EMULATION_NAME}.c <<EOF
/* This file is part of GLD, the Gnu Linker.
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005 Free Software Foundation, Inc.
+ 2005, 2006 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
const lang_statement_union_type *const *rb = b;
int i;
i = strcmp ((*ra)->input_section.section->name,
- (*rb)->input_section.section->name);
-/* this is a hack to make .stab and .stabstr last, so we don't have
- to fix strip/objcopy for .reloc sections.
- FIXME stripping images with a .rsrc section still needs to be fixed */
- if ( i != 0)
+ (*rb)->input_section.section->name);
+ /* This is a hack to make .stab and .stabstr last, so we don't have
+ to fix strip/objcopy for .reloc sections.
+ FIXME stripping images with a .rsrc section still needs to be fixed. */
+ if (i != 0)
{
- if ((strncmp ((*ra)->input_section.section->name, ".stab", 5) == 0)
- && (strncmp ((*rb)->input_section.section->name, ".stab", 5) != 0))
+ if ((CONST_STRNEQ ((*ra)->input_section.section->name, ".stab"))
+ && (! CONST_STRNEQ ((*rb)->input_section.section->name, ".stab")))
return 1;
- return i;
}
return i;
}
{
/* Is this the .idata section? */
if (sec->spec.name != NULL
- && strncmp (sec->spec.name, ".idata", 6) == 0)
+ && CONST_STRNEQ (sec->spec.name, ".idata"))
{
/* Sort the children. We want to sort any objects in
the same archive. In order to handle the case of
struct bfd_link_needed_list *l;
for (l = needed; l != NULL; l = l->next)
- if (strncmp (l->name, "libc.so", 7) == 0)
+ if (CONST_STRNEQ (l->name, "libc.so"))
break;
if (l == NULL)
{
if (p[0] == '\0')
continue;
- if (!strncmp (p, "include", 7) && (p[7] == ' ' || p[7] == '\t'))
+ if (CONST_STRNEQ (p, "include") && (p[7] == ' ' || p[7] == '\t'))
{
char *dir, c;
p += 8;
lookup = lookup->next)
{
if (lookup->constraint != -1
- && strncmp (".rel", lookup->name, 4) == 0)
+ && CONST_STRNEQ (lookup->name, ".rel"))
{
int lookrela = lookup->name[4] == 'a';
default:
break;
}
- else if (strncmp (secname, ".rel", 4) == 0)
+ else if (CONST_STRNEQ (secname, ".rel"))
{
secname = secname[4] == 'a' ? ".rela.dyn" : ".rel.dyn";
isdyn = 1;
sections into the .text section to get them out of the way. */
if (link_info.executable
&& ! link_info.relocatable
- && strncmp (secname, ".gnu.warning.", sizeof ".gnu.warning." - 1) == 0
+ && CONST_STRNEQ (secname, ".gnu.warning.")
&& hold[orphan_text].os != NULL)
{
lang_add_section (&hold[orphan_text].os->children, s,
;
else if ((s->flags & SEC_LOAD) != 0
&& ((iself && sh_type == SHT_NOTE)
- || (!iself && strncmp (secname, ".note", 5) == 0)))
+ || (!iself && CONST_STRNEQ (secname, ".note"))))
place = &hold[orphan_interp];
else if ((s->flags & (SEC_LOAD | SEC_HAS_CONTENTS)) == 0)
place = &hold[orphan_bss];
else if ((s->flags & SEC_READONLY) == 0)
place = &hold[orphan_data];
else if (((iself && (sh_type == SHT_RELA || sh_type == SHT_REL))
- || (!iself && strncmp (secname, ".rel", 4) == 0))
+ || (!iself && CONST_STRNEQ (secname, ".rel")))
&& (s->flags & SEC_LOAD) != 0)
place = &hold[orphan_rel];
else if ((s->flags & SEC_CODE) == 0)
fi
cat >>e${EMULATION_NAME}.c <<EOF
- else if (strncmp (optarg, "max-page-size=", 14) == 0)
+ else if (CONST_STRNEQ (optarg, "max-page-size="))
{
char *end;
+
config.maxpagesize = strtoul (optarg + 14, &end, 0);
if (*end)
einfo (_("%P%F: invalid maxium page size \`%s'\n"),
optarg + 14);
}
- else if (strncmp (optarg, "common-page-size=", 17) == 0)
+ else if (CONST_STRNEQ (optarg, "common-page-size="))
{
char *end;
config.commonpagesize = strtoul (optarg + 17, &end, 0);
for (i = 0; i < nsyms; i++)
{
- if (memcmp (symbols[i]->name, "__head_",
- sizeof ("__head_") - 1))
+ if (! CONST_STRNEQ (symbols[i]->name, "__head_"))
continue;
if (pe_dll_extra_pe_debug)
{
if (strcmp (sec->name, ".idata\$2") == 0)
idata2 = 1;
- if (strncmp (sec->name, ".idata\$", 7) == 0)
+ if (CONST_STRNEQ (sec->name, ".idata\$"))
is_imp = 1;
reloc_count += sec->reloc_count;
}
/* SunOS emulation code for ${EMULATION_NAME}
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Steve Chamberlain <sac@cygnus.com>
SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
|| ! inp->dynamic)
return;
- ASSERT (strncmp (inp->local_sym_name, "-l", 2) == 0);
+ ASSERT (CONST_STRNEQ (inp->local_sym_name, "-l"));
for (search = search_head; search != NULL; search = search->next)
{
const char *s;
int found_maj, found_min;
- if (strncmp (entry->d_name, "lib", 3) != 0
+ if (! CONST_STRNEQ (entry->d_name, "lib")
|| strncmp (entry->d_name + 3, filename, len) != 0)
continue;
native linker does not. This is more convenient for packages
which just generate .so files for shared libraries, as on ELF
systems. */
- if (strncmp (entry->d_name + 3 + len, ".so", 3) != 0)
+ if (! CONST_STRNEQ (entry->d_name + 3 + len, ".so"))
continue;
if (entry->d_name[6 + len] == '\0')
;
if (global_found)
continue;
- if (strncmp (lname, "-l", 2) != 0)
+ if (! CONST_STRNEQ (lname, "-l"))
{
bfd *abfd;
{
if (s->filename == NULL)
return;
- if (strncmp (global_needed->name, "-l", 2) != 0)
+ if (! CONST_STRNEQ (global_needed->name, "-l"))
{
if (strcmp (s->filename, global_needed->name) == 0)
global_found = TRUE;
else
++sname;
- if (strncmp (sname, "lib", 3) != 0)
+ if (! CONST_STRNEQ (sname, "lib"))
return;
sname += 3;
insn_sec_name = INSN_SEC_BASE_NAME;
prop_sec_name = PROP_SEC_BASE_NAME;
}
- else if (strncmp (sec_name, LINKONCE_SEC_OLD_TEXT_BASE_NAME,
- strlen (LINKONCE_SEC_OLD_TEXT_BASE_NAME)) == 0)
+ else if (CONST_STRNEQ (sec_name, LINKONCE_SEC_OLD_TEXT_BASE_NAME))
{
insn_sec_name = sec_name;
owned_prop_sec_name = (char *) xmalloc (strlen (sec_name) + 20);
return FALSE;
/* Check if this is an Xtensa property section. */
- if (strncmp (sec_name + linkonce_len, "p.", 2) == 0)
+ if (CONST_STRNEQ (sec_name + linkonce_len, "p."))
name = sec_name + linkonce_len + 2;
- else if (strncmp (sec_name + linkonce_len, "prop.", 5) == 0)
+ else if (CONST_STRNEQ (sec_name + linkonce_len, "prop."))
name = strchr (sec_name + linkonce_len + 5, '.') + 1;
if (name)
/* ldctor.c -- constructor support routines
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
- 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
By Steve Chamberlain <sac@cygnus.com>
This file is part of GLD, the Gnu Linker.
while (*name == '_')
++name;
- if (strncmp (name, "GLOBAL_", sizeof "GLOBAL_" - 1) != 0)
+ if (! CONST_STRNEQ (name, "GLOBAL_"))
return -1;
name += sizeof "GLOBAL_" - 1;
const char *path;
for (i = 1; i < argc; i++)
- if (strncmp (argv[i], "--sysroot=", strlen ("--sysroot=")) == 0)
+ if (CONST_STRNEQ (argv[i], "--sysroot="))
return argv[i] + strlen ("--sysroot=");
path = get_relative_sysroot (BINDIR);
for (i = 1; i < argc; i++)
{
- if (!strncmp (argv[i], "-m", 2))
+ if (CONST_STRNEQ (argv[i], "-m"))
{
if (argv[i][2] == '\0')
{
/* ldwrite.c -- write out the linked file
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2002,
- 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
Written by Steve Chamberlain sac@cygnus.com
This file is part of GLD, the Gnu Linker.
static bfd_boolean
unsplittable_name (const char *name)
{
- if (strncmp (name, ".stab", 5) == 0)
+ if (CONST_STRNEQ (name, ".stab"))
{
/* There are several stab like string sections. We pattern match on
".stab...str" */
{
/* Some section names cannot be truncated, as the name is
used to locate some other section. */
- if (strncmp (name, ".stab", 5) == 0
+ if (CONST_STRNEQ (name, ".stab")
|| strcmp (name, "$GDB_SYMBOLS$") == 0)
{
einfo (_ ("%F%P: cannot create split section name for %s\n"), name);
link_info.discard = discard_all;
break;
case 'Y':
- if (strncmp (optarg, "P,", 2) == 0)
+ if (CONST_STRNEQ (optarg, "P,"))
optarg += 2;
if (default_dirlist != NULL)
free (default_dirlist);
static autofilter_entry_type autofilter_symbollist_generic[] =
{
- { ".text", 5 },
+ { STRING_COMMA_LEN (".text") },
/* Entry point symbols. */
- { "DllMain", 7 },
- { "DllMainCRTStartup", 17 },
- { "_DllMainCRTStartup", 18 },
+ { STRING_COMMA_LEN ("DllMain") },
+ { STRING_COMMA_LEN ("DllMainCRTStartup") },
+ { STRING_COMMA_LEN ("_DllMainCRTStartup") },
/* Runtime pseudo-reloc. */
- { "_pei386_runtime_relocator", 25 },
- { "do_pseudo_reloc", 15 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("_pei386_runtime_relocator") },
+ { STRING_COMMA_LEN ("do_pseudo_reloc") },
+ { STRING_COMMA_LEN (NULL) }
};
static autofilter_entry_type autofilter_symbollist_i386[] =
{
- { ".text", 5 },
+ { STRING_COMMA_LEN (".text") },
/* Entry point symbols, and entry hooks. */
- { "cygwin_crt0", 11 },
- { "DllMain@12", 10 },
- { "DllEntryPoint@0", 15 },
- { "DllMainCRTStartup@12", 20 },
- { "_cygwin_dll_entry@12", 20 },
- { "_cygwin_crt0_common@8", 21 },
- { "_cygwin_noncygwin_dll_entry@12", 30 },
- { "cygwin_attach_dll", 17 },
- { "cygwin_premain0", 15 },
- { "cygwin_premain1", 15 },
- { "cygwin_premain2", 15 },
- { "cygwin_premain3", 15 },
+ { STRING_COMMA_LEN ("cygwin_crt0") },
+ { STRING_COMMA_LEN ("DllMain@12") },
+ { STRING_COMMA_LEN ("DllEntryPoint@0") },
+ { STRING_COMMA_LEN ("DllMainCRTStartup@12") },
+ { STRING_COMMA_LEN ("_cygwin_dll_entry@12") },
+ { STRING_COMMA_LEN ("_cygwin_crt0_common@8") },
+ { STRING_COMMA_LEN ("_cygwin_noncygwin_dll_entry@12") },
+ { STRING_COMMA_LEN ("cygwin_attach_dll") },
+ { STRING_COMMA_LEN ("cygwin_premain0") },
+ { STRING_COMMA_LEN ("cygwin_premain1") },
+ { STRING_COMMA_LEN ("cygwin_premain2") },
+ { STRING_COMMA_LEN ("cygwin_premain3") },
/* Runtime pseudo-reloc. */
- { "_pei386_runtime_relocator", 25 },
- { "do_pseudo_reloc", 15 },
+ { STRING_COMMA_LEN ("_pei386_runtime_relocator") },
+ { STRING_COMMA_LEN ("do_pseudo_reloc") },
/* Global vars that should not be exported. */
- { "impure_ptr", 10 },
- { "_impure_ptr", 11 },
- { "_fmode", 6 },
- { "environ", 7 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("impure_ptr") },
+ { STRING_COMMA_LEN ("_impure_ptr") },
+ { STRING_COMMA_LEN ("_fmode") },
+ { STRING_COMMA_LEN ("environ") },
+ { STRING_COMMA_LEN (NULL) }
};
#define PE_ARCH_i386 1
/* Do not specify library suffix explicitly, to allow for dllized versions. */
static autofilter_entry_type autofilter_liblist[] =
{
- { "libcegcc", 8 },
- { "libcygwin", 9 },
- { "libgcc", 6 },
- { "libstdc++", 9 },
- { "libmingw32", 10 },
- { "libmingwex", 10 },
- { "libg2c", 6 },
- { "libsupc++", 9 },
- { "libobjc", 7 },
- { "libgcj", 6 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("libcegcc") },
+ { STRING_COMMA_LEN ("libcygwin") },
+ { STRING_COMMA_LEN ("libgcc") },
+ { STRING_COMMA_LEN ("libstdc++") },
+ { STRING_COMMA_LEN ("libmingw32") },
+ { STRING_COMMA_LEN ("libmingwex") },
+ { STRING_COMMA_LEN ("libg2c") },
+ { STRING_COMMA_LEN ("libsupc++") },
+ { STRING_COMMA_LEN ("libobjc") },
+ { STRING_COMMA_LEN ("libgcj") },
+ { STRING_COMMA_LEN (NULL) }
};
static autofilter_entry_type autofilter_objlist[] =
{
- { "crt0.o", 6 },
- { "crt1.o", 6 },
- { "crt2.o", 6 },
- { "dllcrt1.o", 9 },
- { "dllcrt2.o", 9 },
- { "gcrt0.o", 7 },
- { "gcrt1.o", 7 },
- { "gcrt2.o", 7 },
- { "crtbegin.o", 10 },
- { "crtend.o", 8 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("crt0.o") },
+ { STRING_COMMA_LEN ("crt1.o") },
+ { STRING_COMMA_LEN ("crt2.o") },
+ { STRING_COMMA_LEN ("dllcrt1.o") },
+ { STRING_COMMA_LEN ("dllcrt2.o") },
+ { STRING_COMMA_LEN ("gcrt0.o") },
+ { STRING_COMMA_LEN ("gcrt1.o") },
+ { STRING_COMMA_LEN ("gcrt2.o") },
+ { STRING_COMMA_LEN ("crtbegin.o") },
+ { STRING_COMMA_LEN ("crtend.o") },
+ { STRING_COMMA_LEN (NULL) }
};
static autofilter_entry_type autofilter_symbolprefixlist[] =
{
- { "__imp_", 6 },
+ { STRING_COMMA_LEN ("__imp_") },
/* Do __imp_ explicitly to save time. */
- { "__rtti_", 7 },
+ { STRING_COMMA_LEN ("__rtti_") },
/* Don't re-export auto-imported symbols. */
- { "_nm_", 4 },
- { "__builtin_", 10 },
+ { STRING_COMMA_LEN ("_nm_") },
+ { STRING_COMMA_LEN ("__builtin_") },
/* Don't export symbols specifying internal DLL layout. */
- { "_head_", 6 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("_head_") },
+ { STRING_COMMA_LEN (NULL) }
};
static autofilter_entry_type autofilter_symbolsuffixlist[] =
{
- { "_iname", 6 },
- { NULL, 0 }
+ { STRING_COMMA_LEN ("_iname") },
+ { STRING_COMMA_LEN (NULL) }
};
#define U(str) (pe_details->underscored ? "_" str : str)
libname = lbasename (abfd->my_archive->filename);
/* We should not re-export imported stuff. */
- if (strncmp (n, "_imp_", 5) == 0)
+ if (CONST_STRNEQ (n, "_imp_"))
return 0;
for (i = 0; i < d->num_exports; i++)
/* Skip unwanted symbols, which are
exported in buggy auto-import releases. */
- if (strncmp (erva + name_rva, "_nm_", 4) != 0)
+ if (! CONST_STRNEQ (erva + name_rva, "_nm_"))
{
/* is_data is true if the address is in the data, rdata or bss
segment. */
+2006-09-16 Nick Clifton <nickc@redhat.com>
+ Pedro Alves <pedro_alves@portugalmail.pt>
+
+ * arm-dis.c: Make use of new STRING_COMMA_LEN and CONST_STRNEQ
+ macros defined in bfd.h.
+ * cris-dis.c: Likewise.
+ * h8300-dis.c: Likewise.
+ * i386-dis.c: Likewise.
+ * ia64-gen.c: Likewise.
+ * mips-dis: Likewise.
+
2006-09-04 Paul Brook <paul@codesourcery.com>
* arm-dis.c (neon_opcode): Fix suffix on VMOVN.
if (option == NULL)
return;
- if (strneq (option, "reg-names-", 10))
+ if (CONST_STRNEQ (option, "reg-names-"))
{
int i;
/* XXX - should break 'option' at following delimiter. */
fprintf (stderr, _("Unrecognised register name set: %s\n"), option);
}
- else if (strneq (option, "force-thumb", 11))
+ else if (CONST_STRNEQ (option, "force-thumb"))
force_thumb = 1;
- else if (strneq (option, "no-force-thumb", 14))
+ else if (CONST_STRNEQ (option, "no-force-thumb"))
force_thumb = 0;
else
/* XXX - should break 'option' at following delimiter. */
/* Disassembler code for CRIS.
- Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
Contributed by Axis Communications AB, Lund, Sweden.
Written by Hans-Peter Nilsson.
better way). */
if (opcodep->name[0] == 'j')
{
- if (strncmp (opcodep->name, "jsr", 3) == 0)
+ if (CONST_STRNEQ (opcodep->name, "jsr"))
/* It's "jsr" or "jsrc". */
info->insn_type = dis_jsr;
else
itself or in a "move.d const,rN, sub.d rN,rM"-like sequence. */
if (TRACE_CASE && case_offset_counter == 0)
{
- if (strncmp (opcodep->name, "sub", 3) == 0)
+ if (CONST_STRNEQ (opcodep->name, "sub"))
case_offset = last_immediate;
/* It could also be an "add", if there are negative case-values. */
- else if (strncmp (opcodep->name, "add", 3) == 0)
+ else if (CONST_STRNEQ (opcodep->name, "add"))
/* The first case is the negated operand to the add. */
case_offset = -last_immediate;
/* A bound insn will tell us the number of cases. */
- else if (strncmp (opcodep->name, "bound", 5) == 0)
+ else if (CONST_STRNEQ (opcodep->name, "bound"))
no_of_case_offsets = last_immediate + 1;
/* A jump or jsr or branch breaks the chain of insns for a
/* Disassemble h8300 instructions.
- Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+ Copyright 1993, 1994, 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
regno[1]);
return qi->length;
}
- if (strncmp (q->name, "mova", 4) == 0)
+ if (CONST_STRNEQ (q->name, "mova"))
{
op_type *args = q->args.nib;
/* Print i386 instructions for GDB, the GNU debugger.
Copyright 1988, 1989, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+ 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GDB.
for (p = info->disassembler_options; p != NULL; )
{
- if (strncmp (p, "x86-64", 6) == 0)
+ if (CONST_STRNEQ (p, "x86-64"))
{
address_mode = mode_64bit;
priv.orig_sizeflag = AFLAG | DFLAG;
}
- else if (strncmp (p, "i386", 4) == 0)
+ else if (CONST_STRNEQ (p, "i386"))
{
address_mode = mode_32bit;
priv.orig_sizeflag = AFLAG | DFLAG;
}
- else if (strncmp (p, "i8086", 5) == 0)
+ else if (CONST_STRNEQ (p, "i8086"))
{
address_mode = mode_16bit;
priv.orig_sizeflag = 0;
}
- else if (strncmp (p, "intel", 5) == 0)
+ else if (CONST_STRNEQ (p, "intel"))
{
intel_syntax = 1;
}
- else if (strncmp (p, "att", 3) == 0)
+ else if (CONST_STRNEQ (p, "att"))
{
intel_syntax = 0;
}
- else if (strncmp (p, "addr", 4) == 0)
+ else if (CONST_STRNEQ (p, "addr"))
{
if (p[4] == '1' && p[5] == '6')
priv.orig_sizeflag &= ~AFLAG;
else if (p[4] == '3' && p[5] == '2')
priv.orig_sizeflag |= AFLAG;
}
- else if (strncmp (p, "data", 4) == 0)
+ else if (CONST_STRNEQ (p, "data"))
{
if (p[4] == '1' && p[5] == '6')
priv.orig_sizeflag &= ~DFLAG;
else if (p[4] == '3' && p[5] == '2')
priv.orig_sizeflag |= DFLAG;
}
- else if (strncmp (p, "suffix", 6) == 0)
+ else if (CONST_STRNEQ (p, "suffix"))
priv.orig_sizeflag |= SUFFIX_ALWAYS;
p = strchr (p, ',');
&& (prefixes & PREFIX_ADDR)
&& olen >= (4 + 7)
&& *(p - 1) == ' '
- && strncmp (p - 7, "addr", 4) == 0
- && (strncmp (p - 3, "16", 2) == 0
- || strncmp (p - 3, "32", 2) == 0))
+ && CONST_STRNEQ (p - 7, "addr")
+ && (CONST_STRNEQ (p - 3, "16")
+ || CONST_STRNEQ (p - 3, "32")))
p -= 7;
if (rm)
int ind;
int is_class = 0;
- if (strncmp (full_name, "IC:", 3) == 0)
+ if (CONST_STRNEQ (full_name, "IC:"))
{
name = xstrdup (full_name + 3);
is_class = 1;
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
table). */
- if (strncmp (name, "IC:", 3) != 0 || xsect != NULL)
+ if (! CONST_STRNEQ (name, "IC:") || xsect != NULL)
create = 1;
iclass = fetch_insn_class (name, create);
if (ic->comment)
{
- if (!strncmp (ic->comment, "Format", 6))
+ if (CONST_STRNEQ (ic->comment, "Format"))
{
/* Assume that the first format seen is the most restrictive, and
only keep a later one if it looks like it's more restrictive. */
else
format = ic->comment;
}
- else if (!strncmp (ic->comment, "Field", 5))
+ else if (CONST_STRNEQ (ic->comment, "Field"))
{
if (field)
warn (_("overlapping field %s->%s\n"),
instructions. */
if (ic->nsubs == 0 && ic->nxsubs == 0)
{
- int is_mov = strncmp (idesc->name, "mov", 3) == 0;
+ int is_mov = CONST_STRNEQ (idesc->name, "mov");
int plain_mov = strcmp (idesc->name, "mov") == 0;
int len = strlen(ic->name);
if (resolved && format)
{
- if (strncmp (idesc->name, "dep", 3) == 0
+ if (CONST_STRNEQ (idesc->name, "dep")
&& strstr (format, "I13") != NULL)
resolved = idesc->operands[1] == IA64_OPND_IMM8;
- else if (strncmp (idesc->name, "chk", 3) == 0
+ else if (CONST_STRNEQ (idesc->name, "chk")
&& strstr (format, "M21") != NULL)
resolved = idesc->operands[0] == IA64_OPND_F2;
- else if (strncmp (idesc->name, "lfetch", 6) == 0)
+ else if (CONST_STRNEQ (idesc->name, "lfetch"))
resolved = (strstr (format, "M14 M15") != NULL
&& (idesc->operands[1] == IA64_OPND_R2
|| idesc->operands[1] == IA64_OPND_IMM9b));
- else if (strncmp (idesc->name, "br.call", 7) == 0
+ else if (CONST_STRNEQ (idesc->name, "br.call")
&& strstr (format, "B5") != NULL)
resolved = idesc->operands[1] == IA64_OPND_B2;
- else if (strncmp (idesc->name, "br.call", 7) == 0
+ else if (CONST_STRNEQ (idesc->name, "br.call")
&& strstr (format, "B3") != NULL)
resolved = idesc->operands[1] == IA64_OPND_TGT25c;
- else if (strncmp (idesc->name, "brp", 3) == 0
+ else if (CONST_STRNEQ (idesc->name, "brp")
&& strstr (format, "B7") != NULL)
resolved = idesc->operands[0] == IA64_OPND_B2;
else if (strcmp (ic->name, "invala") == 0)
resolved = strcmp (idesc->name, ic->name) == 0;
- else if (strncmp (idesc->name, "st", 2) == 0
+ else if (CONST_STRNEQ (idesc->name, "st")
&& (strstr (format, "M5") != NULL
|| strstr (format, "M10") != NULL))
resolved = idesc->flags & IA64_OPCODE_POSTINC;
- else if (strncmp (idesc->name, "ld", 2) == 0
+ else if (CONST_STRNEQ (idesc->name, "ld")
&& (strstr (format, "M2 M3") != NULL
|| strstr (format, "M12") != NULL
|| strstr (format, "M7 M8") != NULL))
plain brl matches brl.cond. */
if (!resolved
&& (strcmp (idesc->name, "brl") == 0
- || strncmp (idesc->name, "brl.", 4) == 0)
+ || CONST_STRNEQ (idesc->name, "brl."))
&& strcmp (ic->name, "brl.cond") == 0)
{
resolved = 1;
/* Misc br variations ('.cond' is optional). */
if (!resolved
&& (strcmp (idesc->name, "br") == 0
- || strncmp (idesc->name, "br.", 3) == 0)
+ || CONST_STRNEQ (idesc->name, "br."))
&& strcmp (ic->name, "br.cond") == 0)
{
if (format)
}
/* probe variations. */
- if (!resolved && strncmp (idesc->name, "probe", 5) == 0)
+ if (!resolved && CONST_STRNEQ (idesc->name, "probe"))
{
resolved = strcmp (ic->name, "probe") == 0
&& !((strstr (idesc->name, "fault") != NULL)
}
/* Some variants of mov and mov.[im]. */
- if (!resolved && strncmp (ic->name, "mov_", 4) == 0)
+ if (!resolved && CONST_STRNEQ (ic->name, "mov_"))
resolved = in_iclass_mov_x (idesc, ic, format, field);
}
warn (_("Don't know how to specify # dependency %s\n"),
name);
}
- else if (strncmp (name, "AR[FPSR]", 8) == 0)
+ else if (CONST_STRNEQ (name, "AR[FPSR]"))
return IA64_RS_AR_FPSR;
- else if (strncmp (name, "AR[", 3) == 0)
+ else if (CONST_STRNEQ (name, "AR["))
return IA64_RS_ARX;
- else if (strncmp (name, "CR[", 3) == 0)
+ else if (CONST_STRNEQ (name, "CR["))
return IA64_RS_CRX;
- else if (strncmp (name, "PSR.", 4) == 0)
+ else if (CONST_STRNEQ (name, "PSR."))
return IA64_RS_PSR;
else if (strcmp (name, "InService*") == 0)
return IA64_RS_INSERVICE;
int j;
if (strcmp (opc->name, "cmp.eq.and") == 0
- && strncmp (rs->name, "PR%", 3) == 0
+ && CONST_STRNEQ (rs->name, "PR%")
&& rs->mode == 1)
no_class_found = 99;
if (in_iclass (opc, ics[rs->regs[j]], NULL, NULL, &ic_note))
{
/* We can ignore ic_note 11 for non PR resources. */
- if (ic_note == 11 && strncmp (rs->name, "PR", 2) != 0)
+ if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR"))
ic_note = 0;
if (ic_note != 0 && rs->regnotes[j] != 0
if (in_iclass (opc, ics[rs->chks[j]], NULL, NULL, &ic_note))
{
/* We can ignore ic_note 11 for non PR resources. */
- if (ic_note == 11 && strncmp (rs->name, "PR", 2) != 0)
+ if (ic_note == 11 && ! CONST_STRNEQ (rs->name, "PR"))
ic_note = 0;
if (ic_note != 0 && rs->chknotes[j] != 0
const struct mips_arch_choice *chosen_arch;
/* Try to match options that are simple flags */
- if (strncmp (option, "no-aliases", 10) == 0)
+ if (CONST_STRNEQ (option, "no-aliases"))
{
no_aliases = 1;
return;