The way to minimize the C++ binary file compiled by arm g++

来源:互联网 发布:淘宝连衣裙店铺 编辑:程序博客网 时间:2024/06/15 10:23
  1. CFLAGS += -Os
    It means optimize for space.

  2. CFLAGS += -ffunction-sections -fdata-sections
    It means save the function and data to its own sections.

  3. LFLAGS += –gc-sections
    It means enable garbage collection for unused sections.

  4. -fno-rtti -fno-exceptions
    Disable the RTTI and exception of cpp.

  5. LFLAGS += –specs=nano.specs
    Use libc_nano.a libstdc++_nano.a instead of libc.a libstdc++.a
    But this one will lead to error and currently no perfect solution was found.


reference:

http://www.stmcu.org/module/forum/thread-603791-1-1.html

原创粉丝点击