kern/lock.h on current master unconditionally does

        #include <machine/lock.h>

at line 61 (with a /*XXX*/ marker), even though the body only
references its definitions when NCPUS > 1.  Bugaev's wip-aarch64
worked around this by editing kern/lock.h itself — wrapping the
include in `#if NCPUS > 1` — which would touch a shared file
upstream maintains.

Provide the include as a per-arch shim instead: an empty
aarch64/aarch64/lock.h.  machine/ resolves to the active TARGET's
arch directory at build time, so kern/lock.h's include picks this
up on aarch64 without any shared-file change.  Today aarch64 is
built with NCPUS = 1, so an empty header is sufficient; a future
SMP-capable aarch64 port should fill this in with the low-level
_simple_lock_data_t and _simple_lock / _simple_unlock primitives,
mirroring i386/i386/lock.h.

Without this shim the imported port fails to compile the first
file that pulls in kern/lock.h.
---
 aarch64/aarch64/lock.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 aarch64/aarch64/lock.h

diff --git a/aarch64/aarch64/lock.h b/aarch64/aarch64/lock.h
new file mode 100644
index 00000000..defa702e
--- /dev/null
+++ b/aarch64/aarch64/lock.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2026 Free Software Foundation.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _MACHINE_LOCK_H_
+#define _MACHINE_LOCK_H_
+
+/*
+ *     No machine-specific lock primitives on aarch64 yet.
+ *
+ *     kern/lock.h unconditionally includes this header, but only
+ *     references its definitions when NCPUS > 1.  Today the aarch64
+ *     port is built with NCPUS = 1, so an empty header is sufficient.
+ *     A future SMP-capable aarch64 port should fill this with the
+ *     low-level _simple_lock_data_t and _simple_lock / _simple_unlock
+ *     primitives, mirroring i386/i386/lock.h.
+ */
+
+#endif /* _MACHINE_LOCK_H_ */
-- 
2.54.0


Reply via email to