* [PATCH] sparc: remove architecture support
@ 2026-03-04 18:50 Kris Van Hees
2026-03-04 20:07 ` [DTrace-devel] " Eugene Loh
0 siblings, 1 reply; 4+ messages in thread
From: Kris Van Hees @ 2026-03-04 18:50 UTC (permalink / raw)
To: dtrace, dtrace-devel
Signed-off-by: Kris Van Hees <kris.van.hees@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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [DTrace-devel] [PATCH] sparc: remove architecture support
2026-03-04 18:50 [PATCH] sparc: remove architecture support Kris Van Hees
@ 2026-03-04 20:07 ` Eugene Loh
2026-03-04 20:25 ` Nick Alcock
2026-03-04 20:31 ` Kris Van Hees
0 siblings, 2 replies; 4+ messages in thread
From: Eugene Loh @ 2026-03-04 20:07 UTC (permalink / raw)
To: Kris Van Hees, dtrace, dtrace-devel
In test/unittest/usdt/tst.enabled2.sh and
test/unittest/aggs/tst.neglquant.d, there are SPARC comments that read
funny in the absence of any SPARC support.
Should libdtrace/sparc/regs.d and include/sparc/platform.h be removed?
On 3/4/26 13:50, Kris Van Hees via DTrace-devel wrote:
> diff --git a/COMMANDLINE-OPTIONS b/COMMANDLINE-OPTIONS
Okay, but this file also has the line "All options are believed to work
equally well on all supported architectures (x86 and SPARC)." How about
s/SPARC/ARM/?
> diff --git 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"),)
Okay, but how about s/x86_64, ARM64/x86_64 and ARM64/?
> $(if $(subst Linux,,$(shell uname -s)), \
> $(error "Error: DTrace only supports Linux"),)
>
> 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;
> };
I can't read M4, but maybe that diff is suspicious? This is what gpt
5.2 says:
### USER
Does the following diff in an m4 file make sense? Are brackets still
balanced?
@@ -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;
};
### ASSISTANT
No as shown, that diff does **not** make sense, and the
brackets/parentheses are very likely **not balanced** anymore (and
theres also an obvious stray character).
### What looks wrong
1. **Stray `l` and unmatched delimiters**
```
[[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
^^^
```
That `l)` sequence is almost certainly accidental. It also strongly
suggests you now have an extra `)` and/or `]` compared to what was intended.
2. **You removed the `sparc` branch and spliced the default expression
oddly**
Originally you had:
```
... [[if_arch([[arm64]],[[T->cpu]])]] m4_dnl
[[if_arch([[sparc]],[[((struct thread_info
*)T->stack)->cpu]])]])]], m4_dnl
```
That last line clearly closes a number of nested `[[ ... ]]` /
`(...)` constructs.
In the new version, you have:
```
[[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
[[((struct thread_info *)T->stack)->cpu]])m4_dnl
```
The default `[[((struct thread_info *)T->stack)->cpu]]` expression
now appears outside of the previous nesting, and the closers that used
to be on the `sparc` line are now partially (and incorrectly) attached
to the `arm64` line.
3. **`m4_dnl` placement**
`m4_dnl` comments out the rest of the line. Moving delimiters to a
new line while also changing where `m4_dnl` lands can easily break
balanced delimiters, because closers might end up being commented away
or no longer part of the intended argument.
### Practical conclusion
- **Brackets are almost certainly unbalanced** after this edit.
- The diff as shown looks like a broken manual edit (typo + moved closers).
### What to do next
- If your intent was only to remove the `sparc` case, the safe approach
is: remove just that `if_arch([[sparc]]...)` fragment but keep the
closing `]])]],` structure intact (i.e., dont move closers onto other
lines).
- Run `m4` on the file (or whatever build step consumes it) and expect
it to fail with a quoting/argument/parenthesis error if this is truly
the current state.
If you paste ~1020 lines around this macro (before/after), I can tell
you exactly where the missing/extra `[[` / `]]` / `(` / `)` are and
suggest a corrected minimal diff.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [DTrace-devel] [PATCH] sparc: remove architecture support
2026-03-04 20:07 ` [DTrace-devel] " Eugene Loh
@ 2026-03-04 20:25 ` Nick Alcock
2026-03-04 20:31 ` Kris Van Hees
1 sibling, 0 replies; 4+ messages in thread
From: Nick Alcock @ 2026-03-04 20:25 UTC (permalink / raw)
To: Eugene Loh via DTrace-devel; +Cc: Kris Van Hees, dtrace, Eugene Loh
I'm leaving most of this patch to Eugene, but...
On 4 Mar 2026, Eugene Loh via DTrace-devel spake thusly:
>> 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;
>> };
>
> I can't read M4, but maybe that diff is suspicious? This is what gpt 5.2 says:
*counts painfully*
I think this is fine, modulo the stray 'l' (correctly pointed out by GPT
5.2). The apparently unbalanced closing )]] is closing the "(m4_kver"
and opening "[[if_arch(..." from a few lines earlier: the removed sparc
line above it had the same trailers.
> ### ASSISTANT
> No as shown, that diff does **not** make sense, and the brackets/parentheses are very likely **not balanced** anymore (and
Wrong.
> ### What looks wrong
>
> 1. **Stray `l` and unmatched delimiters**
> ```
> [[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
> ^^^
> ```
> That `l)` sequence is almost certainly accidental. It also strongly suggests you now have an extra `)` and/or `]` compared to
> what was intended.
Wrong.
> 2. **You removed the `sparc` branch and spliced the default expression oddly**
> Originally you had:
> ```
> ... [[if_arch([[arm64]],[[T->cpu]])]] m4_dnl
> [[if_arch([[sparc]],[[((struct thread_info *)T->stack)->cpu]])]])]], m4_dnl
> ```
> That last line clearly closes a number of nested `[[ ... ]]` / `(...)` constructs.
>
> In the new version, you have:
> ```
> [[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
> [[((struct thread_info *)T->stack)->cpu]])m4_dnl
> ```
> The default `[[((struct thread_info *)T->stack)->cpu]]` expression now appears outside of the previous nesting, and the
> closers that used to be on the `sparc` line are now partially (and incorrectly) attached to the `arm64` line.
Well, yes, you do have to close the same number of closers in total, not
just the same number that were opened on *that line* :)
> 3. **`m4_dnl` placement**
> `m4_dnl` comments out the rest of the line. Moving delimiters to a new line while also changing where `m4_dnl` lands can easily
> break balanced delimiters, because closers might end up being commented away or no longer part of the intended argument.
Err... the patch didn't do that.
> ### Practical conclusion
> - **Brackets are almost certainly unbalanced** after this edit.
Wrong :)
--
NULL && (void)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [DTrace-devel] [PATCH] sparc: remove architecture support
2026-03-04 20:07 ` [DTrace-devel] " Eugene Loh
2026-03-04 20:25 ` Nick Alcock
@ 2026-03-04 20:31 ` Kris Van Hees
1 sibling, 0 replies; 4+ messages in thread
From: Kris Van Hees @ 2026-03-04 20:31 UTC (permalink / raw)
To: Eugene Loh; +Cc: Kris Van Hees, dtrace, dtrace-devel
On Wed, Mar 04, 2026 at 03:07:44PM -0500, Eugene Loh wrote:
> In test/unittest/usdt/tst.enabled2.sh and
> test/unittest/aggs/tst.neglquant.d, there are SPARC comments that read funny
> in the absence of any SPARC support.
Ah, missed that. Will deal with it.
> Should libdtrace/sparc/regs.d and include/sparc/platform.h be removed?
Yes, missed those.
> On 3/4/26 13:50, Kris Van Hees via DTrace-devel wrote:
>
> > diff --git a/COMMANDLINE-OPTIONS b/COMMANDLINE-OPTIONS
>
> Okay, but this file also has the line "All options are believed to work
> equally well on all supported architectures (x86 and SPARC)." How about
> s/SPARC/ARM/?
Sounds good.
> > diff --git 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"),)
>
> Okay, but how about s/x86_64, ARM64/x86_64 and ARM64/?
Sure.
> > $(if $(subst Linux,,$(shell uname -s)), \
> > $(error "Error: DTrace only supports Linux"),)
> > 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;
> > };
>
> I can't read M4, but maybe that diff is suspicious? This is what gpt 5.2
> says:
>
> ### USER
> Does the following diff in an m4 file make sense? Are brackets still
> balanced?
> @@ -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;
> };
>
> ### ASSISTANT
> No - as shown, that diff does **not** make sense, and the
> brackets/parentheses are very likely **not balanced** anymore (and there's
> also an obvious stray character).
>
> ### What looks wrong
>
> 1. **Stray `l` and unmatched delimiters**
The stray 'l' is indeed a bug. Fixed.
The rest the AI bot got wrong.
> ```
> [[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
> ^^^
> ```
> That `l)` sequence is almost certainly accidental. It also strongly
> suggests you now have an extra `)` and/or `]` compared to what was intended.
>
> 2. **You removed the `sparc` branch and spliced the "default" expression
> oddly**
> Originally you had:
> ```
> ... [[if_arch([[arm64]],[[T->cpu]])]] m4_dnl
> [[if_arch([[sparc]],[[((struct thread_info *)T->stack)->cpu]])]])]],
> m4_dnl
> ```
> That last line clearly closes a number of nested `[[ ... ]]` / `(...)`
> constructs.
>
> In the new version, you have:
> ```
> [[if_arch([[arm64]],[[T->cpu]])]]l)]], m4_dnl
> [[((struct thread_info *)T->stack)->cpu]])m4_dnl
> ```
> The "default" `[[((struct thread_info *)T->stack)->cpu]]` expression now
> appears outside of the previous nesting, and the closers that used to be on
> the `sparc` line are now partially (and incorrectly) attached to the `arm64`
> line.
>
> 3. **`m4_dnl` placement**
> `m4_dnl` comments out the rest of the line. Moving delimiters to a new
> line while also changing where `m4_dnl` lands can easily break balanced
> delimiters, because closers might end up being "commented away" or no longer
> part of the intended argument.
>
> ### Practical conclusion
> - **Brackets are almost certainly unbalanced** after this edit.
> - The diff as shown looks like a broken manual edit (typo + moved closers).
>
> ### What to do next
> - If your intent was only to remove the `sparc` case, the safe approach is:
> remove just that `if_arch([[sparc]]...)` fragment but keep the closing
> `]])]],` structure intact (i.e., don't move closers onto other lines).
> - Run `m4` on the file (or whatever build step consumes it) and expect it to
> fail with a quoting/argument/parenthesis error if this is truly the current
> state.
>
> If you paste ~10-20 lines around this macro (before/after), I can tell you
> exactly where the missing/extra `[[` / `]]` / `(` / `)` are and suggest a
> corrected minimal diff.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-04 20:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 18:50 [PATCH] sparc: remove architecture support Kris Van Hees
2026-03-04 20:07 ` [DTrace-devel] " Eugene Loh
2026-03-04 20:25 ` Nick Alcock
2026-03-04 20:31 ` Kris Van Hees
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox