Suppress clang-analyzer-security buffer-handling diagnostics on the
plan-mandated __builtin_memcpy word loads and bugprone swappable-
parameter diagnostics on the C-standard signatures; wrap the autoconf
substitution tokens in clang-format off/on (the space clang-format wants
before the closing @ would break config.status substitution).
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <[email protected]>
System-headers-only harness timing the five L1 string functions
(strlen, strcmp, memcpy, memmove, memset) at 8- and 64-byte inputs.
Calls go through volatile function pointers to defeat builtin
substitution and LICM hoisting; correctness self-asserts route through
the same pointers. Prints FUNC@SIZE ns/call lines.
bench_string uses empty per-target CPPFLAGS (no -I include) so it links
against whichever libc --with-libc= selects; the bench target runs it
always and bench_vlibc only under BENCH_LINK_VLIBC. Both programs
relink when config.status changes, so a reconfigure cannot silently
reuse a binary from the previous libc.
Measured vs glibc 2.44 (median of 3 runs): mem* 1.0-3.3x,
strlen/strcmp 3.2-3.9x — word-at-a-time vs AVX2, all sane.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <[email protected]>
Exact OpenBSD semantics: strlcpy returns strlen(src) and writes at most
size-1 bytes plus NUL; strlcat returns dlen + strlen(src) with
dlen = min(size, strlen(dst)) and never reads past size bytes in dst.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <[email protected]>
Word-at-a-time memcpy/memmove/memset/strlen/strcmp implementing the
level-1 string slice. memcpy carries an optimize(no-tree-loop-
distribute-patterns) attribute: GCC's loop-distribution pass rewrites
its word-copy loop into a self-recursive memcpy@plt call at -O2/-O3
otherwise.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <[email protected]>
Gate the initial string slice per compatibility level: L1 sources compile
everywhere, strlcpy/strlcat only at level >= 2 (PROFILE_GE_2), strcasestr
only at level >= 3 (PROFILE_GE_3). Install the generated
include/vlibc/features.h under $(vlibc_includedir)/vlibc/ via a dedicated
vlibc_featuresdir primary (nodist_nobase is rejected by automake and loses
the vlibc/ subpath). Include stddef.h/string.h in vlibc_include_HEADERS.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)
Co-authored-by: Sisyphus <[email protected]>