+2018-05-07 Alan Modra <amodra@gmail.com>
+
+ * cofflink.c (_bfd_coff_link_input_bfd): Use memcmp rather than
+ strncmp when checking for ".bf" special symbol.
+ * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Make pe_required_section_flags
+ section name a char array, remove sentinal known_sections entry,
+ and adjust loop over known_sections to suit. Use memcmp rather
+ than strncmp.
+
2018-05-04 Alan Modra <amodra@gmail.com>
* elf-linux-core.h (struct elf_external_linux_prpsinfo32_ugid32),
pragmas.
* peXXigen.c (_bfd_XXi_swap_scnhdr_out): Use strnlen to avoid
false positive gcc-8 warning.
+ * cofflink.c (_bfd_coff_link_input_bfd): Likewise.
2018-05-04 Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
typedef struct
{
- const char * section_name;
+ char section_name[SCNNMLEN];
unsigned long must_have;
}
pe_required_section_flags;
{ ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE },
{ ".tls", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
{ ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
- { NULL, 0}
};
pe_required_section_flags * p;
by ld --enable-auto-import (if auto-import is actually needed),
by ld --omagic, or by obcopy --writable-text. */
- for (p = known_sections; p->section_name; p++)
- if (strncmp (scnhdr_int->s_name, p->section_name,
- sizeof scnhdr_int->s_name) == 0)
+ for (p = known_sections;
+ p < known_sections + ARRAY_SIZE (known_sections);
+ p++)
+ if (memcmp (scnhdr_int->s_name, p->section_name, SCNNMLEN) == 0)
{
- if (strncmp (scnhdr_int->s_name, ".text", sizeof scnhdr_int->s_name)
+ if (memcmp (scnhdr_int->s_name, ".text", sizeof ".text")
|| (bfd_get_file_flags (abfd) & WP_TEXT))
scnhdr_int->s_flags &= ~IMAGE_SCN_MEM_WRITE;
scnhdr_int->s_flags |= p->must_have;
if (coff_data (abfd)->link_info
&& ! bfd_link_relocatable (coff_data (abfd)->link_info)
&& ! bfd_link_pic (coff_data (abfd)->link_info)
- && strncmp (scnhdr_int->s_name, ".text", sizeof scnhdr_int->s_name) == 0)
+ && memcmp (scnhdr_int->s_name, ".text", sizeof ".text") == 0)
{
/* By inference from looking at MS output, the 32 bit field
which is the combination of the number_of_relocs and