Repository navigation
plat/*/pal: Add extern "C" guard to ectx.h for C++ compatibility - #1832
RaduAndreiTudorica wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes C++ compatibility issues in the platform PAL ECTX headers by ensuring the uk_pal_ectx_* inline definitions use C linkage, preventing conflicts with the extern "C" declarations in lib/ukpal/include/uk/pal/ectx.h.
Changes:
- Add
extern "C"guards toplat/native/pal/include/uk/plat/pal/ectx.h. - Add
extern "C"guards toplat/xen/pal/include/uk/plat/pal/ectx.h.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| plat/xen/pal/include/uk/plat/pal/ectx.h | Wraps PAL ECTX inline definitions in extern "C" to align linkage with the public PAL header. |
| plat/native/pal/include/uk/plat/pal/ectx.h | Wraps PAL ECTX inline definitions in extern "C" to align linkage with the public PAL header. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| static inline void uk_pal_ectx_sanitize(struct uk_pal_ectx *state) | ||
| { | ||
| uk_plat_native_ectx_sanitize((struct uk_plat_native_ectx *)state); |
Bump Redis from 7.0.11 to 8.0.2. Redis 8 introduces fast_float, a C++ implementation of strtod used by util.c. Rather than pulling a full C++ toolchain into the unikernel, provide a strtod() based implementation of fast_float_strtod(). Redis already falls back to strtod() for inputs fast_float does not handle, so behaviour is unchanged. Add a patch leaving HAVE_POPCNT and HAVE_AVX2 undefined: bitops.c and hyperloglog.c call __builtin_cpu_supports() when they are defined, which requires __cpu_model from libgcc. libgcc is not linked into the unikernel, so the generic implementations are used instead. Add the compiler's own include directory to the C include path, which Redis 8 needs for immintrin.h. Tested on qemu/x86_64 with catalog-core/redis: PING, SET and GET work and INFO reports redis_version:8.0.2. Depends on unikraft/unikraft#1832 for the extern "C" guard in ectx.h, needed by the C++ dependency check. Signed-off-by: Radu Andrei Tudorica <raduandreitudorica3@gmail.com>
StefanJum
left a comment
There was a problem hiding this comment.
This is fine @RaduAndreiTudorica , thank you. Please leave a commit message that shortly describes the issue that the missing guard can lead to (the PR description can do fine)
The uk_pal_ectx_* functions in plat/native/pal and plat/xen/pal are defined as static inline without an extern "C" guard. When these headers are pulled into C++ code, the functions get C++ language linkage, which conflicts with the extern "C" declarations in ukpal/include/uk/pal/ectx.h and breaks the build for any C++ application: ukpal/include/uk/pal/ectx.h:63: error: conflicting declaration of 'void uk_pal_ectx_sanitize(uk_pal_ectx*)' with 'C' linkage plat/native/pal/include/uk/plat/pal/ectx.h:28: note: previous declaration with 'C++' linkage One path that reaches it is libcxxabi's cxa_guard.cpp, through uk/syscall.h, uk/arch/ctx.h and uk/lcpu/ectx.h. Tested by building helloworld-cpp on both stable and staging. Signed-off-by: Radu Andrei Tudorica <raduandreitudorica3@gmail.com>
4de07be to
ce24b44
Compare
Done, thanks! |
StefanJum
left a comment
There was a problem hiding this comment.
All good, thanks.
Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com
|
The musl-libc.org didn't serve the tarball. Could someone re-run the job? |
Description of Changes
The
plat/native/pal/include/uk/plat/pal/ectx.handplat/xen/pal/include/uk/plat/pal/ectx.hheaders defineuk_pal_ectx_*functions asstatic inlinewithout anextern "C"guard. When these headers are included from C++ code (e.g., via
libcxxabi's cxa_guard.cpp -> uk/syscall.h -> uk/arch/ctx.h ->
uk/lcpu/ectx.h), the functions get C++ language linkage, conflicting
with the
extern "C"declarations inukpal/include/uk/pal/ectx.h.This causes a build failure for any C++ application on both stable and
staging:
Tested by applying the fix locally and building
helloworld-cppon both stable and staging both build successfully after this change.Related Work
N/A
PR Checklist
checkpatch.ukon your commit series before opening this PR;