[IRCServices Coding] Re: Segmentation Error at startup with database load

Andrew Church achurch at achurch.org
Thu Jun 17 13:55:50 PDT 2004

     Moving this to the coding list (and CC'ing you in case you're not
subscribed--apologies if you get this twice).

>As it has been about 15 or 16 years since I have done any serious assembly 
>programming, and GNU is very new to me, I am a bit curious about why this 
>particular solution is chosen.

     My main reason for choosing to use trampolines is simplicity: assuming
the compiler works correctly (which turned out to be an incorrect
assumption, but disregarding that), it's simpler to have a trampoline stub
that looks up a function and then calls that function with whatever
parameters it received, than to write a separate stub for each imported
function and specify the parameters for each explicitly.

     The reason external symbols have to be looked up in the first place is
a chicken-and-egg problem with respect to the various modules that use the
database module.  For example, the main NickServ module (nickserv/main)
calls open_nick_db() in the database module, which in turn calls (among
others) check_expire_nick() in nickserv/main.  Since both modules can't be
loaded simultaneously, one of them has to obtain symbol addresses manually.

     Explicitly passing the addresses of required routines from the caller
to the database module is certainly an option, but goes against my
aesthetic sense. (:  Admittedly, kludging around a broken compiler is just
as bad, but...

     At any rate, it's my intent to redesign the database system for 5.1,
primarily to open the way to using real databases (MySQL, etc.), but also
to clean up leftovers from the old monolithic structure which I essentially
left alone in the 5.0 redesign.

     In the meantime, I'll read through your debugging output and see if I
can come up with a PowerPC kludge.  Could you also try compiling with GCC
3.4.0 and see if that fixes the problem?

  --Andrew Church
    achurch at achurch.org