summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-01-05 07:57:22 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-01-05 07:57:22 +0000
commit24dff8372fa4e048735dac92bdc28dbbde77b267 (patch)
tree2fd7666e093862944e212ef24469d4850e2a3915
parentd4562fc99d9d36d2fe20f716f1405910851f0d14 (diff)
downloadbinutils-redhat-24dff8372fa4e048735dac92bdc28dbbde77b267.tar.gz
bfd/
Fix zero registers core files when built by gcc-4.7. * elf64-x86-64.c: Update copyright year. (elf_x86_64_write_core_note): Remove variables p and size. Call elfcore_write_note for the local variables. Remove the final elfcore_write_note call. Add NOTREACHED comments.
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/elf64-x86-64.c33
2 files changed, 22 insertions, 19 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 671265f997..65ba31dedf 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2012-01-05 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix zero registers core files when built by gcc-4.7.
+ * elf64-x86-64.c: Update copyright year.
+ (elf_x86_64_write_core_note): Remove variables p and size. Call
+ elfcore_write_note for the local variables. Remove the final
+ elfcore_write_note call. Add NOTREACHED comments.
+
2011-12-21 Ulrich Weigand <ulrich.weigand@linaro.org>
* elf32-arm.c (elf32_arm_nabi_grok_psinfo): Fill in core_pid.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index a4dfd481a8..fe0db0e8dc 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1,6 +1,6 @@
/* X86-64 specific support for ELF
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
- 2010, 2011
+ 2010, 2011, 2012
Free Software Foundation, Inc.
Contributed by Jan Hubicka <jh@suse.cz>.
@@ -420,8 +420,6 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
int note_type, ...)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
- const void *p;
- int size;
va_list ap;
const char *fname, *psargs;
long pid;
@@ -445,8 +443,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
memset (&data, 0, sizeof (data));
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- p = (const void *) &data;
- size = sizeof (data);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &data, sizeof (data));
}
else
{
@@ -454,10 +452,10 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
memset (&data, 0, sizeof (data));
strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
- p = (const void *) &data;
- size = sizeof (data);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &data, sizeof (data));
}
- break;
+ /* NOTREACHED */
case NT_PRSTATUS:
va_start (ap, note_type);
@@ -475,8 +473,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
else
{
@@ -485,8 +483,8 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
}
else
@@ -496,14 +494,11 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
prstat.pr_pid = pid;
prstat.pr_cursig = cursig;
memcpy (&prstat.pr_reg, gregs, sizeof (prstat.pr_reg));
- p = (const void *) &prstat;
- size = sizeof (prstat);
+ return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
+ &prstat, sizeof (prstat));
}
- break;
}
-
- return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type, p,
- size);
+ /* NOTREACHED */
}
#endif
@@ -513,7 +508,7 @@ elf_x86_64_write_core_note (bfd *abfd, char *buf, int *bufsiz,
section. */
#define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
-#define ELF32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1"
+#define ELF32_DYNAMIC_INTERPRETER "/lib/ld32.so.1"
/* If ELIMINATE_COPY_RELOCS is non-zero, the linker will try to avoid
copying dynamic variables from a shared lib into an app's dynbss