Linker and Libraries Guide

Platform Specific Shared Objects

An extension to the auxiliary filter naming mechanism provides for the use of the reserved token $PLATFORM. This token is expanded at runtime to reflect the underlying hardware implementation, as displayed by the utility uname(1) with the -i option.

The following example shows how the auxiliary filter libfoo.so.1 can be designed to access a platform specific filtee libbar.so.1:


$ LD_OPTIONS='-f /usr/platform/$PLATFORM/lib/libbar.so.1' \
cc -o libfoo.so.1 -G -K pic -h libfoo.so.1 -R. foo.c
$ dump -Lv libfoo.so.1 | egrep "SONAME|AUXILIARY"
[1]     SONAME    libfoo.so.1
[2]     AUXILIARY /usr/platform/$PLATFORM/lib/libbar.so.1

This mechanism is used on Solaris to provide platform specific extensions to the shared object /usr/lib/libc.so.1.