Page 1 of 1

USE_LDOPT with multiple items

Posted: Mon Nov 24, 2025 3:58 pm
by jcbless
I was trying to add options to USE_LDOPT in the Makefile. I first had -lm alone and that appeared to work correctly. But when I added -lstdc++, then it didn't seem to add the linking for stdc++. Then I reversed it and only put -lstdc++. It seemed to link for stdc++ at that point correctly. But adding -lm after it caused the math additions to not occur.

The error I get if I put in -lstdc++ -lm for USE_LDOPT is:
/home/jcbless/Projects/ChibiStudio/tools/GNU Tools ARM Embedded/11.3.1 2022q3/bin/../lib/gcc/arm-none-eabi/11.3.1/../../../../arm-none-eabi/bin/ld: cannot find -lm,--defsym=__process_stack_size__=0x400,--defsym=__main_stack_size__=0x400: No such file or directory

So in any case it appears that it is not taking in multiple options. Am I correct about this. What can be done to correct this if I'm interpreting the issue correctly?

Thanks,
John

Re: USE_LDOPT with multiple items

Posted: Mon Nov 24, 2025 6:24 pm
by Giovanni
Hi,

Try separating options with commas not spaces.

Giovanni

Re: USE_LDOPT with multiple items

Posted: Mon Nov 24, 2025 6:56 pm
by jcbless
That did it - thanks. Now I'm fighting other errors.

I'm getting:
undefined reference to `__dso_handle'
and
undefined reference to `_fini'
and
hidden symbol `__dso_handle' isn't defined
and
final link failed: bad value

I've added -fno-use-cxa-atexit to USE_CPPOPT and ,lc to USE_LDOPT

Any ideas about these errors?

Thanks,
John

Re: USE_LDOPT with multiple items

Posted: Tue Nov 25, 2025 6:25 am
by Giovanni
Probably it is something missing in linker files, those are not really done to support full C++, you may try to compare with linker files provided with the compiler.

Giovanni

Re: USE_LDOPT with multiple items

Posted: Wed Dec 03, 2025 4:11 pm
by jcbless
I corrected the ,lc to ,-lc since that was one simple mistake.

I also finally realized I had added this to a file while experimenting to solve another problem:
#include <iostream>

That was apparently causing the problems that I was seeing in the previous post. With this text removed I was able to eliminate the errors.