Skip to content

feat(libbboeos): export full <string.h> surface#450

Merged
bboe merged 1 commit into
mainfrom
bboe/cc-libbboeos-expand
May 20, 2026
Merged

feat(libbboeos): export full <string.h> surface#450
bboe merged 1 commit into
mainfrom
bboe/cc-libbboeos-expand

Conversation

@bboe
Copy link
Copy Markdown
Owner

@bboe bboe commented May 20, 2026

Summary

  • Adds 18 new libbboeos pointer-table exports covering every function in user/libbboeos/string.c (memchr/memcmp/memcpy/memmove/memset/strcasecmp/strcat/strchr/strcpy/strdup/strerror/strlen/strncasecmp/strncat/strncmp/strncpy/strrchr/strstr).
  • Moves FUNCTION_POINTER_TABLE from FUNCTION_TABLE + 0x800 to + 0xE00 so the now-2.8 KB .libbboeos.text+.rodata doesn't overlap the table.
  • strcmp's slot stays pinned at offset 52 (locked by PR feat(cc): extern-call fallback for libbboeos exports #448 consumers); the 18 new entries land after it, sorted alphabetically among themselves.
  • cc.py-built programs are unchanged — builtin path still wins for memcpy/memcmp/memset/strlen because libbboeos extern dispatch only fires when no builtin matches. The exports primarily exist for upcoming Phase 4 (clang programs against libbboeos_stubs.a).

Test plan

  • ./make_os.sh clean
  • tests/test_asm.py (42/42)
  • tests/test_programs.py (89/89)
  • tests/test_bboefs.py (6/6)
  • tests/test_archive.py (12/12)
  • tests/test_kernel_archive.py (12/12)
  • tests/test_cc_compatibility.py (57/57)
  • python3 -m pytest tests/unit/ (458/458)

🤖 Generated with Claude Code

Add memchr/memcmp/memcpy/memmove/memset/strcasecmp/strcat/strchr/
strcmp/strcpy/strdup/strerror/strlen/strncasecmp/strncat/strncmp/
strncpy/strrchr/strstr to the libbboeos pointer table.  Phase 4
clang-built consumers (and future cc.py callers needing a non-builtin
string fn) can now dispatch through [FUNCTION_<NAME>_PTR] instead of
statically linking each body.

cc.py-built programs are unchanged: the builtin path (rep movsb /
repne scasb) still wins for memcpy/memcmp/memset/strlen because the
extern-dispatch path only fires when no builtin matches.

Relocates FUNCTION_POINTER_TABLE from FUNCTION_TABLE + 0x800 to
+ 0xE00 so .libbboeos.text + .rodata (~2.8 KB with all 18 new
bodies pulled in) doesn't overlap the table.  The whole user-space
rebuilds against the new offset on each make_os.sh run, so the
block sorts cleanly alphabetically — strcmp slides from PR #448's
pinned offset 52 into its natural slot at +84.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bboe bboe force-pushed the bboe/cc-libbboeos-expand branch from d7228b2 to 008e3fb Compare May 20, 2026 17:30
@bboe bboe merged commit 5b90a13 into main May 20, 2026
27 checks passed
@bboe bboe deleted the bboe/cc-libbboeos-expand branch May 20, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant