[syslinux] Minimal COM32 Root Module

Stefan Bucur stefanb at zytor.com
Sat Aug 16 12:36:51 PDT 2008


On Sat, Aug 16, 2008 at 6:54 PM, H. Peter Anvin <hpa at zytor.com> wrote:
> Stefan Bucur wrote:
>>
>> I'm listing below the name of the object files that are *a surplus*
>> (not required by the COM32 module itself, but included explicitly by
>> me in the module binary). I'm asking your opinion (in particular, hpa)
>> about what are the object files that you don't consider a basic
>> service and don't need to be present in the root module. If you
>> consider 25K an acceptable size for the root module, those objects, of
>> course, don't need to be removed.
>>
>
> Unfortunately, that is really *way* too big, since we want to embed it
> in the root image.  How big is it with the below objects removed?
>
>        -hpa
>

If those objects were removed (that is, the COM32 module is linked
without the --whole-archive option), the module would have ~ 15K (10K
less - almost reduced to a half). However, after a brief analysis of
the linking map provided by ld [1], the module subsystem isn't the
biggest hog in the resulting binary, as I'll show below.

To simplify things, I considered only the .text sections (which
account for the vast majority of the module contents), and the
conclusions were as follows:
 * The COM32 module specific code (that is, the CLI code that puts
everything at some use), accounts for less than 1K. I assume this is
code that is not going to be found into the core, so it can be safely
ignored.
 * The whole module management code, including ELF loading, shallow
module loading, and the execution layer (that does the separation
between libraries & programs), accounts for 4.5K (I excluded the debug
messages, that were found in the .rodata section). I expect that with
a little care and cleanup, when it will be integrated, it could occupy
slightly less space. In particular, code checking for parameter
validity could be removed (if the component infrastructure would
permit that).
 * <stdio.h> and <string.h> code occupies a large amount of space. In
particular, vsnprintf.o and vsscanf.o occupy together almost 4K. I
expect that when put together, that code to account up to 6 - 7K of
the module size.
 * Memory management code stands out too in terms of size. A total of
1.5K for malloc(), realloc() and free().
 * Other code whose size stood out (at least three hex digits), was
the console management code, file operations and a few others. Feel
free to consult the memory map [1] for further details.

As I expect that some of the services used by the module code itself
are already present in SYSLINUX core (especially the standard terminal
I/O ones), I suppose that the final size of the module management
subsystem to be significantly reduced from its minimal 15K size in the
testing COM32 module.

Please correct me if said something wrong / unrealistic. :)

Cheers,
Stefan Bucur

[1] http://zytor.com/~stefanb/syslinux/test_com32.map




More information about the Syslinux mailing list