/opt/gcc-arm/bin/arm-none-eabi-g++ ex.cc --specs=nosys.specs --specs=nano.specs -o arm.elf
/opt/gcc-riscv/bin/riscv-none-elf-g++ ex.cc --specs=nosys.specs --specs=nano.specs -o mrs.elf
../Downloads/xpack-riscv-none-elf-gcc-13.2.0-2/bin/riscv-none-elf-g++ ex.cc --specs=nosys.specs --specs=nano.specs -o xpack.elf
size *.elf
??text ???data ????bss ????dec ????hex filename
?47340 ????120 ????420 ??47880 ???bb08 arm.elf
320970 ???4500 ???7224 ?332694 ??51396 mrs.elf
?47109 ???4288 ????724 ??52121 ???cb99 xpack.elf
可見MRS的C++庫優(yōu)化有問題呀。
附上原始的測試文件:
#include
#include
#include
using namespace std;
void MyFunc(int c)
{
??? if (c > numeric_limits< char> ::max())
??? {
??????? throw invalid_argument("MyFunc argument too large.");
??? }
??? //...
}
// extern "C" void SystemInit()
// {
//
// }
int main()
{
??? try
??? {
??????? MyFunc(256); //cause an exception to throw
??? }
??? catch (invalid_argument& e)
??? {
??????? //cerr << e.what() << endl;
??????? return -1;
??? }
??? //...
??? return 0;
}