fix(bench): separate vlibc-under-test TU from host harness TUs

This commit is contained in:
2026-09-03 19:46:20 -04:00
parent 40a392f454
commit 858fc1762c
4 changed files with 86 additions and 9 deletions
+29
View File
@@ -0,0 +1,29 @@
/*
* vlibc-under-test adapter for the bench_vlibc harness (todo 6 bench fix).
*
* This translation unit is compiled with vlibc's OWN headers (-I ../include)
* and is the ONLY TU in the benchmark that may include a vlibc header. The
* harness TU (bench_vlibc.c) must never include one: vlibc's self-contained
* <stdarg.h>/<stddef.h>/<limits.h>/<float.h> shadow GCC's internal headers,
* so any TU that mixes a vlibc header with the host <stdio.h>/<time.h>
* fails to compile (glibc's <stdio.h> needs __gnuc_va_list, which only the
* compiler's internal <stdarg.h> defines). The adapter isolates the
* vlibc-facing call here and exposes it to the host-header harness through
* its own declaration.
*
* Passing through the adapter also drops vlibc_version()'s
* __attribute__((const)) at the harness call site: the harness sees a plain
* external function, so the timed loop genuinely executes the call instead
* of being hoisted out by the optimizer.
*/
#include <vlibc.h>
const char *
bench_vlibc_version(void);
const char *
bench_vlibc_version(void)
{
return vlibc_version();
}