===================================================================
@@ -8863,7 +8863,6 @@ elfcore_write_note (bfd *abfd,
return buf;
}
-#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
char *
elfcore_write_prpsinfo (bfd *abfd,
char *buf,
@@ -8871,7 +8870,6 @@ elfcore_write_prpsinfo (bfd *abfd,
const char *fname,
const char *psargs)
{
- const char *note_name = "CORE";
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (bed->elf_backend_write_core_note != NULL)
@@ -8883,6 +8881,7 @@ elfcore_write_prpsinfo (bfd *abfd,
return ret;
}
+#if defined (HAVE_PRPSINFO_T) || defined (HAVE_PSINFO_T)
#if defined (HAVE_PRPSINFO32_T) || defined (HAVE_PSINFO32_T)
if (bed->s->elfclass == ELFCLASS32)
{
@@ -8898,7 +8897,7 @@ elfcore_write_prpsinfo (bfd *abfd,
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
+ "CORE", note_type, &data, sizeof (data));
}
else
#endif
@@ -8915,12 +8914,14 @@ elfcore_write_prpsinfo (bfd *abfd,
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
return elfcore_write_note (abfd, buf, bufsiz,
- note_name, note_type, &data, sizeof (data));
+ "CORE", note_type, &data, sizeof (data));
}
-}
#endif /* PSINFO_T or PRPSINFO_T */
-#if defined (HAVE_PRSTATUS_T)
+ free (buf);
+ return NULL;
+}
+
char *
elfcore_write_prstatus (bfd *abfd,
char *buf,
@@ -8929,7 +8930,6 @@ elfcore_write_prstatus (bfd *abfd,
int cursig,
const void *gregs)
{
- const char *note_name = "CORE";
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (bed->elf_backend_write_core_note != NULL)
@@ -8942,6 +8942,7 @@ elfcore_write_prstatus (bfd *abfd,
return ret;
}
+#if defined (HAVE_PRSTATUS_T)
#if defined (HAVE_PRSTATUS32_T)
if (bed->s->elfclass == ELFCLASS32)
{
@@ -8951,7 +8952,7 @@ elfcore_write_prstatus (bfd *abfd,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE",
NT_PRSTATUS, &prstat, sizeof (prstat));
}
else
@@ -8963,12 +8964,15 @@ elfcore_write_prstatus (bfd *abfd,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- return elfcore_write_note (abfd, buf, bufsiz, note_name,
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE",
NT_PRSTATUS, &prstat, sizeof (prstat));
}
-}
#endif /* HAVE_PRSTATUS_T */
+ free (buf);
+ return NULL;
+}
+
#if defined (HAVE_LWPSTATUS_T)
char *
elfcore_write_lwpstatus (bfd *abfd,
===================================================================
@@ -1986,6 +1986,54 @@ elf32_arm_nabi_grok_psinfo (bfd *abfd, E
return TRUE;
}
+static char *
+elf32_arm_nabi_write_core_note (bfd *abfd, char *buf, int *bufsiz,
+ int note_type, ...)
+{
+ switch (note_type)
+ {
+ default:
+ return NULL;
+
+ case NT_PRPSINFO:
+ {
+ char data[124];
+ va_list ap;
+
+ va_start (ap, note_type);
+ memset (data, 0, sizeof (data));
+ strncpy (data + 28, va_arg (ap, const char *), 16);
+ strncpy (data + 44, va_arg (ap, const char *), 80);
+ va_end (ap);
+
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+
+ case NT_PRSTATUS:
+ {
+ char data[148];
+ va_list ap;
+ long pid;
+ int cursig;
+ const void *greg;
+
+ va_start (ap, note_type);
+ memset (data, 0, sizeof (data));
+ pid = va_arg (ap, long);
+ bfd_put_32 (abfd, pid, data + 24);
+ cursig = va_arg (ap, int);
+ bfd_put_16 (abfd, cursig, data + 12);
+ greg = va_arg (ap, const void *);
+ memcpy (data + 72, greg, 72);
+ va_end (ap);
+
+ return elfcore_write_note (abfd, buf, bufsiz,
+ "CORE", note_type, data, sizeof (data));
+ }
+ }
+}
+
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
#define TARGET_LITTLE_NAME "elf32-littlearm"
#define TARGET_BIG_SYM bfd_elf32_bigarm_vec
@@ -1993,6 +2041,7 @@ elf32_arm_nabi_grok_psinfo (bfd *abfd, E
#define elf_backend_grok_prstatus elf32_arm_nabi_grok_prstatus
#define elf_backend_grok_psinfo elf32_arm_nabi_grok_psinfo
+#define elf_backend_write_core_note elf32_arm_nabi_write_core_note
typedef unsigned long int insn32;
typedef unsigned short int insn16;
===================================================================
@@ -1920,7 +1920,7 @@ ppc_elf_write_core_note (bfd *abfd, char
va_list ap;
va_start (ap, note_type);
- memset (data, 0, 32);
+ memset (data, 0, sizeof (data));
strncpy (data + 32, va_arg (ap, const char *), 16);
strncpy (data + 48, va_arg (ap, const char *), 80);
va_end (ap);
@@ -1937,14 +1937,13 @@ ppc_elf_write_core_note (bfd *abfd, char
const void *greg;
va_start (ap, note_type);
- memset (data, 0, 72);
+ memset (data, 0, sizeof (data));
pid = va_arg (ap, long);
bfd_put_32 (abfd, pid, data + 24);
cursig = va_arg (ap, int);
bfd_put_16 (abfd, cursig, data + 12);
greg = va_arg (ap, const void *);
memcpy (data + 72, greg, 192);
- memset (data + 264, 0, 4);
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));
===================================================================
@@ -2714,7 +2714,7 @@ ppc64_elf_write_core_note (bfd *abfd, ch
va_list ap;
va_start (ap, note_type);
- memset (data, 0, 40);
+ memset (data, 0, sizeof (data));
strncpy (data + 40, va_arg (ap, const char *), 16);
strncpy (data + 56, va_arg (ap, const char *), 80);
va_end (ap);
@@ -2731,14 +2731,13 @@ ppc64_elf_write_core_note (bfd *abfd, ch
const void *greg;
va_start (ap, note_type);
- memset (data, 0, 112);
+ memset (data, 0, sizeof (data));
pid = va_arg (ap, long);
bfd_put_32 (abfd, pid, data + 32);
cursig = va_arg (ap, int);
bfd_put_16 (abfd, cursig, data + 12);
greg = va_arg (ap, const void *);
memcpy (data + 112, greg, 384);
- memset (data + 496, 0, 8);
va_end (ap);
return elfcore_write_note (abfd, buf, bufsiz,
"CORE", note_type, data, sizeof (data));