This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: undefined reference to __aeabi_unwind_cpp_pr1, __cxa_end_cleanup
JJ <alchemistmba@gmail.com> writes:
>> _aeabi_unwind_cpp_pr1 is normally defined in libgcc. ÂIf the undefined
>> reference is coming from libc, then you need to use -lgcc -lc -lgcc
>> (and, yes, sometimes you need -lgcc -lc -lgcc -lc -lgcc, which you can
>> also write as -Wl,--start-group,-lgcc,-lc,--end-group).
>
> It still complains about _aeabi_unwind_cpp_pr1. If I use only -lgcc,
> the linker complains about both "_aeabi_unwind_cpp_pr1"
> "__cxa_end_cleanup" as well as "memset". I added the -lc option to get
> rid of the "memset" undefined reference error.
Does your libgcc define _aeabi_unwind_cpp_pr1? If not, then you will
need to figure out why it doesn't. It should normally be defined in
an arm-eabi libgcc.
>> __cxa_end_cleanup is normally defined lib libsupc++. ÂSince you are
>> linking C++ code with -nodefaultlibs, you probably need an explicit
>> -lsupc++.
>
> When I add this option, it complains about many more standard symbols:
> strlen, free, malloc, __aeabi_unwind_cpp_pr0, __cxa_pure_virtual etc.
You may need to write your own __cxa_end_cleanup.
Ian