Hi,
I'm compiling this simple program:
#include <stdio.h>
#include <ctype.h>
main()
{
printf("Hello World\n");
int x = toupper('x');
printf ("GOT:%d\n", x);
}
If I compile it with these flags all works fine when I run the binary on my router:
mips-openwrt-linux-uclibc-gcc -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -mips16 -minterlink-mips16 -I/home/boil/Documents/opewrt/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include -c -o hello.o hello.c
mips-openwrt-linux-uclibc-gcc -Os -pipe -mno-branch-likely -mips32r2 -mtune=34kc -fno-caller-saves -fhonour-copts -Wno-error=unused-but-set-variable -msoft-float -mips16 -minterlink-mips16 -I/home/boil/Documents/opewrt/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/include -L/home/boil/Documents/opewrt/openwrt/staging_dir/target-mips_34kc_uClibc-0.9.33.2/usr/lib hello.o -o myprogram
This is the output:
root@OpenWrt:/tmp# ./myprogram
Hello World
GOT:88
The problem is when I remove -Os from the flags above and keeping the rest of the flags untouched. It compiles with out errors but at run time I get this output:
root@OpenWrt:/tmp# ./myprogram
Hello World
./myprogram: can't resolve symbol 'toupper' in lib './myprogram'.
Why is removing the -Os flag causing this error at run time ?
Thank you.