Provide .wcookie section for OpenBSD/sparc64.
authorNick Clifton <nickc@redhat.com>
Tue, 5 Apr 2005 08:01:18 +0000 (08:01 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 5 Apr 2005 08:01:18 +0000 (08:01 +0000)
bfd/ChangeLog
bfd/netbsd-core.c

index caf2ffb8872fdb4a90d4d008dbd8c6f9b4698859..d80f28a5e110063231d8c43c2c80686280606f9a 100644 (file)
@@ -1,3 +1,10 @@
+2005-04-05  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.
+
 2005-04-05  Nick Clifton  <nickc@redhat.com>
 
        * po/rw.po: New translation: Kinyarwanda
index f02192800b75bf69d5063a64a2cb0fbf954e8126..8f12c9558b420c09a09747ff6329b566a77435a2 100644 (file)
 
 /* 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;
-
-         /* 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;
+         bfd_size_type wcookie_offset;
+
+         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;