lorder(1)

lorder1

List dependencies for object files

Usage

lorder file ...

Overview

The lorder utility uses nm(1) to determine interdependencies between object files and library archives listed on its command line. It then outputs a list of pairs of file names such that the first file in each pair references at least one symbol defined by the second.

The output is normally used with tsort(1) when a library is created to determine the optimum ordering of the object modules so that all references may be resolved in a single pass of the loader.

Similarly, when linking static binaries, lorder and tsort(1) can be used to sort libraries in order of dependency.

While contemporary linkers no longer require the use of lorder, it is provided for the benefit of legacy code bases and build systems which still insist on it.

Environment

NM

Path to the nm(1) binary, defaults to “nm”.

NMFLAGS

Flags to pass to nm(1).

Examples

ar cr library.a `lorder ${OBJS} | tsort`
cc -o foo ${OBJS} `lorder ${STATIC_LIBS} | tsort`

Caveats

The lorder utility will not work properly if given file names with spaces or newlines in them.

Releases

87 releases since FreeBSD 2.0.5-RELEASE; the text changed 43 times.

  1. 2.0.5–2.1.7.1
  2. 2.2.2
  3. 2.2.5–3.5.1
  4. 4.0–4.6.2
  5. 4.7–4.11
  6. 5.0–5.2.1
  7. 5.3–6.3
  8. 6.4
  9. 7.0
  10. 7.1
  11. 7.2
  12. 7.3
  13. 7.4
  14. 8.0
  15. 8.1
  16. 8.2
  17. 8.3
  18. 8.4
  19. 9.0
  20. 9.1
  21. 9.2
  22. 9.3
  23. 10.0
  24. 10.1
  25. 10.2
  26. 10.3
  27. 10.4
  28. 11.0
  29. 11.1
  30. 11.2
  31. 11.3
  32. 11.4
  33. 12.0
  34. 12.1
  35. 12.2
  36. 12.3
  37. 12.4
  38. 13.0
  39. 13.1–13.2
  40. 13.3
  41. 13.4–13.5
  42. 14.0
  43. 14.1–14.5
  44. 15.0–16.0

History

A lorder utility appeared in Version 7 AT&T UNIX.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.