git: bbc0f33b1317 - main - sysent: add a NOLIB modifer to prevent stub generation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Nov 2024 15:45:35 UTC
The branch main has been updated by brooks:
URL: https://cgit.FreeBSD.org/src/commit/?id=bbc0f33b1317bb922ff3d960216ce7b4af88b8af
commit bbc0f33b1317bb922ff3d960216ce7b4af88b8af
Author: Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2024-10-30 22:48:49 +0000
Commit: Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2024-11-01 15:44:47 +0000
sysent: add a NOLIB modifer to prevent stub generation
The yield system call has long existed, but never had a stub. Replace
the hardcoded checks for it in libsys_h.lua and syscalls_map.lua and
stop inserting it into MIASM (requiring libsys/Makefile.sys to disable
the stub).
(This seems like overkill, but I've got another case in CheriBSD so this
reduces my diff appreciably.)
Reviewed by: emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1503
---
sys/kern/syscalls.master | 3 ++-
sys/tools/syscalls/core/syscall.lua | 1 +
sys/tools/syscalls/scripts/libsys_h.lua | 2 +-
sys/tools/syscalls/scripts/syscall_mk.lua | 4 ++--
sys/tools/syscalls/scripts/syscalls_map.lua | 2 +-
5 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/sys/kern/syscalls.master b/sys/kern/syscalls.master
index 7a7530697e59..2bbd20b5a5b0 100644
--- a/sys/kern/syscalls.master
+++ b/sys/kern/syscalls.master
@@ -46,6 +46,7 @@
; NOPROTO same as STD except do not create structure or
; function prototype in sys/sysproto.h. Does add a
; definition to syscall.h besides adding a sysent.
+; NOLIB don't create stubs in libc or libsys
; NOTSTATIC syscall is loadable
; SYSMUX syscall multiplexer. No prototype, argument struct, or
; handler is declared or used. Handled in MD syscall code.
@@ -1679,7 +1680,7 @@
_In_opt_ _Contains_ptr_ struct osigevent *sig
);
}
-321 AUE_NULL STD|CAPENABLED {
+321 AUE_NULL STD|CAPENABLED|NOLIB {
int yield(void);
}
322 AUE_NULL OBSOL thr_sleep
diff --git a/sys/tools/syscalls/core/syscall.lua b/sys/tools/syscalls/core/syscall.lua
index ca96fc160211..e7e3dc3aac33 100644
--- a/sys/tools/syscalls/core/syscall.lua
+++ b/sys/tools/syscalls/core/syscall.lua
@@ -27,6 +27,7 @@ syscall.known_flags = util.set {
-- flags beyond this point are modifiers
"CAPENABLED",
+ "NOLIB",
"NOTSTATIC",
"SYSMUX",
}
diff --git a/sys/tools/syscalls/scripts/libsys_h.lua b/sys/tools/syscalls/scripts/libsys_h.lua
index 75627f08750f..91349d5dc870 100755
--- a/sys/tools/syscalls/scripts/libsys_h.lua
+++ b/sys/tools/syscalls/scripts/libsys_h.lua
@@ -31,7 +31,7 @@ function libsys_h.generate(tbl, config, fh)
local print_decl = function (sc)
return sc:native() and not sc.type.NODEF and
- not sc.type.SYSMUX and sc.name ~= "yield"
+ not sc.type.NOLIB and not sc.type.SYSMUX
end
-- Bind the generator to the parameter file.
diff --git a/sys/tools/syscalls/scripts/syscall_mk.lua b/sys/tools/syscalls/scripts/syscall_mk.lua
index 68438ee8d90c..49d3f6f86c20 100755
--- a/sys/tools/syscalls/scripts/syscall_mk.lua
+++ b/sys/tools/syscalls/scripts/syscall_mk.lua
@@ -44,7 +44,7 @@ function syscall_mk.generate(tbl, config, fh)
for _, v in pairs(s) do
local c = v:compatLevel()
idx = idx + 1
- if v:native() and not v.type.NODEF then
+ if v:native() and not v.type.NODEF and not v.type.NOLIB then
if idx >= size then
-- At last system call, no backslash.
gen:write(string.format("\t%s.o\n", v:symbol()))
@@ -53,7 +53,7 @@ function syscall_mk.generate(tbl, config, fh)
gen:write(string.format("\t%s.o \\\n", v:symbol()))
end
-- Handle compat (everything >= FREEBSD3):
- elseif c >= 7 and not v.type.NODEF then
+ elseif c >= 7 and not v.type.NODEF and not v.type.NOLIB then
if idx >= size then
-- At last system call, no backslash.
gen:write(string.format("\t%s.o\n", v:symbol()))
diff --git a/sys/tools/syscalls/scripts/syscalls_map.lua b/sys/tools/syscalls/scripts/syscalls_map.lua
index 57bb5e9da93b..023b43052921 100755
--- a/sys/tools/syscalls/scripts/syscalls_map.lua
+++ b/sys/tools/syscalls/scripts/syscalls_map.lua
@@ -38,7 +38,7 @@ function syscalls_map.generate(tbl, config, fh)
for _, v in pairs(s) do
--print("num " .. v.num .. " name " .. v.name)
- if v:native() and not v.type.NODEF and v.name ~= "yield" then
+ if v:native() and not v.type.NODEF and not v.type.NOLIB then
if v.name ~= "exit" and v.name ~= "vfork" then
gen:write(string.format("\t_%s;\n", v.name))
end