r13804 breaks C++ builds Topic is solved

Report here problems in any of ChibiOS components. This forum is NOT for support.
User avatar
stertingen
Posts: 21
Joined: Mon Jan 13, 2020 10:55 pm
Has thanked: 7 times
Been thanked: 7 times

Re: r13804 breaks C++ builds

Post 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.
Thargon
Posts: 135
Joined: Wed Feb 04, 2015 5:03 pm
Has thanked: 15 times
Been thanked: 24 times

Re: r13804 breaks C++ builds

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: r13804 breaks C++ builds

Post by Giovanni »

Fixed both issues in 20.3, 21.11 and trunk.

Thanks for finding.

Giovanni
Post Reply