[users/roland/osabi] Recognize GNU .note.ABI-tag values 5 (syllable) and 6 (nacl)

Message ID CAB=4xhpRRhMYF7-FtsYuTdCSn3fNOB1gOT_xjYaS11jJ6myGHw@mail.gmail.com
State New, archived
Headers

Commit Message

Roland McGrath May 29, 2015, 1:10 a.m. UTC
  These two values are assigned in glibc trunk (5 has been assigned to
syllable for several years, and 6 is quite recent).  I don't actually know
anything about Syllable, but IMHO it makes sense for the other GNU packages
that think about these values at all (binutils/gdb) to grok all the values
that exist in the GNU package that owns this number space (libc).

OK for trunk and gdb's 7.9 branch?  (I don't really care about the readelf
change, but I'm happy to put it on binutils' 2.25 branch if anyone thinks
it's worthwhile.)


Thanks,
Roland


binutils/
	* readelf.c (print_gnu_note: NT_GNU_ABI_TAG): Recognize
	GNU_ABI_TAG_SYLLABLE and GNU_ABI_TAG_NACL.

gdb/
	* defs.h (enum gdb_osabi): Add GDB_OSABI_SYLLABLE and GDB_OSABI_NACL.
	* osabi.c (generic_elf_osabi_sniff_abi_tag_sections): Recognize
	GNU_ABI_TAG_SYLLABLE and GNU_ABI_TAG_NACL.
	* configure.tgt (*-*-nacl*): Set gdb_osabi=GDB_OSABI_NACL.

include/elf/
	* common.h (GNU_ABI_TAG_SYLLABLE): New macro.
	(GNU_ABI_TAG_NACL): New macro.
  

Comments

Nick Clifton May 29, 2015, 9:58 a.m. UTC | #1
Hi Roland,

> binutils/
> 	* readelf.c (print_gnu_note: NT_GNU_ABI_TAG): Recognize
> 	GNU_ABI_TAG_SYLLABLE and GNU_ABI_TAG_NACL.

> include/elf/
> 	* common.h (GNU_ABI_TAG_SYLLABLE): New macro.
> 	(GNU_ABI_TAG_NACL): New macro.

These parts are approved.

Cheers
   Nick
  
Pedro Alves May 29, 2015, 10:29 a.m. UTC | #2
On 05/29/2015 02:10 AM, Roland McGrath wrote:
> These two values are assigned in glibc trunk (5 has been assigned to
> syllable for several years, and 6 is quite recent).  I don't actually know
> anything about Syllable, but IMHO it makes sense for the other GNU packages
> that think about these values at all (binutils/gdb) to grok all the values
> that exist in the GNU package that owns this number space (libc).
> 
> OK for trunk and gdb's 7.9 branch?  (I don't really care about the readelf
> change, but I'm happy to put it on binutils' 2.25 branch if anyone thinks
> it's worthwhile.)

I think adding the constants to include/elf/common.h, and making
generic_elf_osabi_sniff_abi_tag_sections recognize syllable and nacl,
avoiding the internal_error (or warning after your other patch) is OK
and could go to the 7.9 branch.  Please split that out to a separate patch.

The rest of the gdb bits can be considered for trunk.  I don't think we want
GDB_OSABI_SYLLABLE exposed to the rest of the gdb (I don't know anything
about Syllable either), and to users (both "set osabi" and xml target
descriptions).  We may need to expose GDB_OSABI_NACL, but that's probably
best added along with the nacl port, assuming there's one.

Thanks,
Pedro Alves
  
Roland McGrath May 29, 2015, 4:15 p.m. UTC | #3
On Fri, May 29, 2015 at 2:58 AM, Nicholas Clifton <nickc@redhat.com> wrote:
>> binutils/
>>         * readelf.c (print_gnu_note: NT_GNU_ABI_TAG): Recognize
>>         GNU_ABI_TAG_SYLLABLE and GNU_ABI_TAG_NACL.
>> include/elf/
>>         * common.h (GNU_ABI_TAG_SYLLABLE): New macro.
>>         (GNU_ABI_TAG_NACL): New macro.
>
> These parts are approved.

Committed.

Thanks,
Roland
  
Roland McGrath May 29, 2015, 4:47 p.m. UTC | #4
On Fri, May 29, 2015 at 3:29 AM, Pedro Alves <palves@redhat.com> wrote:
> I think adding the constants to include/elf/common.h,

I've already committed common.h based on the binutils approval.

> and making
> generic_elf_osabi_sniff_abi_tag_sections recognize syllable and nacl,
> avoiding the internal_error (or warning after your other patch) is OK
> and could go to the 7.9 branch.  Please split that out to a separate patch.

Do you mean just silently ignoring these values?

> The rest of the gdb bits can be considered for trunk.  I don't think we want
> GDB_OSABI_SYLLABLE exposed to the rest of the gdb (I don't know anything
> about Syllable either), and to users (both "set osabi" and xml target
> descriptions).  We may need to expose GDB_OSABI_NACL, but that's probably
> best added along with the nacl port, assuming there's one.

OK.  I'll ignore Syllable entirely, since I was only doing it for
completeness.

For NaCl, I'll investigate further before proposing something.  We have a
patch that is mostly about x86 and needs some cleanup (or probably complete
rewriting).  NaCl's x86-64 is particularly odd and I don't want to worry
about the weird cruft we have for that right now.  At the moment, I'm
focused on on arm-nacl.  NaCl is an all-remote target (the only kind of
"native" debugging interface available is a gdb stub).  So there really is
almost nothing to do.  But when I get some time I'll look into building
--target=arm-nacl on trunk and see what it needs.


Thanks,
Roland
  
Pedro Alves May 29, 2015, 5:07 p.m. UTC | #5
On 05/29/2015 05:47 PM, Roland McGrath wrote:
> On Fri, May 29, 2015 at 3:29 AM, Pedro Alves <palves@redhat.com> wrote:
>> I think adding the constants to include/elf/common.h,
> 
> I've already committed common.h based on the binutils approval.
> 
>> and making
>> generic_elf_osabi_sniff_abi_tag_sections recognize syllable and nacl,
>> avoiding the internal_error (or warning after your other patch) is OK
>> and could go to the 7.9 branch.  Please split that out to a separate patch.
> 
> Do you mean just silently ignoring these values?

I do.

> 
>> The rest of the gdb bits can be considered for trunk.  I don't think we want
>> GDB_OSABI_SYLLABLE exposed to the rest of the gdb (I don't know anything
>> about Syllable either), and to users (both "set osabi" and xml target
>> descriptions).  We may need to expose GDB_OSABI_NACL, but that's probably
>> best added along with the nacl port, assuming there's one.
> 
> OK.  I'll ignore Syllable entirely, since I was only doing it for
> completeness.
> 
> For NaCl, I'll investigate further before proposing something.  We have a
> patch that is mostly about x86 and needs some cleanup (or probably complete
> rewriting).  NaCl's x86-64 is particularly odd and I don't want to worry
> about the weird cruft we have for that right now.  At the moment, I'm
> focused on on arm-nacl.  NaCl is an all-remote target (the only kind of
> "native" debugging interface available is a gdb stub).  So there really is
> almost nothing to do.  But when I get some time I'll look into building
> --target=arm-nacl on trunk and see what it needs.

OK.  Looking forward to hear about this.

Thanks,
Pedro Alves
  

Patch

diff --git a/binutils/readelf.c b/binutils/readelf.c
index b584db5..a0c20a3 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -15125,6 +15125,12 @@  print_gnu_note (Elf_Internal_Note *pnote)
 	  case GNU_ABI_TAG_NETBSD:
 	    osname = "NetBSD";
 	    break;
+	  case GNU_ABI_TAG_SYLLABLE:
+	    osname = "Syllable";
+	    break;
+	  case GNU_ABI_TAG_NACL:
+	    osname = "NaCl";
+	    break;
 	  default:
 	    osname = "Unknown";
 	    break;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 4e4d6a9..d7f083d 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -702,6 +702,7 @@  case "${targ}" in
 		gdb_osabi=GDB_OSABI_FREEBSD_ELF ;;
 *-*-linux* | *-*-uclinux*)
 		gdb_osabi=GDB_OSABI_LINUX ;;
+*-*-nacl*)	gdb_osabi=GDB_OSABI_NACL ;;
 *-*-nto*)	gdb_osabi=GDB_OSABI_QNXNTO ;;
 m68*-*-openbsd* | m88*-*-openbsd* | vax-*-openbsd*) ;;
 *-*-openbsd*)	gdb_osabi=GDB_OSABI_OPENBSD_ELF ;;
diff --git a/gdb/defs.h b/gdb/defs.h
index 44702ea..20d9eaf 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -569,6 +569,8 @@  enum gdb_osabi
   GDB_OSABI_LYNXOS178,
   GDB_OSABI_NEWLIB,
   GDB_OSABI_SDE,
+  GDB_OSABI_SYLLABLE,
+  GDB_OSABI_NACL,

   GDB_OSABI_INVALID		/* keep this last */
 };
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 9d90c55..879f68b 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -492,6 +492,14 @@  generic_elf_osabi_sniff_abi_tag_sections (bfd
*abfd, asection *sect, void *obj)
 	      *osabi = GDB_OSABI_NETBSD_ELF;
 	      break;

+	    case GNU_ABI_TAG_SYLLABLE:
+	      *osabi = GDB_OSABI_SYLLABLE;
+	      break;
+
+	    case GNU_ABI_TAG_NACL:
+	      *osabi = GDB_OSABI_NACL;
+	      break;
+
 	    default:
 	      internal_error (__FILE__, __LINE__,
 			      _("generic_elf_osabi_sniff_abi_tag_sections: "
diff --git a/include/elf/common.h b/include/elf/common.h
index b087d9c..e6d8c14 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -635,6 +635,8 @@ 
 #define GNU_ABI_TAG_SOLARIS	2
 #define GNU_ABI_TAG_FREEBSD	3
 #define GNU_ABI_TAG_NETBSD	4
+#define GNU_ABI_TAG_SYLLABLE	5
+#define GNU_ABI_TAG_NACL	6

 /* Values for NetBSD .note.netbsd.ident notes.  Note name is "NetBSD".  */