lua-users home
lua-l archive

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


On Sunday, December 08, 2013 07:07:14 AM Dirk Laurie wrote:
> With that command line, I get an executable of 204406 bytes on
> gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5).
> 
> With `make linux`, it's 214894 bytes.
> 
> I guessed the difference is 5.1 compatibility. So:
> 
> cc -O2 -DLUA_USE_LINUX -DLUA_COMPAT_ALL one.c -lm -ldl -lreadline -Wl,-E
> 
> Now the excutable is 204637 bytes. So that's not it.

An amalgamated compilation will usually be smaller than linking a bunch of 
object files. For one, it can merge duplicate strings globally instead of just 
per-unit. Also probably uses relative jumps instead of absolute addresses for 
some things.

That's one of the reasons for amalgamating. Now if the result was larger, that 
would be a surprise.

-- 
tom <telliamed@whoopdedo.org>