This is the mail archive of the binutils@sources.redhat.com 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]

[RFA] OpenBSD/sparc64 StackGhost core support


StackGhost [1] is now available on OpenBSD/sparc64 too.  To be able to
make sense of corefiles created on future OpenBSD/sparc64 systems, a
nit og code needs to be added to netbsd-core.c.

Ok?

Mark

[1] http://www.usenix.org/events/sec01/full_papers/frantzen/frantzen_html/


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* netbsd-core.c (SPARC_WCOOKIE_OFFSET): Renamed from
	CORE_WCOOKIE_OFFSET.
	(SPARC64_WCOOKIE_OFFSET): New.
	(netbsd_core_file_p): Provide .wcookie section for OpenBSD/sparc64.

Index: netbsd-core.c
===================================================================
RCS file: /cvs/src/src/bfd/netbsd-core.c,v
retrieving revision 1.20
diff -u -p -r1.20 netbsd-core.c
--- netbsd-core.c 28 Mar 2005 14:18:55 -0000 1.20
+++ netbsd-core.c 30 Mar 2005 19:12:50 -0000
@@ -36,7 +36,11 @@
 
 /* Offset of StackGhost cookie within `struct md_coredump' on
    OpenBSD/sparc.  */
-#define CORE_WCOOKIE_OFFSET	344
+#define SPARC_WCOOKIE_OFFSET	344
+
+/* Offset of StackGhost cookie within `struct md_coredump' on
+   OpenBSD/sparc64.  */
+#define SPARC64_WCOOKIE_OFFSET	832
 
 struct netbsd_core_struct
 {
@@ -130,23 +134,39 @@ netbsd_core_file_p (bfd *abfd)
       asect->filepos = offset;
       asect->alignment_power = 2;
 
-      if (CORE_GETMID (core) == M_SPARC_NETBSD
-	  && CORE_GETFLAG (coreseg) == CORE_CPU
-	  && coreseg.c_size > CORE_WCOOKIE_OFFSET)
+      if (CORE_GETFLAG (coreseg) == CORE_CPU)
 	{
-	  /* Truncate the .reg section.  */
-	  asect->size = CORE_WCOOKIE_OFFSET;
+	  bfd_size_type wcookie_offset;
 
-	  /* And create the .wcookie section.  */
-	  asect = bfd_make_section_anyway (abfd, ".wcookie");
-	  if (asect == NULL)
-	    goto punt;
-
-	  asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
-	  asect->size = 4;
-	  asect->vma = 0;
-	  asect->filepos = offset + CORE_WCOOKIE_OFFSET;
-	  asect->alignment_power = 2;
+	  switch (CORE_GETMID (core))
+	    {
+	    case M_SPARC_NETBSD:
+	      wcookie_offset = SPARC_WCOOKIE_OFFSET;
+	      break;
+	    case M_SPARC64_OPENBSD:
+	      wcookie_offset = SPARC64_WCOOKIE_OFFSET;
+	      break;
+	    default:
+	      wcookie_offset = 0;
+	      break;
+	    }
+
+	  if (wcookie_offset > 0 && coreseg.c_size > wcookie_offset)
+	    {
+	      /* Truncate the .reg section.  */
+	      asect->size = wcookie_offset;
+
+	      /* And create the .wcookie section.  */
+	      asect = bfd_make_section_anyway (abfd, ".wcookie");
+	      if (asect == NULL)
+		goto punt;
+
+	      asect->flags = SEC_ALLOC + SEC_HAS_CONTENTS;
+	      asect->size = coreseg.c_size - wcookie_offset;
+	      asect->vma = 0;
+	      asect->filepos = offset + wcookie_offset;
+	      asect->alignment_power = 2;
+	    }
 	}
 
       offset += coreseg.c_size;


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