What is preloading?


by Jakub Hrozek and Andreas Schneider The LD_PRELOAD trick! Preloading is a feature of the dynamic linker (ld). It is a available on most Unix system and allows to load a user specified, shared library before all other shared libraries which are linked to an executable. Library pre-loading is most commonly used when you need a custom version of a library function to be called. You might want to implement your own malloc(3) and free(3) functions that would perform a rudimentary leak checking or memory access control for example, or you might want to extend the I/O calls to dump data when reverse engineering a binary blob. In this case, the library to be preloaded would implement the functions you…

The Gold Linker


After the Update to Fedora 20 I forgot to update the linker to Gold. Today I released that linking Samba is horribly slow. Time to change the linker to Gold again: Fedora: ll /etc/alternatives/ld /usr/sbin/alternatives --set ld /usr/bin/ld.gold openSUSE: ll /etc/alternatives/ld /usr/sbin/update-alternatives --set ld /usr/bin/ld.gold To still build a special project with ld.bfd use: LDFLAGS="-fuse-ld=bfd"

undefined reference to “function name”


Since hermes is flooding my mailbox I haven't looked if all my packages are compiling on Factory. So I had a look for interesting emails today. ctrlproxy (irc proxy/bouncer) didn't build with undefined reference to "". I wondered if the libarary packages have been renamed, but everything looked fine. I've talked to darix and he told me about the --as-needed flag of the linker which is set by default now. I've searched for some documentation didn't find something which explains the problems so here is my documentation. The problem is the linking order of the libraries and source code! Lets look at an example: Assume that you built a static library libwurst and it uses the pow() function from the…