* configure.ac (stpcpy): AC_CHECK_DECLS.
* sysdep.h (stpcpy): Add fallback declaraion.
* config.in: Regenerate.
* configure: Regenerate.
* emultempl/pe.em (open_dynamic_archive): Use
stpcpy rather than sprintf plus strlen.
* emultempl/pep.em (open_dynamic_archive): Likewise.
* emultempl/xtensaelf.em (elf_xtensa_before_allocation): Use
auto rather than malloc'd buffer. Use sprintf count.
* ldelf.c (ldelf_search_needed): Use memcpy in place of sprintf.
* pe-dll.c (pe_process_import_defs): Use string already formed
for alias match rather than recreating.
/* Is the prototype for getopt in <unistd.h> in the expected format? */
#undef HAVE_DECL_GETOPT
+/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STPCPY
+
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_ENVIRON $ac_have_decl
_ACEOF
+ac_fn_c_check_decl "$LINENO" "stpcpy" "ac_cv_have_decl_stpcpy" "$ac_includes_default"
+if test "x$ac_cv_have_decl_stpcpy" = xyes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STPCPY $ac_have_decl
+_ACEOF
BFD_BINARY_FOPEN
-AC_CHECK_DECLS([asprintf, environ])
+AC_CHECK_DECLS([asprintf, environ, stpcpy])
AC_FUNC_MMAP
search->name and the start of the format string. */
+ 2);
- sprintf (full_string, "%s/", search->name);
- base_string = full_string + strlen (full_string);
+ base_string = stpcpy (full_string, search->name);
+ *base_string++ = '/';
for (i = 0; libname_fmt[i].format; i++)
{
search->name and the start of the format string. */
+ 2);
- sprintf (full_string, "%s/", search->name);
- base_string = full_string + strlen (full_string);
+ base_string = stpcpy (full_string, search->name);
+ *base_string++ = '/';
for (i = 0; libname_fmt[i].format; i++)
{
if (info_sec)
{
int xtensa_info_size;
- char *data;
+ char data[100];
info_sec->flags &= ~SEC_EXCLUDE;
info_sec->flags |= SEC_IN_MEMORY;
- data = xmalloc (100);
- sprintf (data, "USE_ABSOLUTE_LITERALS=%d\nABI=%d\n",
- XSHAL_USE_ABSOLUTE_LITERALS, xtensa_abi_choice ());
- xtensa_info_size = strlen (data) + 1;
+ xtensa_info_size
+ = 1 + sprintf (data, "USE_ABSOLUTE_LITERALS=%d\nABI=%d\n",
+ XSHAL_USE_ABSOLUTE_LITERALS, xtensa_abi_choice ());
/* Add enough null terminators to pad to a word boundary. */
do
bfd_put_32 (info_sec->owner, XTINFO_TYPE, info_sec->contents + 8);
memcpy (info_sec->contents + 12, XTINFO_NAME, XTINFO_NAMESZ);
memcpy (info_sec->contents + 12 + XTINFO_NAMESZ, data, xtensa_info_size);
- free (data);
}
/* Enable relaxation by default if the "--no-relax" option was not
else
{
char * current_dir = getpwd ();
-
- freeme = xmalloc (strlen (replacement)
- + strlen (current_dir) + 2);
- sprintf (freeme, "%s/%s", current_dir, replacement);
+ size_t cdir_len = strlen (current_dir);
+ size_t rep_len = strlen (replacement);
+ freeme = xmalloc (cdir_len + rep_len + 2);
+ memcpy (freeme, current_dir, cdir_len);
+ freeme[cdir_len] = '/';
+ memcpy (freeme + cdir_len + 1,
+ replacement, rep_len + 1);
}
replacement = freeme;
false, false, false);
if (blhe)
is_undef = (blhe->type == bfd_link_hash_undefined);
+
+ if (is_cdecl && (!blhe || !is_undef))
+ {
+ blhe = pe_find_cdecl_alias_match (linfo, name + 6);
+ include_jmp_stub = true;
+ if (blhe)
+ is_undef = (blhe->type == bfd_link_hash_undefined);
+ }
}
else
{
is_undef = (blhe->type == bfd_link_hash_undefined);
}
- if (is_cdecl
- && (!blhe || (blhe && blhe->type != bfd_link_hash_undefined)))
- {
- sprintf (name, "%s%s",U (""), imp[i].internal_name);
- blhe = pe_find_cdecl_alias_match (linfo, name);
- include_jmp_stub = true;
- if (blhe)
- is_undef = (blhe->type == bfd_link_hash_undefined);
- }
-
free (name);
if (is_undef)
extern char **environ;
#endif
+#if !HAVE_DECL_STPCPY
+extern char *stpcpy (char *__dest, const char *__src);
+#endif
+
#define POISON_BFD_BOOLEAN 1
#endif /* ! defined (LD_SYSDEP_H) */