hermit-os / hermit-playground

A playground to build C/C++/Go/Fortran applications on top of RustyHermit
https://hermitcore.org
Apache License 2.0
32 stars 13 forks source link

C applications compiled with playground do not run with qemu #11

Closed lrapp-x41-pub closed 2 years ago

lrapp-x41-pub commented 2 years ago

When I try to run a C application compiled with the method described in this repository with qemu, I always get the error message below. The application runs without any error when using uhyve. I am not sure if this is a bug or just not supported (yet). However , it would be great to be able to use qemu, as uhyve behaves not exactly the same and/or lacks of debugging messages in certain cases.

$ qemu-system-x86_64 -display none -smp 1 -m 64M -serial stdio  -kernel /path/to/rusty-loader -initrd /path/to/application -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr
[LOADER] Loader: [0x100000 - 0x335018]
[LOADER] Found Multiboot information at 0x9500
[LOADER] Found module: [0x337000 - 0x4e0e20]
[LOADER] Module length: 0x1a9e20
[LOADER] Found an ELF module at 0x337000
[LOADER] Map 201 pages at 0x337000 (page size 4 KByte)
[LOADER] Map 1 pages at 0x400000 (page size 2048 KByte)
[LOADER] Allocating 0x70 bytes at 0x132D80, index 0
[LOADER] Allocating 0x4C8 bytes at 0x132E00, index 128
[LOADER] PANIC: 
[LOADER] src/lib.rs:149: 
[LOADER] assertion failed: elf.header.e_type == elf::header::ET_DYN
[LOADER] 
stlankes commented 2 years ago

It should now work. I updated the loader to support Qemu.

lrapp-x41-pub commented 2 years ago

It works, thank you!