Trochę na temat rqs i rld (w j. angielskim)

Posted on Wed 17 May 2006 in SGI O2 z IRIX • 2 min read

Post znaleziony na Nekochan.net:

Quick overview - feel free to correct glaring errors or ignore if you already know this and I'm being patronising.

Quote:
Any process consists of a number of different segments: Text (executable code), Data, a Stack, and a Heap (labelled "Break" in gmemusage). The Stack is used as temporary storage to pass parameters to functions and return data. The Heap is at the opposite end of memory, and is where more permanent structures - including any memory which is malloc'd - are stored.

Pre-linking (or quickstarting) is a hack whereby the runtime linker (rld, on IRIX) is supposed to be able to work out the best location in memory to load any library, so that when a library is needed by a process the OS can just bang it straight into memory without having to find somewhere to load it and then calculate runtime relocations for all of the exported symbols. This optimisation can significantly decrease the time taken to load large and complex programs (for example, OpenOffice can start almost 50% faster with prelinking) but does mean that your dynamic libraries are effectively no longer quite so dynamic...

What you are seeing is that rqs has become confused, and has instructed rld to load certain libraries (in my case, glib) into a specific location that just happens to be where the process' (in this case, gimp's) heap is held. You're right - the numbered segments the these libraries.

That happens when you malloc a chunk of memory is that the sbrk function is called to increment the process' data segment (delimited by the break value) by the size specified. However, if a library has been mapped into this space then mass breakage occurs - you'll see random crashes and memory allocation failures in any program using the affected library.

This isn't a failure of gimp, or even directly of the libraries: it is rqs telling rld to load libraries at silly places. Reinstalling the affected libraries may help by forcing rqs to recalculate these locations - but if not then you need to clear rqs' state and start again. I had very limited success with this and so, because there were a few other things I wanted to try as well, I reinstalled IRIX from scratch.

The rqsall(1) manpage documents how to relink specific libraries or entire registries - but I'm convinced that is was playing with this which broke my system in the first place...