[DTrace-devel] [PATCH] sparc: remove architecture support
Kris Van Hees
kris.van.hees at oracle.com
Wed Mar 4 18:50:59 UTC 2026
Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
COMMANDLINE-OPTIONS | 2 -
GNUmakefile | 10 +-
libdtrace/dt_link.c | 4 +-
libdtrace/dt_open.c | 13 --
libdtrace/procfs.d.in | 3 +-
libproc/sparc/isadep.c | 133 ------------------
libproc/sparc/isadep.h | 81 -----------
test/stress/fbtsafety/tst.vahole.d | 50 -------
test/unittest/arrays/tst.uregsarray.sparc64.d | 69 ---------
test/unittest/arrays/tst.uregsarray.sparc64.x | 4 -
test/unittest/pid/test.sparc64.options | 1 -
11 files changed, 7 insertions(+), 363 deletions(-)
delete mode 100644 libproc/sparc/isadep.c
delete mode 100644 libproc/sparc/isadep.h
delete mode 100755 test/stress/fbtsafety/tst.vahole.d
delete mode 100644 test/unittest/arrays/tst.uregsarray.sparc64.d
delete mode 100755 test/unittest/arrays/tst.uregsarray.sparc64.x
delete mode 100644 test/unittest/pid/test.sparc64.options
diff --git a/COMMANDLINE-OPTIONS b/COMMANDLINE-OPTIONS
index 73be89b1..5920129b 100644
--- a/COMMANDLINE-OPTIONS
+++ b/COMMANDLINE-OPTIONS
@@ -317,8 +317,6 @@ definitions are always specified and valid in all modes:
* __linux
* __unix
* __SVR4
- * __sparc (on SPARC® systems only)
- * __sparcv9 (on SPARC® systems only when 64âbit programs are compiled)
* __i386 (on x86 systems only when 32âbit programs are compiled)
* __amd64 (on x86 systems only when 64âbit programs are compiled)
* __`uname -s` (for example, __Linux)
diff --git a/GNUmakefile b/GNUmakefile
index 835bc9b5..93d2c960 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -20,8 +20,8 @@ VERSION := $(shell ./libdtrace/mkvers -vcurrent=t libdtrace/versions.list)
ARCH := $(shell uname -m)
-$(if $(subst sparc64,,$(subst aarch64,,$(subst x86_64,,$(ARCH)))), \
- $(error "Error: DTrace for Linux only supports x86_64, ARM64 and sparc64"),)
+$(if $(subst aarch64,,$(subst x86_64,,$(ARCH))), \
+ $(error "Error: DTrace for Linux currently only supports x86_64, ARM64"),)
$(if $(subst Linux,,$(shell uname -s)), \
$(error "Error: DTrace only supports Linux"),)
@@ -74,7 +74,7 @@ ifdef KERNELSRCDIR
KERNELOBJDIR ?= $(KERNELSRCDIR)
endif
-KERNELARCH := $(subst sparc64,sparc,$(subst aarch64,arm64,$(subst x86_64,x86,$(ARCH))))
+KERNELARCH := $(subst aarch64,arm64,$(subst x86_64,x86,$(ARCH)))
# Paths.
@@ -120,7 +120,7 @@ export CC ?= gcc
BITNESS := 64
NATIVE_BITNESS_ONLY := $(shell echo 'int main (void) { }' | $(CC) -x c -o /dev/null -m32 - 2>/dev/null || echo t)
-ARCHINC := $(subst sparc64,sparc,$(subst aarch64,arm64,$(subst x86_64,i386,$(ARCH))))
+ARCHINC := $(subst aarch64,arm64,$(subst x86_64,i386,$(ARCH)))
INVARIANT_CFLAGS := -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(if $(NATIVE_BITNESS_ONLY),-DNATIVE_BITNESS_ONLY) -D_DT_VERSION=\"$(VERSION)\"
CPPFLAGS += -Iinclude -Iuts/common -Iinclude/$(ARCHINC) -I$(objdir)
@@ -129,7 +129,7 @@ override CFLAGS += $(INVARIANT_CFLAGS)
PREPROCESS = $(CC) -E
export BPFC ?= bpf-unknown-none-gcc
-BPFCPPFLAGS += -D$(subst sparc64,__sparc,$(subst aarch64,__aarch64__,$(subst x86_64,__amd64,$(ARCH))))
+BPFCPPFLAGS += -D$(subst aarch64,__aarch64__,$(subst x86_64,__amd64,$(ARCH)))
BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if $(HAVE_BPFMASM),-masm=normal) -ffreestanding
export BPFLD ?= bpf-unknown-none-ld
diff --git a/libdtrace/dt_link.c b/libdtrace/dt_link.c
index 6d733881..340273fb 100644
--- a/libdtrace/dt_link.c
+++ b/libdtrace/dt_link.c
@@ -524,9 +524,7 @@ dtrace_program_link(dtrace_hdl_t *dtp, dtrace_prog_t *pgp, uint_t dflags,
if (dtp->dt_oflags & DTRACE_O_ILP32) {
snprintf(drti, sizeof (drti), "%s/drti/drti32.o", libdir->dir_path);
-#if defined(__sparc)
- emu = " -m elf32_sparc";
-#elif defined(__i386) || defined(__amd64)
+#if defined(__i386) || defined(__amd64)
emu = " -m elf_i386";
#endif
} else {
diff --git a/libdtrace/dt_open.c b/libdtrace/dt_open.c
index 54adec02..1322eb3d 100644
--- a/libdtrace/dt_open.c
+++ b/libdtrace/dt_open.c
@@ -827,19 +827,6 @@ dt_vopen(int version, int flags, int *errp,
else if (flags & DTRACE_O_ILP32)
dtp->dt_conf.dtc_ctfmodel = CTF_MODEL_ILP32;
-#ifdef __sparc
- /*
- * On SPARC systems, __sparc is always defined for <sys/isa_defs.h>
- * and __sparcv9 is defined if we are doing a 64-bit compile.
- */
- if (dt_cpp_add_arg(dtp, "-D__sparc") == NULL)
- return set_open_errno(dtp, errp, EDT_NOMEM);
-
- if (dtp->dt_conf.dtc_ctfmodel == CTF_MODEL_LP64 &&
- dt_cpp_add_arg(dtp, "-D__sparcv9") == NULL)
- return set_open_errno(dtp, errp, EDT_NOMEM);
-#endif
-
#ifdef __x86
/*
* On x86 systems, __i386 is defined for <sys/isa_defs.h> for 32-bit
diff --git a/libdtrace/procfs.d.in b/libdtrace/procfs.d.in
index 23454d63..6a0e0122 100644
--- a/libdtrace/procfs.d.in
+++ b/libdtrace/procfs.d.in
@@ -286,8 +286,7 @@ define_for_kernel([[on_cpu]], [[(m4_kver(5,16,0), m4_dnl
[[((struct thread_info *)T->stack)->cpu]]), m4_dnl
(m4_kver(4,9,0), m4_dnl
[[if_arch([[x86]],[[T->cpu]])]] m4_dnl
- [[if_arch([[arm64]],[[T->cpu]])]] m4_dnl
- [[if_arch([[sparc]],[[((struct thread_info *)T->stack)->cpu]])]])]], m4_dnl
+ [[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
[[((struct thread_info *)T->stack)->cpu]])m4_dnl
pr_onpro = on_cpu;
};
diff --git a/libproc/sparc/isadep.c b/libproc/sparc/isadep.c
deleted file mode 100644
index aa4f53f5..00000000
--- a/libproc/sparc/isadep.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * ISA-dependent functions for SPARC and SPARC64.
- */
-
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
- * Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
- */
-
-#include <inttypes.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ptrace.h>
-#include <asm/ptrace.h> /* for struct pt_regs */
-
-#include "Pcontrol.h"
-#include "libproc.h"
-#include "platform.h"
-
-#define PTRACE_GETREGSET 0x4204
-
-/*
- * Get a SPARC64 regset.
- */
-static struct pt_regs *
-getregs_sparc64(struct ps_prochandle *P, struct pt_regs *regs)
-{
- if (Pstate(P) == PS_RUN ||
- Pstate(P) == PS_DEAD)
- return NULL;
-
- if (wrapped_ptrace(P, PTRACE_GETREGS64, P->pid, regs) < 0)
- return NULL;
-
- return regs;
-}
-
-static struct pt_regs32 *
-getregs_sparc32(struct ps_prochandle *P, struct pt_regs32 *regs)
-{
- if (Pstate(P) == PS_RUN ||
- Pstate(P) == PS_DEAD)
- return NULL;
-
- if (wrapped_ptrace(P, PTRACE_GETREGS, P->pid, regs) < 0)
- return NULL;
-
- return regs;
-}
-
-/*
- * Read the first argument of the function at which the process P is halted,
- * which must be a pointer (though other integral arguments happen to work for
- * the SPARC and SPARC64 ABI).
- *
- * For SPARC, the first integral argument to a function will always be in %i0.
- * Horrifically, the value of all the UREG_* constants is off by 1, so we have
- * to correct for that.
- *
- * On error, -1 cast to a uintptr_t is returned, and errno is set.
- */
-uintptr_t
-Pread_first_arg_sparc64(struct ps_prochandle *P)
-{
- struct pt_regs regs;
-
- if (getregs_sparc64(P, ®s) == NULL)
- return (uintptr_t)-1;
-
- return regs.u_regs[UREG_I0 - 1];
-}
-
-uintptr_t
-Pread_first_arg_sparc32(struct ps_prochandle *P)
-{
- struct pt_regs32 regs;
-
- if (getregs_sparc32(P, ®s) == NULL)
- return (uintptr_t)-1;
-
- return regs.u_regs[UREG_I0 - 1];
-}
-
-/*
- * Get the address at which we stopped at a breakpoint. Unlike on x86, no post
- * facto adjustment is required.
- */
-uintptr_t
-Pget_bkpt_ip_sparc64(struct ps_prochandle *P, int expect_esrch)
-{
- struct pt_regs regs;
-
- if (getregs_sparc64(P, ®s) == NULL) {
- if ((errno == ESRCH) && (expect_esrch))
- return 0;
- else {
- _dprintf("Unexpected ptrace (PTRACE_GETREGSET) "
- "error: %s\n", strerror(errno));
- return -1;
- }
- }
-
- return regs.tpc;
-}
-
-/*
- * Reset the instruction pointer address at which the process P is stopped.
- * (Not needed on SPARC.)
- */
-long
-Preset_bkpt_ip_sparc(struct ps_prochandle *P, uintptr_t addr)
-{
- return 0; /* nothing doing */
-}
-
-/*
- * Get the address at which the temporary breakpoint should be dropped when a
- * breakpoint is hit.
- */
-extern long Pget_next_ip_sparc64(struct ps_prochandle *P, uintptr_t addr)
-{
- struct pt_regs regs;
-
- if (getregs_sparc64(P, ®s) == NULL) {
- _dprintf("Unexpected ptrace (PTRACE_GETREGSET) "
- "error: %s\n", strerror(errno));
- return -1;
- }
-
- return regs.tnpc;
-}
diff --git a/libproc/sparc/isadep.h b/libproc/sparc/isadep.h
deleted file mode 100644
index 005e6008..00000000
--- a/libproc/sparc/isadep.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Underlying ISA-dependent functions for SPARC and SPARC64.
- */
-
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
- * Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
- */
-
-/*
- * Not protected against multiple inclusion: this file is included by
- * isadep_dispatch.h repeatedly, at local scope, to get different prototypes and
- * dispatch variables.
- */
-
-#ifdef WANT_FIRST_ARG_DISPATCH
-
-extern uintptr_t Pread_first_arg_sparc64(struct ps_prochandle *P);
-extern uintptr_t Pread_first_arg_sparc32(struct ps_prochandle *P);
-
-isa_dispatch_t dispatch[] = {
- {B_FALSE, EM_SPARCV9, (dispatch_fun_t *) Pread_first_arg_sparc32},
- {B_TRUE, EM_SPARCV9, (dispatch_fun_t *) Pread_first_arg_sparc64},
- {B_FALSE, EM_SPARC32PLUS, (dispatch_fun_t *) Pread_first_arg_sparc32},
- {B_TRUE, EM_SPARC32PLUS, (dispatch_fun_t *) Pread_first_arg_sparc64},
- {B_FALSE, EM_SPARC, (dispatch_fun_t *) Pread_first_arg_sparc32},
- {B_TRUE, EM_SPARC, (dispatch_fun_t *) Pread_first_arg_sparc64}, /* ??? */
- {0, 0, NULL}};
-
-#endif
-
-#ifdef WANT_GET_BKPT_IP
-
-extern uintptr_t Pget_bkpt_ip_sparc64(struct ps_prochandle *P, int expect_esrch);
-
-/*
- * I hope 32-on-64 traps are treated like 64-on-64 traps.
- */
-
-isa_dispatch_t dispatch[] = {
- {B_FALSE, EM_SPARCV9, (dispatch_fun_t *) Pget_bkpt_ip_sparc64},
- {B_TRUE, EM_SPARCV9, (dispatch_fun_t *) Pget_bkpt_ip_sparc64},
- {B_FALSE, EM_SPARC32PLUS, (dispatch_fun_t *) Pget_bkpt_ip_sparc64},
- {B_TRUE, EM_SPARC32PLUS, (dispatch_fun_t *) Pget_bkpt_ip_sparc64},
- {B_FALSE, EM_SPARC, (dispatch_fun_t *) Pget_bkpt_ip_sparc64},
- {B_TRUE, EM_SPARC, (dispatch_fun_t *) Pget_bkpt_ip_sparc64}, /* ??? */
- {0, 0, NULL}};
-
-#endif
-
-#ifdef WANT_RESET_BKPT_IP
-
-extern long Preset_bkpt_ip_sparc(struct ps_prochandle *P, uintptr_t addr);
-
-isa_dispatch_t dispatch[] = {
- {B_FALSE, EM_SPARCV9, (dispatch_fun_t *) Preset_bkpt_ip_sparc},
- {B_TRUE, EM_SPARCV9, (dispatch_fun_t *) Preset_bkpt_ip_sparc},
- {B_FALSE, EM_SPARC32PLUS, (dispatch_fun_t *) Preset_bkpt_ip_sparc},
- {B_TRUE, EM_SPARC32PLUS, (dispatch_fun_t *) Preset_bkpt_ip_sparc},
- {B_FALSE, EM_SPARC, (dispatch_fun_t *) Preset_bkpt_ip_sparc},
- {B_TRUE, EM_SPARC, (dispatch_fun_t *) Preset_bkpt_ip_sparc}, /* ??? */
- {0, 0, NULL}};
-
-#endif
-
-#ifdef WANT_GET_NEXT_IP
-
-extern long Pget_next_ip_sparc64(struct ps_prochandle *P, uintptr_t addr);
-
-isa_dispatch_t dispatch[] = {
- {B_FALSE, EM_SPARCV9, (dispatch_fun_t *) Pget_next_ip_sparc64},
- {B_TRUE, EM_SPARCV9, (dispatch_fun_t *) Pget_next_ip_sparc64},
- {B_FALSE, EM_SPARC32PLUS, (dispatch_fun_t *) Pget_next_ip_sparc64},
- {B_TRUE, EM_SPARC32PLUS, (dispatch_fun_t *) Pget_next_ip_sparc64},
- {B_FALSE, EM_SPARC, (dispatch_fun_t *) Pget_next_ip_sparc64},
- {B_TRUE, EM_SPARC, (dispatch_fun_t *) Pget_next_ip_sparc64}, /* ??? */
- {0, 0, NULL}};
-
-#endif
diff --git a/test/stress/fbtsafety/tst.vahole.d b/test/stress/fbtsafety/tst.vahole.d
deleted file mode 100755
index 732ae3ca..00000000
--- a/test/stress/fbtsafety/tst.vahole.d
+++ /dev/null
@@ -1,50 +0,0 @@
-#!dtrace -Cs
-
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, 2026, Oracle and/or its affiliates. All rights reserved.
- * Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
- */
-
-/* @@skip: nonportable */
-
-/*
- * We set our buffer size absurdly low to prevent a flood of errors that we
- * don't care about.
- */
-#pragma D option bufsize=16
-#pragma D option bufpolicy=ring
-
-fbt:::
-{
- n++;
-#ifdef __sparc
- trace(*(int *)0x8000000000000000 ^ rand());
-#else
- trace(*(int *)(`kernelbase - 1));
-#endif
-}
-
-dtrace:::ERROR
-{
- err++;
-}
-
-tick-1sec
-/sec++ == 10/
-{
- exit(2);
-}
-
-END
-/n == 0 || err == 0/
-{
- exit(1);
-}
-
-END
-/n != 0 && err != 0/
-{
- exit(0);
-}
diff --git a/test/unittest/arrays/tst.uregsarray.sparc64.d b/test/unittest/arrays/tst.uregsarray.sparc64.d
deleted file mode 100644
index 2179a0db..00000000
--- a/test/unittest/arrays/tst.uregsarray.sparc64.d
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
- * Licensed under the Universal Permissive License v 1.0 as shown at
- * http://oss.oracle.com/licenses/upl.
- */
-/* @@xfail: dtv2 */
-
-/*
- * ASSERTION:
- * Positive test to make sure that we can invoke sparc
- * ureg[] aliases.
- *
- * SECTION: User Process Tracing/uregs Array
- *
- * NOTES: This test does no verification - the value of the output
- * is not deterministic.
- */
-
-#pragma D option quiet
-
-BEGIN
-{
- printf("R_G0 = 0x%x\n", uregs[R_G0]);
- printf("R_G1 = 0x%x\n", uregs[R_G1]);
- printf("R_G2 = 0x%x\n", uregs[R_G2]);
- printf("R_G3 = 0x%x\n", uregs[R_G3]);
- printf("R_G4 = 0x%x\n", uregs[R_G4]);
- printf("R_G5 = 0x%x\n", uregs[R_G5]);
- printf("R_G6 = 0x%x\n", uregs[R_G6]);
- printf("R_G7 = 0x%x\n", uregs[R_G7]);
- printf("R_O0 = 0x%x\n", uregs[R_O0]);
- printf("R_O1 = 0x%x\n", uregs[R_O1]);
- printf("R_O2 = 0x%x\n", uregs[R_O2]);
- printf("R_O3 = 0x%x\n", uregs[R_O3]);
- printf("R_O4 = 0x%x\n", uregs[R_O4]);
- printf("R_O5 = 0x%x\n", uregs[R_O5]);
- printf("R_O6 = 0x%x\n", uregs[R_O6]);
- printf("R_O7 = 0x%x\n", uregs[R_O7]);
- printf("R_L0 = 0x%x\n", uregs[R_L0]);
- printf("R_L1 = 0x%x\n", uregs[R_L1]);
- printf("R_L2 = 0x%x\n", uregs[R_L2]);
- printf("R_L3 = 0x%x\n", uregs[R_L3]);
- printf("R_L4 = 0x%x\n", uregs[R_L4]);
- printf("R_L5 = 0x%x\n", uregs[R_L5]);
- printf("R_L6 = 0x%x\n", uregs[R_L6]);
- printf("R_L7 = 0x%x\n", uregs[R_L7]);
- printf("R_I0 = 0x%x\n", uregs[R_I0]);
- printf("R_I1 = 0x%x\n", uregs[R_I1]);
- printf("R_I2 = 0x%x\n", uregs[R_I2]);
- printf("R_I3 = 0x%x\n", uregs[R_I3]);
- printf("R_I4 = 0x%x\n", uregs[R_I4]);
- printf("R_I5 = 0x%x\n", uregs[R_I5]);
- printf("R_I6 = 0x%x\n", uregs[R_I6]);
- printf("R_I7 = 0x%x\n", uregs[R_I7]);
- printf("R_CCR = 0x%x\n", uregs[R_CCR]);
- printf("R_PC = 0x%x\n", uregs[R_PC]);
- printf("R_NPC = 0x%x\n", uregs[R_NPC]);
- printf("R_Y = 0x%x\n", uregs[R_Y]);
- printf("R_ASI = 0x%x\n", uregs[R_ASI]);
- printf("R_FPRS = 0x%x\n", uregs[R_FPRS]);
- exit(0);
-}
-
-ERROR
-{
- printf("uregs access failed.\n");
- exit(1);
-}
diff --git a/test/unittest/arrays/tst.uregsarray.sparc64.x b/test/unittest/arrays/tst.uregsarray.sparc64.x
deleted file mode 100755
index 2c34e04d..00000000
--- a/test/unittest/arrays/tst.uregsarray.sparc64.x
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-
-[ `uname -m` = "sparc64" ] && exit 0
-exit 2
diff --git a/test/unittest/pid/test.sparc64.options b/test/unittest/pid/test.sparc64.options
deleted file mode 100644
index 9e81427e..00000000
--- a/test/unittest/pid/test.sparc64.options
+++ /dev/null
@@ -1 +0,0 @@
-@@skip: pid provider not yet implemented (sparc64)
--
2.51.0
More information about the DTrace-devel
mailing list