public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Support AT_HWCAP2 on FreeBSD.
@ 2018-10-08 22:54 John Baldwin
  2018-10-08 22:54 ` [PATCH 2/2] Treat all unknown auxv tags on FreeBSD as unknown John Baldwin
  2018-10-16 16:31 ` [PATCH 1/2] Support AT_HWCAP2 on FreeBSD Nick Clifton
  0 siblings, 2 replies; 3+ messages in thread
From: John Baldwin @ 2018-10-08 22:54 UTC (permalink / raw)
  To: gdb-patches, binutils

include/ChangeLog:

	* elf/common.h (AT_FREEBSD_HWCAP2): Define.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2.
---
 gdb/ChangeLog        | 4 ++++
 gdb/fbsd-tdep.c      | 1 +
 include/ChangeLog    | 4 ++++
 include/elf/common.h | 1 +
 4 files changed, 10 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f074385c30..24aeb467b1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-08  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2.
+
 2018-10-08  John Baldwin  <jhb@FreeBSD.org>
 
 	* Makefile.in (ALLDEPFILES): Add riscv-fbsd-nat.c.
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index 070d448b4e..e948f28abc 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1504,6 +1504,7 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
       TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX);
       TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX);
       TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX);
+      TAG (HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
     default:
       default_print_auxv_entry (gdbarch, file, type, val);
       return;
diff --git a/include/ChangeLog b/include/ChangeLog
index ce95a61662..7dba7c9557 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-08  John Baldwin  <jhb@FreeBSD.org>
+
+	* elf/common.h (AT_FREEBSD_HWCAP2): Define.
+
 2018-10-08  Alan Modra  <amodra@gmail.com>
 
 	* bfdlink.h (struct bfd_link_info): Add load_phdrs field.
diff --git a/include/elf/common.h b/include/elf/common.h
index e194274305..da9ea036f4 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -1226,6 +1226,7 @@
 #define AT_FREEBSD_STACKPROT    23      /* Initial stack protection. */
 #define AT_FREEBSD_EHDRFLAGS    24      /* e_flags field from ELF header. */
 #define AT_FREEBSD_HWCAP        25      /* CPU feature flags. */
+#define AT_FREEBSD_HWCAP2       26      /* CPU feature flags 2. */
 
 #define AT_SUN_UID      2000    /* Effective user ID.  */
 #define AT_SUN_RUID     2001    /* Real user ID.  */
-- 
2.18.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Treat all unknown auxv tags on FreeBSD as unknown.
  2018-10-08 22:54 [PATCH 1/2] Support AT_HWCAP2 on FreeBSD John Baldwin
@ 2018-10-08 22:54 ` John Baldwin
  2018-10-16 16:31 ` [PATCH 1/2] Support AT_HWCAP2 on FreeBSD Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: John Baldwin @ 2018-10-08 22:54 UTC (permalink / raw)
  To: gdb-patches, binutils

Previously, default_print_auxv_entry was called for any auxv entries
without a known AT_FREEBSD_* tag.  However, this resulted in false
positive matches when FreeBSD added a new tag that has an existing
AT_* tag with a different meaning.  Instead, only call
default_print_auxv_entry for specific tag values for which FreeBSD
matches the default AT_* values.

gdb/ChangeLog:

	* fbsd-tdep.c (fbsd_print_auxv_entry): Only use
	default_print_auxv_entry for specific tag values.
---
 gdb/ChangeLog   |  5 +++++
 gdb/fbsd-tdep.c | 26 ++++++++++++++++++++------
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 24aeb467b1..6300570b6f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-08  John Baldwin  <jhb@FreeBSD.org>
+
+	* fbsd-tdep.c (fbsd_print_auxv_entry): Only use
+	default_print_auxv_entry for specific tag values.
+
 2018-10-08  John Baldwin  <jhb@FreeBSD.org>
 
 	* fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_FREEBSD_HWCAP2.
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index e948f28abc..28e8d0efc4 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -1483,12 +1483,29 @@ static void
 fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
 		       CORE_ADDR type, CORE_ADDR val)
 {
-  const char *name;
-  const char *description;
-  enum auxv_format format;
+  const char *name = "???";
+  const char *description = "";
+  enum auxv_format format = AUXV_FORMAT_HEX;
 
   switch (type)
     {
+    case AT_NULL:
+    case AT_IGNORE:
+    case AT_EXECFD:
+    case AT_PHDR:
+    case AT_PHENT:
+    case AT_PHNUM:
+    case AT_PAGESZ:
+    case AT_BASE:
+    case AT_FLAGS:
+    case AT_ENTRY:
+    case AT_NOTELF:
+    case AT_UID:
+    case AT_EUID:
+    case AT_GID:
+    case AT_EGID:
+      default_print_auxv_entry (gdbarch, file, type, val);
+      return;
 #define _TAGNAME(tag) #tag
 #define TAGNAME(tag) _TAGNAME(AT_##tag)
 #define TAG(tag, text, kind) \
@@ -1505,9 +1522,6 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
       TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX);
       TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX);
       TAG (HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
-    default:
-      default_print_auxv_entry (gdbarch, file, type, val);
-      return;
     }
 
   fprint_auxv_entry (file, name, description, format, type, val);
-- 
2.18.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Support AT_HWCAP2 on FreeBSD.
  2018-10-08 22:54 [PATCH 1/2] Support AT_HWCAP2 on FreeBSD John Baldwin
  2018-10-08 22:54 ` [PATCH 2/2] Treat all unknown auxv tags on FreeBSD as unknown John Baldwin
@ 2018-10-16 16:31 ` Nick Clifton
  1 sibling, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2018-10-16 16:31 UTC (permalink / raw)
  To: John Baldwin, gdb-patches, binutils

Hi John,

> include/ChangeLog:
> 
> 	* elf/common.h (AT_FREEBSD_HWCAP2): Define.

Approved from a binutils point of view.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-16 16:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-08 22:54 [PATCH 1/2] Support AT_HWCAP2 on FreeBSD John Baldwin
2018-10-08 22:54 ` [PATCH 2/2] Treat all unknown auxv tags on FreeBSD as unknown John Baldwin
2018-10-16 16:31 ` [PATCH 1/2] Support AT_HWCAP2 on FreeBSD Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).