The first week of GSOC is up. This is the weekly review of what’s happened.
First I re-read Drepper’s “How to write shared libraries”, to refresh my memory on the correct techniques.
I then proceeded to test those against the Monkey plugins, which are shared libraries by themselves, although used via dlopen instead of dynamic linking.
The plugins had no visibility control whatsoever, exporting a hundred or so unneeded global variables and functions. This causes slower startup for Monkey and each plugin has 5-10kb of extra size.
The only needed exports are those of the plugin API; those starting with _mkp_ and the informational struct plugin_info.
First I attempted to use GCC pragmas and hiding; after discussion on the ML that approach was deemed unsatisfactory, given its requirement of GCC 4.0. (side note: I really think a minimum GCC version should be decided, so that advanced features may be used without ambiguity such as this.)
So the patchset was revised to use the usual approach of defaulting to hidden and specifically exporting each necessary symbol. This results in more writing (one addition per symbol, instead of two per file), but is supported in older compilers too.
As a result, each plugin’s exported symbols dropped from > 100 to about 30, with a corresponding drop in the binary size as well.
This work has not yet been merged.
Later in the week, in preparation for testing my own work later on, and in celebration of the release of LLVM 3.1, I ran monkey through Clang’s static analyzer.
Clang found about 20 issues, most of which were possible crashers. Some were dead writes.
Patches to fix most of these have been applied to master.
Lib-wise, I started on designing the API. It follows the general style of other embeddable www server libs. Right now the API contains the necessary functions for all desired functionality, as well as the necessary enums (assuming I didn’t forget anything ;)).
The public header was posted on the ML as a request for comments; only Ed (my mentor) commented. I assume it’s more of a lack of interest than a general silent acceptance.
- Clang’s analyzer had never been ran on the codebase, based on the results
- Plugin symbol visibility awaiting merging
- Library design right on schedule
Assuming no incoming comments on the API, next week I’ll start on the tasks of week 3-4, moving one week ahead of schedule. The tasks include setting up the build system, function stubs, and then the library implementation.