Page 2 of 2

Re: r13804 breaks C++ builds

Posted: Sat Nov 13, 2021 5:03 pm
by stertingen
Giovanni wrote:Hi,

I removed the syscalls_cpp.* files (in trunk), now the wrapper includes the normal syscalls.c file. Could you retest the current wrapper? my demo is not failing but something could still be missing.

Giovanni


When using virtual functions in C++, __cxa_pure_virtual() is needed.

Re: r13804 breaks C++ builds

Posted: Thu Dec 02, 2021 1:25 pm
by Thargon
I finally found the time to update my project to the latest ChibiOS (21.11.x) and I'd like to thank you all for looking at the topic. Unfortunately though, I am having issues with the new stubs.

I get the following error message from ld:

Code: Select all

Linking /home/thomas/work/AMiRo/AMiRo-OS/modules/DiWheelDrive_1-2/build/DiWheelDrive_1-2.elf
/home/thomas/Software/gcc-arm-embedded/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /home/thomas/Software/gcc-arm-embedded/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/thumb/v7-m/nofp/libc.a(lib_a-signalr.o): in function `_kill_r':
signalr.c:(.text._kill_r+0x0): multiple definition of `_kill_r'; /home/thomas/work/AMiRo/AMiRo-OS/modules/DiWheelDrive_1-2/build/obj/syscalls.o (symbol from plugin):(.text+0x0): first defined here


However, I could resolve the issue by a small change to syscalls.c:

Code: Select all

--- a/os/various/syscalls.c
+++ b/os/various/syscalls.c
@@ -193,11 +193,18 @@ void _exit(int status) {
 
 /***************************************************************************/
 
-__attribute__((used))
-int _kill_r(struct _reent *r, int pid, int sig) {
-  (void) pid;
-  (void) sig;
-  __errno_r(r) = EINVAL;
-  return -1;
-}
+__attribute__((used))
+int _kill(int pid, int sig) {
+  (void) pid;
+  (void) sig;
+  return -1;
+}

/***************************************************************************/
I basically replaced the new _kill_r() function by the old _kill() method. I have no idea if this is an actual fix or rather a workaround. Maybe the issue with my project is something entirely different (but I have no clue what that could be).
Any comments/help appreciated!

- Thomas

Re: r13804 breaks C++ builds

Posted: Sun Dec 05, 2021 9:39 am
by Giovanni
Fixed both issues in 20.3, 21.11 and trunk.

Thanks for finding.

Giovanni