You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to trace a C application running on hermitcore with my tracer written in rust (rftrace). I'd ideally want to:
compile the kernel into a static library libhermit.a
compile the rust library into a static library librftrace_frontend_ffi.a
compile the C application, linking to these two (gcc main.c -lhermit -lrftrace_frontend_ffi -o main)
I got it working, but this currently requires a number of workarounds:
duplicate runtime_entry:
the rust-library needs std. std defines runtime_entry, so does newlib which the c app requires.
workaround: remove runtime_entry symbol from the library. As far as I can see this will only affect environment variables, which I dont need and some destructors, which are not strictly needed since the OS will shut down on exit. (objcopy --strip-symbol runtime_entry librftrace_frontend_ffi.a)
OOM exceptions
currently, only 4MB of heap space is allocated for the "kernel" if we enable the newlib feature. This is not actual kernel heap, but all of rust heap. (sidenote: this might also be an issue even if not linking rust+c together, depending on how the virtio virtqueues are utilized)
workaround: patch kernel to increase the size. (let size = 100 * LargePageSize::SIZE; in /src/mm/mod.rs::init())
errors about non-defined functions like sys_tcp_stream_connect
the rust stdlib includes hermit-abi, which contains all "systemcalls". Since the networking changes, there are now a bunch of functions which are not defined in the kernel, but in hermit-sys.
workaround: define empty stub-functions in the c source.
it might be possible to compile hermit-sys as a static library and link against it instead of libhermit.a? I have not investigated this further
The text was updated successfully, but these errors were encountered:
Hm, difficult... Currently, Rust's libstd uses another memory layout in comparison to newlib. This is the reason, why we forward the feature flag newlib during the build process of libhermit, if we use it in combination of newlib.
I want to trace a C application running on hermitcore with my tracer written in rust (rftrace). I'd ideally want to:
libhermit.a
librftrace_frontend_ffi.a
gcc main.c -lhermit -lrftrace_frontend_ffi -o main
)I got it working, but this currently requires a number of workarounds:
objcopy --strip-symbol runtime_entry librftrace_frontend_ffi.a
)let size = 100 * LargePageSize::SIZE;
in/src/mm/mod.rs::init()
)sys_tcp_stream_connect
The text was updated successfully, but these errors were encountered: