Repository navigation
2
Our own versions of the string functions made of the primitives, so that what a C library makes of them does not matter: bcmp, bcopy, bzero, explicit_bzero, mempcpy, strnlen, strncat, strlcpy, strlcat, strpbrk, strsep, strtok, strtok_r, strdup, strndup, memmem and strstr (derived.c), each over the str_* entry points: any configuration, any mix of slots, with malloc the one name taken from outside. memmem and strstr scan for the needle's first byte and compare where it is found, and go on by two-way when that does more work than it advances: linear in the haystack whatever the needle.
The archive is one object with one .text laid out by the compiler. A function's symbol is its entry: until now it was the start of its section, so every call first ran the pad that puts the entry at its phase in its 64-byte line (two NOPs in avx2's memcpy, four in memcmp_large). Calls between functions are resolved in the object, and only the ABI is global: the entry points, the new functions, the host's choice, str_table and the configurations.
Two compiler bugs the new functions found are fixed: a spilled value made by a copy and a two-address operation stored nothing back (memmem's bound), and a bool widened from a fused compare could take the compared value's register.
The new functions but memmem and strstr are proved by the contracts of the slots they call; memmem and strstr are tested on every needle and haystack of small alphabets, plainly and past the scan's budget, and on periodic needles. The proof chain last ran on release 1's code: strcat, memset_rep and strcspn in the avx2 family changed since and are not re-proved yet.
Validation: the C test on every configuration and 200 one-slot mixes, the compiler's self-check and the decoder round-trip; line and branch coverage 100% (1421 of 1421 lines, 1244 of 1244 branches).