Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jan 2018 17:56:55 +0000 (UTC)
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r459106 - in head/devel/elfutils: . files
Message-ID:  <201801151756.w0FHut3X081630@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: danfe
Date: Mon Jan 15 17:56:55 2018
New Revision: 459106
URL: https://svnweb.freebsd.org/changeset/ports/459106

Log:
  Unbreak the build on sparc64 by converting to FreeBSD ptrace(2) API.

Added:
  head/devel/elfutils/files/patch-backends_sparc__initreg.c   (contents, props changed)
Modified:
  head/devel/elfutils/Makefile

Modified: head/devel/elfutils/Makefile
==============================================================================
--- head/devel/elfutils/Makefile	Mon Jan 15 17:47:48 2018	(r459105)
+++ head/devel/elfutils/Makefile	Mon Jan 15 17:56:55 2018	(r459106)
@@ -19,7 +19,6 @@ BROKEN_aarch64=		fails to build: fatal error: linux/ui
 BROKEN_armv6=		fails to build: fails to compile i386_disasm.c
 BROKEN_armv7=		fails to build: fails to compile i386_disasm.c
 BROKEN_powerpc64=	fails to build: error: field 'r' has incomplete type
-BROKEN_sparc64=		fails to build: fails to compile dwarf_begin_elf.c
 
 LIB_DEPENDS=	libargp.so:devel/argp-standalone
 PATCH_DEPENDS=	${NONEXISTENT}:devel/gnulib:extract

Added: head/devel/elfutils/files/patch-backends_sparc__initreg.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/elfutils/files/patch-backends_sparc__initreg.c	Mon Jan 15 17:56:55 2018	(r459106)
@@ -0,0 +1,80 @@
+--- backends/sparc_initreg.c.orig	2017-06-19 14:45:16 UTC
++++ backends/sparc_initreg.c
+@@ -33,7 +33,7 @@
+ #include "system.h"
+ #include <stdlib.h>
+ #ifdef __sparc__
+-# include <asm/ptrace.h>
++# include <sys/types.h>
+ # include <sys/ptrace.h>
+ #endif
+ 
+@@ -50,29 +50,29 @@ EBLHOOK (set_initial_registers_tid) (pid
+ #else /* __sparc__ */
+ 
+ 
+-  /* The pt_regs structure filled in by PTRACE_GETREGS provides the
++  /* The pt_regs structure filled in by PT_GETREGS provides the
+      PC, the global registers and the output registers.  Note how the
+      %g0 register is not explicitly provided in the structure (it's
+      value is always 0) and the resulting weird packing in the u_regs
+      array: the last element is not used.  */
+   
+-  struct pt_regs regs;
+-  if (ptrace (PTRACE_GETREGS, tid, &regs, 0) == -1)
++  struct reg regs;
++  if (ptrace (PT_GETREGS, tid, (caddr_t)&regs, 0) == -1)
+     return false;
+ 
+   /* PC: no DWARF number  */
+-  if (!setfunc (-1, 1, (Dwarf_Word *) &regs.tpc, arg))
++  if (!setfunc (-1, 1, (Dwarf_Word *) &regs.r_tpc, arg))
+     return false;
+   
+   /* Global registers: DWARF 0 .. 7  */
+   Dwarf_Word zero = 0;
+   if (!setfunc (0, 1, &zero, arg))
+     return false;
+-  if (!setfunc (1, 7, (Dwarf_Word *) &regs.u_regs[0], arg))
++  if (!setfunc (1, 7, (Dwarf_Word *) &regs.r_global[0], arg))
+     return false;
+ 
+   /* Output registers: DWARF  8 .. 15  */
+-  if (!setfunc (8, 8, (Dwarf_Word *) &regs.u_regs[7], arg))
++  if (!setfunc (8, 8, (Dwarf_Word *) &regs.r_out[0], arg))
+     return false;
+ 
+   /* Local and input registers must be read from the stack.  They are
+@@ -80,7 +80,7 @@ EBLHOOK (set_initial_registers_tid) (pid
+      read above.  */
+ 
+   Dwarf_Word locals_outs[16];
+-  Dwarf_Word sp = regs.u_regs[13];
++  Dwarf_Word sp = regs.r_out[5];
+ 
+   if (sp & 1)
+     {
+@@ -91,9 +91,9 @@ EBLHOOK (set_initial_registers_tid) (pid
+ 
+       for (unsigned i = 0; i < 16; i++)
+         {
+-          locals_outs[i] = ptrace (PTRACE_PEEKDATA, tid,
++          locals_outs[i] = ptrace (PT_READ_D, tid,
+                                    (void *) (uintptr_t) (sp + (i * 8)),
+-                                   NULL);
++                                   0);
+           if (errno != 0)
+             return false;
+         }
+@@ -104,9 +104,9 @@ EBLHOOK (set_initial_registers_tid) (pid
+ 
+       for (unsigned i = 0; i < 8; i++)
+         {
+-          Dwarf_Word tuple = ptrace (PTRACE_PEEKDATA, tid,
++          Dwarf_Word tuple = ptrace (PT_READ_D, tid,
+                                      (void *) (uintptr_t) (sp + (i * 8)),
+-                                     NULL);
++                                     0);
+           if (errno != 0)
+             return false;
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801151756.w0FHut3X081630>