ecc throws linker error

212 views Asked by At

I've downloaded the ELLCC binaries (Windows, MinGW). I'm trying to assemble and link a single very simple IR file.

For x86_64-ellcc-windows-gnu, it works fine. For armv7-ellcc-linux (arm-linux-engeabi) and any other ARM target, it throws a linker error similar to this:

"V:\Users\Teo\Downloads\ellcc-x86_64-w64-mingw32-0.1.12\bin/ecc-ld.exe" -n ostdlib "-LV:\Users\Teo\Downloads\ellcc-x86_64-w64-mingw32-0.1.12\bin\..\ libecc/lib/arm-linux-engeabi" -m armelf_linux_eabi --build-id --hash-style=gnu - -eh-frame-hdr -o a.out -e start -Bstatic "V:\Users\Teo\Downloads\ellcc-x86 64-w64-mingw32-0.1.12\bin\..\libecc/lib/arm-linux-engeabi/crt1.o" "V:\Users\ \Teo\Downloads\ellcc-x86_64-w64-mingw32-0.1.12\bin\..\libecc/lib/arm-linux- engeabi/crtbegin.o" "C:\Users\Teo\AppData\Local\Temp\Int32Add-42cacb.o" -( -lc -lcompiler-rt -) "V:\Users\Teo\Downloads\ellcc-x86_64-w64-mingw32-0.1.1 2\bin\..\libecc/lib/arm-linux-engeabi/crtend.o" C:\Users\Teo\AppData\Local\Temp\Int32Add-42cacb.o:(.ARM.exidx+0x0): undefined re ference to `__aeabi_unwind_cpp_pr0'

Having read another answer on a similar issue, I suspect that the linking order is wrong and thus the runtime is not being linked correctly.

But how would I fix the linking order - or whatever the problem actually is -, since the linker is invoked by ecc? Is there a reason why ecc doesn't take care of this automatically (especially since I'm only giving it just one IR file to compile)?

1

There are 1 answers

0
Richard Pennington On BEST ANSWER

For arm-linux-engeabi, the symbol "__aeabi_unwind_cpp_pr0" is defined in libc++.a. It looks like you need to add -lc++ to your link command line (before the -lc) or use ecc++ rather than ecc to link your program.

It works for x86_64 because the missing function is ARM specific, of course.