This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] v2: Use NT_PRFPREG where possible.


The note value NT_FPREGSET is a legacy value that was obsoleted
in favour of NT_PRFPREG. The value of NT_FPREGSET and NT_PRFPREG
are the same. Newer Solaris versions use NT_PRFPREG, and so
does the Linux kernel.

The following patch changes the code in bfd and binutils to
use NT_PRFPREG, but does not change what readelf prints for
the note e.g. NT_FPREGSET. The readelf output change is something 
that can only be made once we safely expect that every consumer
can understand NT_PRFPREG.

Given that we are only *just* about to add NT_PRFPREG to glibc's
elf.h and binutils' common.h, it will be a long time before we can 
make the change in the output to readelf.

Tested with no regressions on x86-64.

OK to checkin?

v2
- Include the missing include/elf/common.h change.

bfd/

2012-11-28  Carlos O'Donell  <carlos_odonell@mentor.com>

	* elf.c (elfcore_write_prfpreg): Use NT_PRFPREG.
	(elfcore_grok_note): Likewise.

Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.577
diff -u -r1.577 elf.c
--- bfd/elf.c	21 Nov 2012 21:31:17 -0000	1.577
+++ bfd/elf.c	28 Nov 2012 21:27:15 -0000
@@ -8503,7 +8503,7 @@
       return elfcore_grok_lwpstatus (abfd, note);
 #endif
 
-    case NT_FPREGSET:		/* FIXME: rename to NT_PRFPREG */
+    case NT_PRFPREG:
       return elfcore_grok_prfpreg (abfd, note);
 
     case NT_WIN32PSTATUS:
@@ -9240,7 +9240,7 @@
 {
   const char *note_name = "CORE";
   return elfcore_write_note (abfd, buf, bufsiz,
-			     note_name, NT_FPREGSET, fpregs, size);
+			     note_name, NT_PRFPREG, fpregs, size);
 }
 
 char *
---

binutils/

2012-11-28  Carlos O'Donell  <carlos_odonell@mentor.com>

	* readelf.c (get_note_type): Use NT_PRFPREG.

Index: binutils/readelf.c
===================================================================
RCS file: /cvs/src/src/binutils/readelf.c,v
retrieving revision 1.588
diff -u -r1.588 readelf.c
--- binutils/readelf.c	16 Nov 2012 12:49:20 -0000	1.588
+++ binutils/readelf.c	28 Nov 2012 21:27:16 -0000
@@ -12771,7 +12771,9 @@
 	return _("NT_AUXV (auxiliary vector)");
       case NT_PRSTATUS:
 	return _("NT_PRSTATUS (prstatus structure)");
-      case NT_FPREGSET:
+      case NT_PRFPREG:
+	/* We can't change the output text to NT_PRFPREG without breaking
+	   consumers of this output, so we continue to print the old name.  */
 	return _("NT_FPREGSET (floating point registers)");
       case NT_PRPSINFO:
 	return _("NT_PRPSINFO (prpsinfo structure)");
---

include/elf

2012-11-28  Carlos O'Donell  <carlos_odonell@mentor.com>

	* common.h (NT_PRFPREG): Define, replaces...
	(NT_FPREGSET): ... this, kept as an alias.

Index: include/elf/common.h
===================================================================
RCS file: /cvs/src/src/include/elf/common.h,v
retrieving revision 1.140
diff -u -r1.140 common.h
--- include/elf/common.h	16 Nov 2012 12:49:20 -0000	1.140
+++ include/elf/common.h	28 Nov 2012 21:27:16 -0000
@@ -519,7 +519,8 @@
 /* Values of note segment descriptor types for core files.  */
 
 #define NT_PRSTATUS	1		/* Contains copy of prstatus struct */
-#define NT_FPREGSET	2		/* Contains copy of fpregset struct */
+#define NT_PRFPREG	2		/* Contains copy of fpregset struct.  */
+#define NT_FPREGSET	NT_PRFPREG	/* Obsolete name for NT_PRFPREG.  */
 #define NT_PRPSINFO	3		/* Contains copy of prpsinfo struct */
 #define NT_TASKSTRUCT	4		/* Contains copy of task struct */
 #define NT_AUXV		6		/* Contains copy of Elfxx_auxv_t */
---

Cheers,
Carlos.
-- 
Carlos O'Donell
Mentor Graphics / CodeSourcery
carlos_odonell@mentor.com
carlos@codesourcery.com
+1 (613) 963 1026


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]