This mode is selected when the -dn option is used, and allows for the creation of relocatable objects and static executables. Under this mode only relocatable objects and archive libraries are acceptable forms of input. Use of the -l option will result in a search for archive libraries.
$ cc -dn -r -o temp.o file1.o file2.o file3.o ..... |
The use of static executables is limited. Static executables usually contain
platform specific implementation details which restricts the ability of the executable
to be run on an alternative platform. Also, many implementations of Solaris
libraries depend on dynamic linking capabilities such as dlopen(3X) and dlsym(3X). (see "Loading Additional Objects"). These capabilities
are not available to static executables.
Use the -dn option without the -r option:
$ cc -dn -o prog file1.o file2.o file3.o ..... |
The -a option is available to indicate the creation of a static executable, however, the use of -dn without a -r implies -a.