This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Add alias for kernel's NT_PRFPREG from linux/elf.h.


On 9/6/2012 3:34 PM, Roland McGrath wrote:
> Please separate NT_PRFPREG from the others.  It needs separate review.
> The NT_S390_* and NT_ARM_* additions are fine without arch maintainer
> sign-off, I think.  They match the linux/elf.h values and comments, and
> that is the source of truth for these particular constants.

I've checked in Petr's patch.

Here is the new patch for discussion with a new topic.

The Linux kernel header linux/elf.h defines NT_PRFPREG with a value of 2.

This is the same as the userspace NT_FPREGSET which also has a value of 2.

For all intents and purposes the two macros mean the same thing but have
different macro names.

For example:

x86 uses the note value to write out the core file...

linux/arch/x86/kernel/ptrace.c
~~~
...
        [REGSET_FP] = {
                .core_note_type = NT_PRFPREG,
                .n = sizeof(struct user_i387_struct) / sizeof(long),
                .size = sizeof(long), .align = sizeof(long),
                .active = xfpregs_active, .get = xfpregs_get, .set = xfpregs_set
        },
...
~~~

... and the target independent portions of gdb process it into a section
    for the debugger to inspect.

gdb/bfd/elf.c
~~~
...
    case NT_FPREGSET:           /* FIXME: rename to NT_PRFPREG */
      return elfcore_grok_prfpreg (abfd, note);
...
~~~

Note: gdb actually has it's own copies of the NT_* values in include/elf/common.h.

The following patch adds an alias to the user distributed header file elf.h.

2012-09-06  Carlos O'Donell  <carlos_odonell@mentor.com>

	* elf/elf.h (NT_PRFPREG): New macro.

diff --git a/elf/elf.h b/elf/elf.h
index 41fc3bd..3e488ec 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -601,6 +601,7 @@ typedef struct
 
 #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_PRPSINFO	3		/* Contains copy of prpsinfo struct */
 #define NT_PRXREG	4		/* Contains copy of prxregset struct */
 #define NT_TASKSTRUCT	4		/* Contains copy of task structure */
---

OK to checkin?

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]