|
983 | 983 | \begin{tabular}{ll} |
984 | 984 | \texttt{-o \emph{file}} & output file name (default \texttt{a.out})\\ |
985 | 985 | \texttt{-l\emph{lib}} & link with library \texttt{lib\emph{lib}.so} or |
986 | | -\texttt{lib\emph{lib}.a}\\ |
| 986 | +\texttt{lib\emph{lib}.a}\\ |
987 | 987 | \texttt{-L\emph{path}} & path to libraries (\texttt{-l\emph{lib}})\\ |
988 | 988 | \texttt{-shared} & create a dynamic library\\ |
989 | 989 | \texttt{-non\_shared} & create a static executable |
|
998 | 998 | \item Note that different systems support different options. For example, |
999 | 999 | \texttt{ld} on Solaris does not support \texttt{-shared} and |
1000 | 1000 | \texttt{-non\_shared}, and you have to use alternatives. |
1001 | | -\item An option \texttt{-R} allows to specify where to look for libraries when |
1002 | | -loading the executable via the dynamic linker. That path might be different |
1003 | | -from the path used during building the object, modifiable via \texttt{-L}. |
1004 | | -\item Often you do not use the linker directly at all but pass all the linker |
1005 | | -options via the compiler. |
| 1001 | +\item In most cases the linker is not used directly. Some linker specific |
| 1002 | +options (like \texttt{-l}) are specified as compiler options. The compiler then |
| 1003 | +passes these to the linker. |
| 1004 | +\item For linker options that the compiler is not aware of, one can use |
| 1005 | +the \texttt{-Xlinker} or \texttt{-Wl} compiler options to pass them to the |
| 1006 | +linker. For example, the \texttt{-rpath} linker option allows to specify where |
| 1007 | +to look for libraries when loading the executable via the dynamic linker. |
| 1008 | +That path might be different from the path used during building the object, |
| 1009 | +modifiable via \texttt{-L}. |
1006 | 1010 | \end{itemize} |
1007 | 1011 |
|
1008 | 1012 | %%%%% |
|
0 commit comments