test(libkernel): name the exception fault test's assembly symbols for Mach-O #16441
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16441"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by evanrk on 2026-11-06T18:07:34Z.
What
GuestExceptionFault.cppdefines its fault sites (FaultTestRead,FaultTestDivideSite,FaultTestJumpand the rest) in top-levelasmunder their bare names. Mach-O prefixes C symbols with an underscore, so on macOS the C++ declarations refer to_FaultTestReadwhile the assembly definesFaultTestRead, andguest_exception_fault_testsdoes not link.Each
.globland label now goes throughAPS5_ASM_SYMBOLfromgeneral/AsmMacros.hpp, which adds the underscore on Apple and expands to the bare name on Linux and Windows. The instructions are unchanged, and the assembly Linux and Windows see is the same as before. This applies the macrof818d5eintroduced for inline assembly on Mach-O hosts to a test file it did not cover.Compiling the
asmblock with clang forx86_64-pc-linux-gnuandx86_64-pc-windows-msvc, before and after this change, gives identical assembly; forx86_64-apple-macosthe only difference is the leading underscore.macOS has no host fault delivery yet:
Exception.cppinstalls it only for Windows and Linux, and the libkernel debt file already says other hosts do not deliver host faults. Once it links, the test segfaults there, soguest_exception_faultis now registered with CTest only when the host is not Apple. The executable still builds on macOS, the test is registered on Linux and Windows as before, and the debt entry now says it is not registered on macOS.Tested
macOS 26.6.2, Apple M4 Pro, Apple clang 21.0.0, x86-64 build with
-DBUILD_TESTING=ON. libkernel does not link on macOS frommainalone, so the test was built on a local branch that adds #7804 and #4630; the file is identical to this PR's.nmon the object shows_FaultTestRead,_FaultTestDivideSiteand the other sites defined, andguest_exception_fault_testslinks.Run directly, the test still fails on macOS (
ctest -R guest_exception_fault: SEGFAULT), as expected without host fault delivery. On a macOS build configured with the CMake change,guest_exception_fault_testsis still built,guest_exception_faultis absent from the generatedCTestTestfile.cmake, andguest_exception_handlerandguest_raise_exceptionare still registered.python3 tools/check_conventions.py --base upstream/mainpasses, andpython3 tools/pr_overlap.pyreports two overlaps: #16070 adds a line inside the block this PR wraps inif(NOT APPLE), and #4630 changes thesceKernelRaiseExceptionentry on the line after the debt entry this PR extends. Whichever merges second keeps both changes, a one-line rebase. Its other reports share the two files but none changes these lines. Not run on Linux or Windows.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)