ecc 抛出链接器错误

ecc throws linker error

我已经下载了 ELLCC 二进制文件(Windows,MinGW)。我正在尝试 assemble 和 link 一个非常简单的 IR 文件。

对于x86_64-ellcc-windows-gnu,它工作正常。对于 armv7-ellcc-linux (arm-linux-engeabi) 和任何其他 ARM 目标,它会抛出类似于以下的 linker 错误:

"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'

阅读 another answer on a similar issue 后,我怀​​疑 linking 顺序错误,因此运行时未正确 linked。

但是我该如何修复 linking 命令 - 或者无论实际问题是什么 - 因为 linker 是由 ecc 调用的?为什么 ecc 没有自动处理这个问题(特别是因为我只给它一个 IR 文件来编译)?

对于arm-linux-engeabi,libc++.a中定义了符号“__aeabi_unwind_cpp_pr0”。看起来您需要将 -lc++ 添加到 link 命令行(在 -lc 之前)或使用 ecc++ 而不是 ecc 到 link 您的程序。

它适用于 x86_64,因为缺少的功能当然是 ARM 特定的。