feat(libc): implement getopt_long_only #6533

Merged
ArjenS-LA merged 1 commit from upstream-pr/6533 into main 2026-10-19 04:04:23 +00:00
ArjenS-LA commented 2026-10-15 19:06:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ArjenS-LA on 2026-10-15T19:06:11Z.


What

A PS5 ABI conformance homebrew importing getopt_long_only stops at startup because its NID is absent. Extend the existing parser with single-dash long options, short-option fallback, exact-match precedence and long-only ambiguity rules. Tests also cover arguments, flag pointers, permutation, termination, diagnostics and restart while retaining the existing getopt/getopt_long cases.

Contract: FreeBSD getopt_long.c. The signature/export is also present in the open PS5 payload SDK. This is general library behavior; no title-specific workaround.

Tested

Windows 11 Pro 10.0.26200 x64, Intel Core i7-10700K, supported WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, Python 3.13.7. The full suite's Vulkan tests select an NVIDIA GeForce RTX 4070 SUPER, Windows driver 32.0.16.1088. Baseline b7cedd900d67a94453b8a45eec9b5623532a0441; branch feat/guest-getopt-long-only; tested head 725ad5649c237bd62729f4edf2dea3664b20f02a.

Executed purpose-built PS5 ABI homebrew: identical ELF input is relinked and launched against baseline and rebuilt patched libraries. Baseline stops at the expected unresolved getopt_long_only import (exit 0xC0000139). Fixed reaches the ELF entry point, executes the behavioral checks and exits 0. The input is compiled with clang 23 targeting x86_64-sie-ps5, with NID imports/SCE module metadata and a freestanding entry. Link-time stubs are not deployed; no trap or implementation substitution is used. This establishes module load, entry and conformance completion for this probe, not shipped-title, physical-console or gameplay compatibility.

FAIL: unresolved ELF import oths6jEyBqo from libSceLibcInternal.prx
Transferring control to ELF entry point
PS5 ABI getopt_long_only probe: PASS (single dash, fallback, ambiguity, arguments, permutation)

The full build was attempted on baseline and both fixes. All three hit the same unrelated upstream MinGW error in GpuIndirectArgumentsMisalignedWriterAhead.cpp:25: requested alignment 65536 exceeds the object-file maximum 8192. Continuing Ninja with -k 0 built the remaining available targets; the separate libs target and focused regression tests passed. The same new regression test cannot link on baseline specifically because getopt_long_only_nid_postfix is absent. Conventions and git diff --check pass. A clean full build is not claimed.

Full CTest results (unrelated failures/skips are disclosed):

Build Total Passed Failed Unavailable executable Skipped
Main 1298 1279 2 1 16
This PR 1298 1280 1 1 16

Failed on both: windows_trace_imports. Baseline-only failures: agc_driver_store_over_untracked. Fixed-only failures: none. Skipped on this PR: agc_host_import_sparse, agc_driver_sparse_dma_buf_import, agc_driver_stencil_ref_export, guest_video_out_high_frame_rate, video_out_flip_labels, video_out_flip_labels_main, video_out_flip_lifetime, video_out_flip_reopen, video_out_flip_controls, video_out_flip_overlay, video_out_flip_unopened, video_out_flip_eop, video_out_flip_eop_main, video_out_flip_eop_aftergpu, guest_video_out_wqhd_detection_no_vulkan, long_paths. Native Linux/macOS were not tested locally. GitHub full builds require a collaborator-triggered run under current contribution rules.

Unavailable on this PR: agc_driver_gpu_indirect_arguments_misaligned_writer_ahead. The alignment build error above explains the unavailable AGC executable. Baseline windows_trace_imports fails with WinError 225 because Defender blocks its separate generated fixture; no protection settings were changed. Neither unavailable nor skipped tests are execution evidence.

Reproducer, input/build hashes and library artifacts

Save the C source below as getopt.c and the Python recipe as build_probe.py. Set LLVM_BIN to the bin directory of LLVM MinGW 20261006, then run python build_probe.py getopt getopt_long_only optind optarg puts. The generated input layout is probes/getopt/probe.elf with an empty sce_module/; system-link stubs remain outside that module directory. The script preserves the input after construction.

struct option { const char *name; int has_arg; int *flag; int val; };
_Static_assert(sizeof(struct option) == 32, "option layout");
extern int getopt_long_only(int, char *const *, const char *, const struct option *, int *) IMPORT(getopt_long_only);
extern int optind IMPORT(optind);
extern char *optarg IMPORT(optarg);
extern int puts(const char *) IMPORT(puts);
static int equal(const char *a, const char *b) {
    if (!a) return !*b;
    while (*a && *a == *b) { ++a; ++b; }
    return *a == *b;
}
int _start(void) {
    int flag = 0;
    const struct option options[] = {
        {"alpha", 0, 0, 100}, {"alpine", 0, 0, 100},
        {"required", 1, 0, 101}, {"optional", 2, 0, 102},
        {"flag", 0, &flag, 7}, {0, 0, 0, 0}
    };
    char *arguments[] = {"probe", "operand", "-alpha", "-a", "-acVALUE", "-required=x", "-req", "y", "-optional=z", "-optional", "tail", "-flag", "-al", "--alpha", "--", "-alpha", 0};
    const int expected[] = {100, 'a', 'a', 'c', 101, 101, 102, 102, 0, '?', 100};
    const char *values[] = {"", "", "", "VALUE", "x", "y", "z", "", "", "", ""};
    for (unsigned i = 0; i < sizeof(expected)/sizeof(*expected); ++i) {
        if (getopt_long_only(16, arguments, "ac:", options, 0) != expected[i]) return 1;
        if (!equal(optarg, values[i])) return 2;
    }
    if (getopt_long_only(16, arguments, "ac:", options, 0) != -1 || optind != 13 || flag != 7) return 3;
    if (!equal(arguments[13], "operand") || !equal(arguments[14], "tail") || !equal(arguments[15], "-alpha")) return 4;
    puts("PS5 ABI getopt_long_only probe: PASS (single dash, fallback, ambiguity, arguments, permutation)");
    return 0;
}
import base64
import hashlib
import os
import pathlib
import struct
import subprocess
import sys

root = pathlib.Path(__file__).parent
llvm = pathlib.Path(os.environ.get('LLVM_BIN', str(root / 'cross-toolchain/llvm-mingw-20261006-ucrt-x86_64/bin')))
name = sys.argv[1]
folder = root / 'probes' / name
folder.mkdir(parents=True, exist_ok=True)
(folder / 'sce_module').mkdir(exist_ok=True)
source = (root / (name + '.c')).read_text()
symbols = sys.argv[2:]
aliases = {}
for symbol in symbols:
    digest = hashlib.sha1(symbol.encode() + bytes.fromhex('518d64a635ded8c1e6b039b1c3e55230')).digest()
    aliases[symbol] = base64.b64encode(digest[:8][::-1], altchars=b'+-').decode().rstrip('=') + '#A#B'
for symbol, alias in aliases.items():
    source = source.replace('IMPORT(' + symbol + ')', '__asm__("' + alias + '")')
(folder / 'probe.c').write_text(source)
assembly = '\n'.join(('.data\n.global "{0}"\n.type "{0}",@object\n.size "{0}",8\n"{0}":\n.quad 0' if symbol.startswith('opt') else '.text\n.global "{0}"\n.type "{0}",@function\n"{0}":\nret').format(alias) for symbol, alias in aliases.items())
(folder / 'stubs.s').write_text(assembly)
def run(args):
    print(subprocess.list2cmdline([str(a) for a in args]), flush=True)
    subprocess.run([str(a) for a in args], check=True, cwd=folder)
run([llvm/'clang-23.exe', '-target', 'x86_64-sie-ps5', '-c', '-ffreestanding', '-fno-builtin', '-fno-stack-protector', '-fno-plt', '-fPIC', '-O1', 'probe.c', '-o', 'probe.o'])
run([llvm/'clang-23.exe', '-target', 'x86_64-sie-ps5', '-c', 'stubs.s', '-o', 'stubs.o'])
run([llvm/'ld.lld.exe', '-m', 'elf_x86_64', '-shared', '-soname', 'libSceLibcInternal.prx', 'stubs.o', '-o', 'libSceLibcInternal.so'])
run([llvm/'ld.lld.exe', '-m', 'elf_x86_64', '-pie', '-e', '_start', '-z', 'max-page-size=0x4000', '--hash-style=sysv', 'probe.o', 'libSceLibcInternal.so', '-o', 'probe.elf'])
path = folder/'probe.elf'
image = bytearray(path.read_bytes())
phoff = struct.unpack_from('<Q', image, 32)[0]
phnum = struct.unpack_from('<H', image, 56)[0]
for i in range(phnum):
    ph = phoff + i*56
    if struct.unpack_from('<I', image, ph)[0] != 2:
        continue
    offset, size = struct.unpack_from('<Q', image, ph+8)[0], struct.unpack_from('<Q', image, ph+32)[0]
    tags = [(at, *struct.unpack_from('<qQ', image, at)) for at in range(offset, offset+size, 16)]
    needed = next(value for at, tag, value in tags if tag == 1)
    debug = next(at for at, tag, value in tags if tag == 21)
    struct.pack_into('<qQ', image, debug, 0x61000045, (1 << 48) | needed)
path.write_bytes(image)
print('ELF SHA256', hashlib.sha256(image).hexdigest())

Build each checkout with:

cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON -DPython3_EXECUTABLE=<working-python>
cmake --build build --parallel 4
cmake --build build --parallel 4 -- -k 0
cmake --build build --target libs --parallel 4
ctest --test-dir build --output-on-failure -j 4

Place the toolchain's libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll beside the patched PRXs. Convert each variant with the baseline relinker:

relinker.exe --windows --windows-diagnostics --trace-imports --rpath <variant-build>/core/libs/libs probes/getopt/probe.elf probes/getopt/<variant>.exe
probes/getopt/<variant>.exe

Startup diagnostics recorded the selected library paths. --trace-imports was present but the optional APS5_TRACE_CALLS ring was not enabled; no per-call trace capture is claimed. Execution is demonstrated by the probe's checks and successful return through the converted entry.

Input ELF SHA256: 769696de542b449fc27e6348a29f36a7637a6bf81dbefb8a5957d114d18842b2. Relinker SHA256: a4babf4b9154c44b64676011724911b6fa38451b96923d7d596f48eaaf191f1a.

Artifact Baseline SHA256 Fixed SHA256
libc.prx 59a0ec0a34c68c0c547d8a3e825abee36e0fe1165c6ed9a17a7620128c3daaa8 59a0ec0a34c68c0c547d8a3e825abee36e0fe1165c6ed9a17a7620128c3daaa8
libSceLibcInternal.prx d56fba282a0e9f2a85af9ee1db7037611b2dcc8f35e176aadd1696cd9c845b5b 2e62dd356c43c01eab759ee257ff7913097182f41fb798ae793447bdf69b4ace
libkernel.prx 9b799f8d27051476ebfdc91f92461374fd4526eac142168af3ff30023d34dad1 6fbb16df66b86c39c578423d72ec2f59d839dba330f2abc552addee1f8d9c57d
Open-PR overlap check

Complete paginated inventory: 631 open PRs. Main checked: 44df21632125dbe3113a19173e7ebb879da53003. Exact changed-file lists and every shared-file implementation were inspected; Git tree-only previews normalize both sides to that main as the explicit merge base. 0 reliable clean shared-file comparisons; 0 inconclusive because those peers already conflict with main. No duplicate implementation or reliable pairwise conflict found. The two proposed topics also merge cleanly together; this does not claim combined runtime testing.

The tested base is b7cedd900d67a94453b8a45eec9b5623532a0441. Main advanced during validation; the newer main above was checked for integration conflicts, not claimed as the runtime-tested baseline.

PR Checked head Result
none n/a no shared changed files

Checklist

  • Based on main snapshot b7cedd900d67a94453b8a45eec9b5623532a0441; refreshed current-main merge check above; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no silent stubs added
  • No notes, investigation files or images added to the repository
  • New third-party code is a submodule built from source (no new dependency)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none — purpose-built ABI probe only
  • GPUs tested: NVIDIA GeForce RTX 4070 SUPER, Windows driver 32.0.16.1088, Windows 11 x64 (full-suite regression run; this change is CPU-only)
  • AI-assisted: yes, Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4878458565 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6533). Originally posted by [ArjenS-LA](https://github.com/ArjenS-LA) on 2026-10-15T19:06:11Z. --- ### What A PS5 ABI conformance homebrew importing getopt_long_only stops at startup because its NID is absent. Extend the existing parser with single-dash long options, short-option fallback, exact-match precedence and long-only ambiguity rules. Tests also cover arguments, flag pointers, permutation, termination, diagnostics and restart while retaining the existing getopt/getopt_long cases. Contract: [FreeBSD getopt_long.c](https://github.com/freebsd/freebsd-src/blob/releng/11.0/lib/libc/stdlib/getopt_long.c). The signature/export is also present in the [open PS5 payload SDK](https://github.com/ps5-payload-dev/sdk/tree/f5d40f02770e9b0001dd9e18056eca70b3da8b40). This is general library behavior; no title-specific workaround. ### Tested Windows 11 Pro 10.0.26200 x64, Intel Core i7-10700K, supported WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, Python 3.13.7. The full suite's Vulkan tests select an NVIDIA GeForce RTX 4070 SUPER, Windows driver 32.0.16.1088. Baseline `b7cedd900d67a94453b8a45eec9b5623532a0441`; branch `feat/guest-getopt-long-only`; tested head `725ad5649c237bd62729f4edf2dea3664b20f02a`. **Executed purpose-built PS5 ABI homebrew:** identical ELF input is relinked and launched against baseline and rebuilt patched libraries. Baseline stops at the expected unresolved `getopt_long_only` import (exit `0xC0000139`). Fixed reaches the ELF entry point, executes the behavioral checks and exits `0`. The input is compiled with clang 23 targeting `x86_64-sie-ps5`, with NID imports/SCE module metadata and a freestanding entry. Link-time stubs are not deployed; no trap or implementation substitution is used. This establishes module load, entry and conformance completion for this probe, not shipped-title, physical-console or gameplay compatibility. ```text FAIL: unresolved ELF import oths6jEyBqo from libSceLibcInternal.prx Transferring control to ELF entry point PS5 ABI getopt_long_only probe: PASS (single dash, fallback, ambiguity, arguments, permutation) ``` The full build was attempted on baseline and both fixes. All three hit the same unrelated upstream MinGW error in `GpuIndirectArgumentsMisalignedWriterAhead.cpp:25`: requested alignment 65536 exceeds the object-file maximum 8192. Continuing Ninja with `-k 0` built the remaining available targets; the separate `libs` target and focused regression tests passed. The same new regression test cannot link on baseline specifically because `getopt_long_only_nid_postfix` is absent. Conventions and `git diff --check` pass. A clean full build is not claimed. Full CTest results (unrelated failures/skips are disclosed): | Build | Total | Passed | Failed | Unavailable executable | Skipped | |---|---:|---:|---:|---:|---:| | Main | 1298 | 1279 | 2 | 1 | 16 | | This PR | 1298 | 1280 | 1 | 1 | 16 | Failed on both: `windows_trace_imports`. Baseline-only failures: `agc_driver_store_over_untracked`. Fixed-only failures: none. Skipped on this PR: `agc_host_import_sparse`, `agc_driver_sparse_dma_buf_import`, `agc_driver_stencil_ref_export`, `guest_video_out_high_frame_rate`, `video_out_flip_labels`, `video_out_flip_labels_main`, `video_out_flip_lifetime`, `video_out_flip_reopen`, `video_out_flip_controls`, `video_out_flip_overlay`, `video_out_flip_unopened`, `video_out_flip_eop`, `video_out_flip_eop_main`, `video_out_flip_eop_aftergpu`, `guest_video_out_wqhd_detection_no_vulkan`, `long_paths`. Native Linux/macOS were not tested locally. GitHub full builds require a collaborator-triggered run under current contribution rules. Unavailable on this PR: `agc_driver_gpu_indirect_arguments_misaligned_writer_ahead`. The alignment build error above explains the unavailable AGC executable. Baseline `windows_trace_imports` fails with WinError 225 because Defender blocks its separate generated fixture; no protection settings were changed. Neither unavailable nor skipped tests are execution evidence. <details> <summary>Reproducer, input/build hashes and library artifacts</summary> Save the C source below as `getopt.c` and the Python recipe as `build_probe.py`. Set `LLVM_BIN` to the `bin` directory of [LLVM MinGW 20261006](https://github.com/mstorsjo/llvm-mingw/releases/tag/20261006), then run `python build_probe.py getopt getopt_long_only optind optarg puts`. The generated input layout is `probes/getopt/probe.elf` with an empty `sce_module/`; system-link stubs remain outside that module directory. The script preserves the input after construction. ```c struct option { const char *name; int has_arg; int *flag; int val; }; _Static_assert(sizeof(struct option) == 32, "option layout"); extern int getopt_long_only(int, char *const *, const char *, const struct option *, int *) IMPORT(getopt_long_only); extern int optind IMPORT(optind); extern char *optarg IMPORT(optarg); extern int puts(const char *) IMPORT(puts); static int equal(const char *a, const char *b) { if (!a) return !*b; while (*a && *a == *b) { ++a; ++b; } return *a == *b; } int _start(void) { int flag = 0; const struct option options[] = { {"alpha", 0, 0, 100}, {"alpine", 0, 0, 100}, {"required", 1, 0, 101}, {"optional", 2, 0, 102}, {"flag", 0, &flag, 7}, {0, 0, 0, 0} }; char *arguments[] = {"probe", "operand", "-alpha", "-a", "-acVALUE", "-required=x", "-req", "y", "-optional=z", "-optional", "tail", "-flag", "-al", "--alpha", "--", "-alpha", 0}; const int expected[] = {100, 'a', 'a', 'c', 101, 101, 102, 102, 0, '?', 100}; const char *values[] = {"", "", "", "VALUE", "x", "y", "z", "", "", "", ""}; for (unsigned i = 0; i < sizeof(expected)/sizeof(*expected); ++i) { if (getopt_long_only(16, arguments, "ac:", options, 0) != expected[i]) return 1; if (!equal(optarg, values[i])) return 2; } if (getopt_long_only(16, arguments, "ac:", options, 0) != -1 || optind != 13 || flag != 7) return 3; if (!equal(arguments[13], "operand") || !equal(arguments[14], "tail") || !equal(arguments[15], "-alpha")) return 4; puts("PS5 ABI getopt_long_only probe: PASS (single dash, fallback, ambiguity, arguments, permutation)"); return 0; } ``` ```python import base64 import hashlib import os import pathlib import struct import subprocess import sys root = pathlib.Path(__file__).parent llvm = pathlib.Path(os.environ.get('LLVM_BIN', str(root / 'cross-toolchain/llvm-mingw-20261006-ucrt-x86_64/bin'))) name = sys.argv[1] folder = root / 'probes' / name folder.mkdir(parents=True, exist_ok=True) (folder / 'sce_module').mkdir(exist_ok=True) source = (root / (name + '.c')).read_text() symbols = sys.argv[2:] aliases = {} for symbol in symbols: digest = hashlib.sha1(symbol.encode() + bytes.fromhex('518d64a635ded8c1e6b039b1c3e55230')).digest() aliases[symbol] = base64.b64encode(digest[:8][::-1], altchars=b'+-').decode().rstrip('=') + '#A#B' for symbol, alias in aliases.items(): source = source.replace('IMPORT(' + symbol + ')', '__asm__("' + alias + '")') (folder / 'probe.c').write_text(source) assembly = '\n'.join(('.data\n.global "{0}"\n.type "{0}",@object\n.size "{0}",8\n"{0}":\n.quad 0' if symbol.startswith('opt') else '.text\n.global "{0}"\n.type "{0}",@function\n"{0}":\nret').format(alias) for symbol, alias in aliases.items()) (folder / 'stubs.s').write_text(assembly) def run(args): print(subprocess.list2cmdline([str(a) for a in args]), flush=True) subprocess.run([str(a) for a in args], check=True, cwd=folder) run([llvm/'clang-23.exe', '-target', 'x86_64-sie-ps5', '-c', '-ffreestanding', '-fno-builtin', '-fno-stack-protector', '-fno-plt', '-fPIC', '-O1', 'probe.c', '-o', 'probe.o']) run([llvm/'clang-23.exe', '-target', 'x86_64-sie-ps5', '-c', 'stubs.s', '-o', 'stubs.o']) run([llvm/'ld.lld.exe', '-m', 'elf_x86_64', '-shared', '-soname', 'libSceLibcInternal.prx', 'stubs.o', '-o', 'libSceLibcInternal.so']) run([llvm/'ld.lld.exe', '-m', 'elf_x86_64', '-pie', '-e', '_start', '-z', 'max-page-size=0x4000', '--hash-style=sysv', 'probe.o', 'libSceLibcInternal.so', '-o', 'probe.elf']) path = folder/'probe.elf' image = bytearray(path.read_bytes()) phoff = struct.unpack_from('<Q', image, 32)[0] phnum = struct.unpack_from('<H', image, 56)[0] for i in range(phnum): ph = phoff + i*56 if struct.unpack_from('<I', image, ph)[0] != 2: continue offset, size = struct.unpack_from('<Q', image, ph+8)[0], struct.unpack_from('<Q', image, ph+32)[0] tags = [(at, *struct.unpack_from('<qQ', image, at)) for at in range(offset, offset+size, 16)] needed = next(value for at, tag, value in tags if tag == 1) debug = next(at for at, tag, value in tags if tag == 21) struct.pack_into('<qQ', image, debug, 0x61000045, (1 << 48) | needed) path.write_bytes(image) print('ELF SHA256', hashlib.sha256(image).hexdigest()) ``` Build each checkout with: ```text cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON -DPython3_EXECUTABLE=<working-python> cmake --build build --parallel 4 cmake --build build --parallel 4 -- -k 0 cmake --build build --target libs --parallel 4 ctest --test-dir build --output-on-failure -j 4 ``` Place the toolchain's `libgcc_s_seh-1.dll`, `libstdc++-6.dll` and `libwinpthread-1.dll` beside the patched PRXs. Convert each variant with the baseline relinker: ```text relinker.exe --windows --windows-diagnostics --trace-imports --rpath <variant-build>/core/libs/libs probes/getopt/probe.elf probes/getopt/<variant>.exe probes/getopt/<variant>.exe ``` Startup diagnostics recorded the selected library paths. `--trace-imports` was present but the optional `APS5_TRACE_CALLS` ring was not enabled; no per-call trace capture is claimed. Execution is demonstrated by the probe's checks and successful return through the converted entry. Input ELF SHA256: `769696de542b449fc27e6348a29f36a7637a6bf81dbefb8a5957d114d18842b2`. Relinker SHA256: `a4babf4b9154c44b64676011724911b6fa38451b96923d7d596f48eaaf191f1a`. | Artifact | Baseline SHA256 | Fixed SHA256 | |---|---|---| | libc.prx | `59a0ec0a34c68c0c547d8a3e825abee36e0fe1165c6ed9a17a7620128c3daaa8` | `59a0ec0a34c68c0c547d8a3e825abee36e0fe1165c6ed9a17a7620128c3daaa8` | | libSceLibcInternal.prx | `d56fba282a0e9f2a85af9ee1db7037611b2dcc8f35e176aadd1696cd9c845b5b` | `2e62dd356c43c01eab759ee257ff7913097182f41fb798ae793447bdf69b4ace` | | libkernel.prx | `9b799f8d27051476ebfdc91f92461374fd4526eac142168af3ff30023d34dad1` | `6fbb16df66b86c39c578423d72ec2f59d839dba330f2abc552addee1f8d9c57d` | </details> <details> <summary>Open-PR overlap check</summary> Complete paginated inventory: 631 open PRs. Main checked: `44df21632125dbe3113a19173e7ebb879da53003`. Exact changed-file lists and every shared-file implementation were inspected; Git tree-only previews normalize both sides to that main as the explicit merge base. 0 reliable clean shared-file comparisons; 0 inconclusive because those peers already conflict with main. No duplicate implementation or reliable pairwise conflict found. The two proposed topics also merge cleanly together; this does not claim combined runtime testing. The tested base is `b7cedd900d67a94453b8a45eec9b5623532a0441`. Main advanced during validation; the newer main above was checked for integration conflicts, not claimed as the runtime-tested baseline. | PR | Checked head | Result | |---|---|---| | none | n/a | no shared changed files | </details> ### Checklist - [x] Based on `main` snapshot `b7cedd900d67a94453b8a45eec9b5623532a0441`; refreshed current-main merge check above; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation files or images added to the repository - [x] New third-party code is a submodule built from source (no new dependency) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none — purpose-built ABI probe only - [x] GPUs tested: NVIDIA GeForce RTX 4070 SUPER, Windows driver 32.0.16.1088, Windows 11 x64 (full-suite regression run; this change is CPU-only) - [x] AI-assisted: yes, Codex
github-actions[bot] commented 2026-10-15 19:06:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T19:06:56Z.


Progress report (44df216 → 725ad56)

➖ System libraries: 88.8% (+0.0%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceLibcInternal getopt_long_only_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6200123828 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6533#issuecomment-6200123828). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T19:06:56Z. --- <!-- progress-report --> ### Progress report (44df216 → 725ad56) ➖ **System libraries**: 88.8% (+0.0%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceLibcInternal | `getopt_long_only_nid_postfix` | </details>
karimibrahim07 commented 2026-10-16 14:13:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by karimibrahim07 on 2026-10-16T14:13:12Z.

Review: COMMENTED


Windows check of head 725ad5649 (together with #6532), on main 5d9dcc42d. Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release.

  • guest_getopt passes.

  • Code: I compared it with FreeBSD 11's getopt_long.c and it follows that code:

    • long-option parsing when the element starts with - in long-only mode, with D_PREFIX as the dash;
    • short_too when the character is a short option other than :;
    • a one-character partial match skipped when short_too is set;
    • in long-only mode, any second partial match is ambiguous ((flags & FLAG_LONGONLY) || …);
    • on no match with short_too, --optind and -1, so the element is reparsed as short options;
    • -W passes shortToo = false, as parse_long_options is called there with 0.

    No issues.

Evidence: both descriptions use a purpose-built probe. In earlier rounds maintainers held back functions that no shipped title or released homebrew imports yet, so a real importer would help. I checked the two released websrv payloads built with the same ps5-payload-dev SDK. Neither Mari0 (Mari0.zip from websrv v0.34, SHA-256 e0331ed5…2ce3, the bundle in #6239) nor the Quake homebrew (#6698) imports bcopy or getopt_long_only, in love.elf/quake.elf or in their libOSMesa.so.8. If a released title or homebrew does, naming it would make the case.

Build note: with the same WinLibs GCC 15.2.0 r7, a full build of main 5d9dcc42d plus this PR (and #6532/#6533 together) completes here without the GpuIndirectArgumentsMisalignedWriterAhead.cpp:25 alignment error, so that error looks specific to your tree or setup.

AI-assisted: yes. I ran the build and tests above and read the import tables of the two bundles.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5548974196 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6533#pullrequestreview-5548974196). Originally posted by [karimibrahim07](https://github.com/karimibrahim07) on 2026-10-16T14:13:12Z. **Review:** COMMENTED --- Windows check of head `725ad5649` (together with #6532), on `main` `5d9dcc42d`. Windows 11 Pro (26300), WinLibs GCC 15.2.0 r7, Ninja Release. - `guest_getopt` passes. - **Code:** I compared it with FreeBSD 11's `getopt_long.c` and it follows that code: - long-option parsing when the element starts with `-` in long-only mode, with `D_PREFIX` as the dash; - `short_too` when the character is a short option other than `:`; - a one-character partial match skipped when `short_too` is set; - in long-only mode, any second partial match is ambiguous (`(flags & FLAG_LONGONLY) || …`); - on no match with `short_too`, `--optind` and `-1`, so the element is reparsed as short options; - `-W` passes `shortToo = false`, as `parse_long_options` is called there with `0`. No issues. **Evidence:** both descriptions use a purpose-built probe. In earlier rounds maintainers held back functions that no shipped title or released homebrew imports yet, so a real importer would help. I checked the two released websrv payloads built with the same ps5-payload-dev SDK. Neither Mari0 (`Mari0.zip` from websrv v0.34, SHA-256 `e0331ed5…2ce3`, the bundle in #6239) nor the Quake homebrew (#6698) imports `bcopy` or `getopt_long_only`, in `love.elf`/`quake.elf` or in their `libOSMesa.so.8`. If a released title or homebrew does, naming it would make the case. **Build note:** with the same WinLibs GCC 15.2.0 r7, a full build of `main` `5d9dcc42d` plus this PR (and #6532/#6533 together) completes here without the `GpuIndirectArgumentsMisalignedWriterAhead.cpp:25` alignment error, so that error looks specific to your tree or setup. AI-assisted: yes. I ran the build and tests above and read the import tables of the two bundles.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6533
No description provided.