lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Mike Crowe wrote:
Hi folks,

This is most definitely my problem, but I'm trying to embed Lua in a custom soft-core called NIOS. I have it compiling fine (haven't tested yet), but the size looks ridiculous. Here's what I'm currently seeing (under cygwin):

MCrowe@MCrowe lua $ l lib
total 128
-rw-rw-rw-    1 MCrowe   mkpasswd   130638 Oct 19 21:59 liblua.a
-rw-rw-rw-    1 MCrowe   mkpasswd    92316 Oct 19 21:59 liblualib.a
MCrowe@MCrowe lua $ l bin
total 395
-rw-rw-rw-    1 MCrowe   mkpasswd   403948 Oct 19 21:59 lua
MCrowe@MCrowe lua $

I'm sure it's a compile/linker issue, but it is not intuitively obvious. Here's the flags:

CC = nios2-elf-gcc -c -O2 -fomit-frame-pointer -pedantic -Wall -I(...)/include -D__linux__ -I./include -I. -I..
LDFLAGS = -Wl,-E -msys-crt0=(...)/crt0.o -r -d -L(...)/lib/ -lc

Does anybody see anything flagrant that I am missing?

If you want to have a small size executable, use -Os (optimize for size) instead of (-O2).

Results on an i386-linux:

with MYCFLAGS="-O2":
 112686 liblua.a
  81348 liblualib.a
after stripping:
  78348 liblua.a
  48604 liblualib.a

with MYCFLAGS="-Os":
  95438 liblua.a
  68880 liblualib.a
after stripping:
  61448 liblua.a
  36096 liblualib.a