Hi, I am using Genode with seL4 backend for my research. I am trying to add a new RPC method to RegionMap. It is meant as a simple exercise in understanding how the RPC framework in Genode works. The function name is "print_regions" and for now it does absolutely nothing. It takes in a void and returns a void. Unfortunately, I am running into some issues while adding this new RPC call to RM. I think I am missing something basic. First I ran into an issue where there was a mismatch between the ABI and library(3). I fixed it to the best of my ability and then got an error during library loading(4). Steps to reproduce and details of errors below.
My diff is available here:
Diff: https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63... HTML: https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63...
It is just upstream genode + 1 commit (my changes)
My platform is Ubuntu 20.04.1 on x86-64
To reproduce:
git clone https://github.com/genodelabs/genode.git genode-question cd genode-question ./tool/ports/prepare_port sel4 ./tool/ports/prepare_port grub2 ./tool/create_builddir x86_64
# Apply patch wget https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63...
git apply 26a79e7f1a77b99fb3b555198a29c638fd510bf4.diff
cd build/x86_64 make run/thread KERNEL=sel4
Here is what I did in my diff.
1. I started off by adding pure virtual func, GENODE_RPC, and an associated change in GENODE_RPC_INTERFACE to Genode::Region_map.
2. Then I went on to fix the others files as the build errors popped up. This was basically in classes that inherited Region_Map.
3. Then I made a change to repos/base/lib/symbols/ld to work around the following error:
Error: size of '_ZTVN6Genode17Region_map_clientE' symbol violates ld ABI (72 bytes in ABI, 80 bytes in library) make[3]: *** [/home/siagraw/genode/repos/base/mk/lib.mk:244: ld-sel4.lib.checked] Error 255 make[2]: *** [var/libdeps:200: ld-sel4.lib] Error 2
I am least sure of this change. I am unsure if this is a file I should even be modifying for something as simple as adding a new RPC method. But I did change it to get past the build error.
4. Then my "make run/thread KERNEL=sel4 " failed with the following error:
Program lib/ld/sel4/ld-sel4 make[1]: Leaving directory '/home/siagraw/genode/build/x86_64' genode build completed using 'core-sel4.a' as 'core.a' using 'ld-sel4.lib.so' as 'ld.lib.so' /usr/local/genode/tool/21.05/bin/../lib/gcc/x86_64-pc-elf/10.3.0/../../../../x86_64-pc-elf/bin/ld: debug/core-sel4.a(region_map_client.o):(.data.rel.ro._ZTVN6Genode17Region_map_clientE[_ZTVN6Genode17Region_map_clientE]+0x40): u' collect2: error: ld returned 1 exit status while executing "exec [cross_dev_prefix]g++ {*}$arch -nostdlib {*}[core_ld_opts] -Wl,-z -Wl,max-page-size=0x1000 -Wl,-Ttext=$link_address -Wl,-gc-sections -Wl,-nost..." (procedure "build_core" line 18) invoked from within "build_core debug/$core_obj {} [run_dir].core [core_link_address]" (procedure "build_core_image" line 16) invoked from within "build_core_image $binaries" (procedure "run_boot_dir" line 19) invoked from within "run_boot_dir $binaries" (procedure "build_boot_image" line 35) invoked from within "build_boot_image "core ld.lib.so init test-thread"" (file "/home/siagraw/genode/repos/base/run/thread.run" line 48) invoked from within "source $include_name" ("foreach" body line 6) invoked from within "foreach include_name [get_cmd_arg --include ""] { # first check if the include name is absolute if {[string first "/" $include_name] == 0} { puts ..." (file "/home/siagraw/genode/tool/run/run" line 1115) make: *** [Makefile:405: run/thread] Error 1
I am at a loss on how to proceed from here and any help would be very useful. Perhaps I have missed another place where I should be adding my new function definition or perhaps the symbols need to be manually updated. As always, thanks for the help.
Best, Sidhartha Agrawal
Hi, I found the problem. I was missing another change in region_map_client.cc. Adding that fixed the issue. Diff: https://github.com/sid-agrawal/genode/commit/e18fdadc0a92746efa0046a7f93c252...
I still have the questions of whether changing the ld file is expected?
-Sid
On Thu, Feb 3, 2022 at 6:48 PM Sid Agrawal siagraw@cs.ubc.ca wrote:
Hi, I am using Genode with seL4 backend for my research. I am trying to add a new RPC method to RegionMap. It is meant as a simple exercise in understanding how the RPC framework in Genode works. The function name is "print_regions" and for now it does absolutely nothing. It takes in a void and returns a void. Unfortunately, I am running into some issues while adding this new RPC call to RM. I think I am missing something basic. First I ran into an issue where there was a mismatch between the ABI and library(3). I fixed it to the best of my ability and then got an error during library loading(4). Steps to reproduce and details of errors below.
My diff is available here:
Diff: https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63... HTML: https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63...
It is just upstream genode + 1 commit (my changes)
My platform is Ubuntu 20.04.1 on x86-64
To reproduce:
git clone https://github.com/genodelabs/genode.git genode-question cd genode-question ./tool/ports/prepare_port sel4 ./tool/ports/prepare_port grub2 ./tool/create_builddir x86_64
# Apply patch wget https://github.com/sid-agrawal/genode/commit/26a79e7f1a77b99fb3b555198a29c63...
git apply 26a79e7f1a77b99fb3b555198a29c638fd510bf4.diff
cd build/x86_64 make run/thread KERNEL=sel4
Here is what I did in my diff.
- I started off by adding pure virtual func, GENODE_RPC, and an
associated change in GENODE_RPC_INTERFACE to Genode::Region_map.
- Then I went on to fix the others files as the build errors popped up.
This was basically in classes that inherited Region_Map.
- Then I made a change to repos/base/lib/symbols/ld to work around the
following error:
Error: size of '_ZTVN6Genode17Region_map_clientE' symbol violates ld ABI (72 bytes in ABI, 80 bytes in library) make[3]: *** [/home/siagraw/genode/repos/base/mk/lib.mk:244: ld-sel4.lib.checked] Error 255 make[2]: *** [var/libdeps:200: ld-sel4.lib] Error 2
I am least sure of this change. I am unsure if this is a file I should even be modifying for something as simple as adding a new RPC method. But I did change it to get past the build error.
- Then my "make run/thread KERNEL=sel4 " failed with the following error:
Program lib/ld/sel4/ld-sel4 make[1]: Leaving directory '/home/siagraw/genode/build/x86_64' genode build completed using 'core-sel4.a' as 'core.a' using 'ld-sel4.lib.so' as 'ld.lib.so' /usr/local/genode/tool/21.05/bin/../lib/gcc/x86_64-pc-elf/10.3.0/../../../../x86_64-pc-elf/bin/ld: debug/core-sel4.a(region_map_client.o):(.data.rel.ro._ZTVN6Genode17Region_map_clientE[_ZTVN6Genode17Region_map_clientE]+0x40): u' collect2: error: ld returned 1 exit status while executing "exec [cross_dev_prefix]g++ {*}$arch -nostdlib {*}[core_ld_opts] -Wl,-z -Wl,max-page-size=0x1000 -Wl,-Ttext=$link_address -Wl,-gc-sections -Wl,-nost..." (procedure "build_core" line 18) invoked from within "build_core debug/$core_obj {} [run_dir].core [core_link_address]" (procedure "build_core_image" line 16) invoked from within "build_core_image $binaries" (procedure "run_boot_dir" line 19) invoked from within "run_boot_dir $binaries" (procedure "build_boot_image" line 35) invoked from within "build_boot_image "core ld.lib.so init test-thread"" (file "/home/siagraw/genode/repos/base/run/thread.run" line 48) invoked from within "source $include_name" ("foreach" body line 6) invoked from within "foreach include_name [get_cmd_arg --include ""] { # first check if the include name is absolute if {[string first "/" $include_name] == 0} { puts ..." (file "/home/siagraw/genode/tool/run/run" line 1115) make: *** [Makefile:405: run/thread] Error 1
I am at a loss on how to proceed from here and any help would be very useful. Perhaps I have missed another place where I should be adding my new function definition or perhaps the symbols need to be manually updated. As always, thanks for the help.
Best, Sidhartha Agrawal
Hello Sid,
you chose most difficult place to play around with RPC functions - the base API. I'd recommend to follow the hello-wrold tutorial [1] for your initial steps.
Regarding your remaining question...
On Fri, Feb 04, 2022 at 05:14:30 CET, Sid Agrawal wrote:
I still have the questions of whether changing the ld file is expected?
On Thu, Feb 3, 2022 at 6:48 PM Sid Agrawal siagraw@cs.ubc.ca wrote:
Error: size of '_ZTVN6Genode17Region_map_clientE' symbol violates ld ABI (72 bytes in ABI, 80 bytes in library) make[3]: *** [/home/siagraw/genode/repos/base/mk/lib.mk:244: ld-sel4.lib.checked] Error 255 make[2]: *** [var/libdeps:200: ld-sel4.lib] Error 2
I am least sure of this change. I am unsure if this is a file I should even be modifying for something as simple as adding a new RPC method. But I did change it to get past the build error.
In Genode, we established the notion of an explicit ABI to clearly separate (platform-specific) library implementations from the clients using the library API. This supports building components for CPU architectures (e.g., x86_64) that are effectively kernel-agnostic and can be run on NOVA, seL4, and Fiasco.OC without recompilation [2].
You added an additional virtual function to Genode::Region_map, which I'd expect to add another entry to the vtable. Running
echo '_ZTVN6Genode17Region_map_clientE' | c++filt -t
vtable for Genode::Region_map_client
reveals that our ABI checker is nagging about insufficient size of the vtable specified in the symbols file for ld.lib.so, which comprises the Genode base ABI implementation (incl. Genode::Region_map and Genode::Region_map_client). For this reason, you had to adapt the symbols spec to fit the vtable, but had not to add another global function.
[1] https://genode.org/documentation/genode-foundations/21.05/getting_started/He... [2] https://genode.org/documentation/release-notes/17.02#Genode_Application_Bina... https://youtu.be/fMahg-01Qbw
Regards
Hi Christian, Thanks for the explanation and the links. I did read the hello world tutorial before trying this out, otherwise, I wouldn't have gotten this far :).
Best, Sid
On Thu, Feb 3, 2022 at 11:31 PM Christian Helmuth < christian.helmuth@genode-labs.com> wrote:
[CAUTION: Non-UBC Email]
Hello Sid,
you chose most difficult place to play around with RPC functions - the base API. I'd recommend to follow the hello-wrold tutorial [1] for your initial steps.
Regarding your remaining question...
On Fri, Feb 04, 2022 at 05:14:30 CET, Sid Agrawal wrote:
I still have the questions of whether changing the ld file is expected?
On Thu, Feb 3, 2022 at 6:48 PM Sid Agrawal siagraw@cs.ubc.ca wrote:
Error: size of '_ZTVN6Genode17Region_map_clientE' symbol violates ld
ABI
(72 bytes in ABI, 80 bytes in library) make[3]: *** [/home/siagraw/genode/repos/base/mk/lib.mk:244: ld-sel4.lib.checked] Error 255 make[2]: *** [var/libdeps:200: ld-sel4.lib] Error 2
I am least sure of this change. I am unsure if this is a file I should even be modifying for something as simple as adding a new RPC method.
But I
did change it to get past the build error.
In Genode, we established the notion of an explicit ABI to clearly separate (platform-specific) library implementations from the clients using the library API. This supports building components for CPU architectures (e.g., x86_64) that are effectively kernel-agnostic and can be run on NOVA, seL4, and Fiasco.OC without recompilation [2].
You added an additional virtual function to Genode::Region_map, which I'd expect to add another entry to the vtable. Running
echo '_ZTVN6Genode17Region_map_clientE' | c++filt -t
vtable for Genode::Region_map_client
reveals that our ABI checker is nagging about insufficient size of the vtable specified in the symbols file for ld.lib.so, which comprises the Genode base ABI implementation (incl. Genode::Region_map and Genode::Region_map_client). For this reason, you had to adapt the symbols spec to fit the vtable, but had not to add another global function.
[1] https://genode.org/documentation/genode-foundations/21.05/getting_started/He... [2] https://genode.org/documentation/release-notes/17.02#Genode_Application_Bina... https://youtu.be/fMahg-01Qbw
Regards
Christian Helmuth Genode Labs
https://www.genode-labs.com/ · https://genode.org/ https://twitter.com/GenodeLabs · https://genodians.org/
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
Genode users mailing list users@lists.genode.org https://lists.genode.org/listinfo/users