xref: /freebsd/usr.bin/lorder/lorder.1 (revision f126890ac5386406dadf7c4cfa9566cbb56537c5)
1.\" Copyright (c) 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd February 27, 2024
29.Dt LORDER 1
30.Os
31.Sh NAME
32.Nm lorder
33.Nd list dependencies for object files
34.Sh SYNOPSIS
35.Nm
36.Ar
37.Sh DESCRIPTION
38The
39.Nm
40utility uses
41.Xr nm 1
42to determine interdependencies between object files and library
43archives listed on its command line.
44It then outputs a list of pairs of file names such that the first file
45in each pair references at least one symbol defined by the second.
46.Pp
47The output is normally used with
48.Xr tsort 1
49when a library is created to determine the optimum ordering of the
50object modules so that all references may be resolved in a single
51pass of the loader.
52.Pp
53Similarly, when linking static binaries,
54.Nm
55and
56.Xr tsort 1
57can be used to sort libraries in order of dependency.
58.Pp
59While contemporary linkers no longer require the use of
60.Nm ,
61it is provided for the benefit of legacy code bases and build
62systems which still insist on it.
63.Sh ENVIRONMENT
64.Bl -tag -width indent
65.It Ev NM
66Path to the
67.Xr nm 1
68binary, defaults to
69.Dq Li nm .
70.It Ev NMFLAGS
71Flags to pass to
72.Xr nm 1 .
73.El
74.Sh EXAMPLES
75.Bd -literal -offset indent
76ar cr library.a `lorder ${OBJS} | tsort`
77cc -o foo ${OBJS} `lorder ${STATIC_LIBS} | tsort`
78.Ed
79.Sh SEE ALSO
80.Xr ar 1 ,
81.Xr ld 1 ,
82.Xr nm 1 ,
83.Xr ranlib 1 ,
84.Xr tsort 1
85.Sh HISTORY
86A
87.Nm
88utility appeared in
89.At v7 .
90.Sh CAVEATS
91The
92.Nm
93utility will not work properly if given file names with spaces or
94newlines in them.
95