What is the difference between "shared library text" and "shared library data"? Also, what does it mean for shared library data to be "pre-relocated"? This question is in reference to a couple of AIX-specific features involving shared libraries.
Ah, that's a tricky question.
Alright, so to answer it, you've got to know that an executable file has two* segments: a "text" section and a "data" section.
The "data" segment contains "stuff that won't get executed". For example, strings in the program (for example, the string "Command not found" would be in the data segment of the /bin/sh
binary).
The "text" segment contains "stuff that will get executed" -- the machine instructions.
And, the "pre-relocated"... There is a fairly good explanation of why relocation is needed here: http://people.redhat.com/drepper/textrelocs.html and what is involved here: http://en.wikipedia.org/wiki/Relocation_(computer_science).
Does that help?
*: nitpicker note: it's got more than two, but that's not important right now
Memory is divided into 4 segments - code, data, stack & heap.
The "shared library text" is the code part of the shared library - the actual instructions that implement the functionality in the library.
The "shared library data" is the data part of the shared library - global variables, constants, static stuff, etc. that is allocated immediately when the library is loaded.
As for "pre-relocated" libraries, here's the concept. When a shared library is loaded, it is mapped into a shared address space. A "pre-relocated" library is built with a "hint" telling the OS where in that shared address space it should be loaded. For reasons beyond my understanding, that is supposed to improve performance.