In gcc-4.2.2/gcc/config/or32/or32.h, there's "-u free" option for always linking free() and malloc() with newlib. We can save 3.8KB program and 2.1KB data memory if the application does not need free() and malloc().
text data bss dec hex filename (without "-u free") 1016 20 0 1036 40c cbasic-nocache-O0-wo-free.or32 text data bss dec hex filename (with "-u free") 4866 2128 56 7050 1b8a cbasic-nocache-O0-free.or32
-Yishin
Here's the patch:
--- gcc-4.2.2/gcc/config/or32/or32.h (revision 259) +++ gcc-4.2.2/gcc/config/or32/or32.h (working copy) @@ -63,10 +63,10 @@ version of the library, but it does have a debugging version (libg.a) / #undef LIB_SPEC #define LIB_SPEC "%{!mor32-newlib:%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}} \
%{mor32-newlib:%{!g:-lc -lor32 -u free -lc} \
%{g:-lg -lor32 -u free -lg}} \
%{mor32-newlib-uart:%{!g:-lc -lor32uart -u free -lc} \
%{g:-lg -lor32uart -u free -lg}}"
%{mor32-newlib:%{!g:-lc -lor32 -lc} \
%{g:-lg -lor32 -lg}} \
%{mor32-newlib-uart:%{!g:-lc -lor32uart -lc} \
%{g:-lg -lor32uart -lg}}"
/ Old definition of LIB_SPEC, not longer used. / /* Which library to get. The only difference from the default is to get