Commit graph

45 commits

Author SHA1 Message Date
Dag-Erling Smørgrav aa80cfadff lorder: Tweak invalid file test.
Different implementations of `nm` have different ways of telling you
that your file is not a valid object or library, but they all seem to
have “not recognized” as a common substring.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44154
2024-02-29 14:59:25 +01:00
Dag-Erling Smørgrav aedb37dc49 lorder: Don't rely on legacy syntax.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44155
2024-02-29 14:59:21 +01:00
Dag-Erling Smørgrav cf4d9bf8b3 lorder: Undeprecate.
While lorder is not required by our current toolchain (or any toolchain
we've used in the past decade or two), it still occasionally shows up
in build systems of third party software, including The Open Group's
UNIX conformance test suite, and the maintenance cost is negligible.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	imp, allanjude, emaste
Differential Revision:	https://reviews.freebsd.org/D44135
2024-02-28 16:37:44 +01:00
Dag-Erling Smørgrav 96da41b6db lorder: Add unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44134
2024-02-28 16:37:41 +01:00
Dag-Erling Smørgrav 5c7b986c21 lorder: Clean up and improve robustness.
* Properly parse (no) command-line options.

* Ensure that errors go to stderr and result in a non-zero exit.

* Drop the special-case code for a single argument, as it will produce
  the wrong outcome if the file does not exist or is corrupted.

* Don't print anything until after we've collected all the data.

* Always create all temporary files before setting the trap.  This
  ensures that the trap can safely fire at any moment, regardless of any
  previous definition of `T`.

* Use a temporary file rather than a pipe between `nm` and `sed` to
  ensure proper termination if `nm` fails due to a missing or invalid
  input.

* The check for self-referential entries was conditional on testing our
  argument list against a regex looking for archives.  This was a
  needless and unreliable optimization; make the check unconditional.

* Document that lorder will not work properly if any of its inputs have
  spaces in their name.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D44133
2024-02-28 16:37:36 +01:00
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by:		Netflix
2023-11-26 22:23:30 -07:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Ed Maste 68a930d8ee lorder: add deprecation notice
lorder has not been used by the base system since 0e1e341b48 and
hasn't really been necessary for a very long time.

PR:		259254 [exp-run]
Reviewed by:	arichardson (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30080
2023-03-21 10:20:42 -04:00
Ed Maste 3e01ee76f2 lorder: add note that it is no longer required
Use of lorder(1) is not required by contemporary linkers.

The GNU coreutils manual[1] has a good description of the use of lorder
and tsort:

    This whole procedure has been obsolete since about 1980, because
    Unix archives now contain a symbol table (traditionally built by
    ranlib, now generally built by ar itself), and the Unix linker uses
    the symbol table to effectively make multiple passes over an archive
    file.

See 0e1e341b48 for some more details.

[1] https://www.gnu.org/software/coreutils/manual/html_node/tsort-background.html

PR:		259254 [exp-run]
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-12-20 12:59:01 -05:00
Ed Maste e1d6d6f924 lorder: process read-only data symbols
Previously they were skipped.  lorder(1) serves no functional purpose
today but we might as well address this longstanding bug while it is
still in the tree.

PR:		133860
MFC after:	1 week
Submitted by:	John Hein
2021-10-18 17:21:17 -04:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Ed Maste 932d4e19e6 lorder: produce locale-independent symbol ordering
Found by the Debian reproducible builds effort -- Debian bug 830259.

Reported by:	Reiner Herrmann <reiner@reiner-h.de>
Approved by:	re (gjb)
Sponsored by:	The FreeBSD Foundation
2016-07-07 20:50:59 +00:00
Rui Paulo 25ec8c921c Introduce a new make variable: NMFLAGS.
As the name indicates, these are flags to pass to nm(1).  The newer
binutils have a plugin mechanism so, to build something with LLVM's
LTO, we need to pass flags to nm(1).  This commit also extends
lorder(1) to pass NMFLAGS to nm(1).
2015-08-14 22:54:52 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Ruslan Ermilov ec140c9bcf Document the NM environment variable. 2006-10-25 09:40:07 +00:00
Ruslan Ermilov cb29445a92 Markup fixes. 2006-09-29 15:20:48 +00:00
Warner Losh 830de116de ru@ recently changed lorder to support library archives. Document
this new feature prominently.  Bump date while I'm here.
2006-04-27 15:48:54 +00:00
Ruslan Ermilov 7fc550064a Oops, revert last commit (the manpage is still built in objdir). 2005-09-28 07:54:18 +00:00
Ruslan Ermilov ec2cc32689 Add NO_OBJ. 2005-09-28 07:49:30 +00:00
Ruslan Ermilov e46be7ffad Fix loder(1) to work with libraries. This can be useful to
sort long DPADD lists automatically.  While here, recognize
`W' as the global symbol.  This has been tested since 2004.
2005-07-15 15:21:12 +00:00
Ruslan Ermilov 557b7fa148 Deal with double whitespace. 2004-07-03 00:24:45 +00:00
Tim J. Robbins ebe5d44d5a Give the -o option before any filename operands when invoking the sort
utility. 1003.1-2001 does not allow sort to accept the -o option after
the operands (Base Definitions, 12.2 Utility Syntax Guidelines,
Guideline 9).
2003-06-01 22:37:38 +00:00
Andrey A. Chernov 197442ec02 Make it work with POSIX sort (POS arg)
All old sorts understand -k too.
2002-09-24 18:16:36 +00:00
Philippe Charnier e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
Ruslan Ermilov b9ad8c8635 beforeinstall -> SCRIPTS. 2001-04-07 11:21:35 +00:00
Ruslan Ermilov dc12be5258 MAN[1-9] -> MAN. 2001-03-27 10:52:19 +00:00
Doug Rabson 7172dc3b54 Pick up the environment variable ${NM} if it exists and use that to list
symbols. This allows lorder to be used more easily in a cross-build
environment.
2001-03-06 15:00:32 +00:00
Tim Vanderhoek b75cda591f Use different filenames.
Submitted by:   bin/16927, Mike Heffner
2000-05-17 22:46:47 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton 3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
John Birrell 559628a153 Removed explict PATH which tended to cause the *wrong* path to be used
more often than not.

Also included Doug Rabson's changes to make this script better handle the
two varieties of nm output we now have.
1998-08-15 07:10:21 +00:00
Philippe Charnier 176d344d18 Typo. 1997-07-23 06:48:01 +00:00
Poul-Henning Kamp f2eff4c0ab typo.
Submitted by:	"Philippe Charnier" <charnier@lirmm.fr>
1996-06-10 15:55:48 +00:00
Bruce Evans 6eee579315 Change install' to ${INSTALL}' as usual.
Remove the extra slash in ${DESTDIR}/${BINDIR}.
1995-07-25 00:22:50 +00:00
Paul Traina 179ead2d5b lorder(1) manual page not properly installed due to makefile usurping
install rule.
1994-10-27 19:23:30 +00:00
Garrett Wollman b35bdc400c More merry makefile munging for man page compatability. 1994-08-05 19:00:04 +00:00
Rodney W. Grimes 9f23196c42 Cleanup so that make install can run, many install: maninstall changed
to just install:, sperious targets and CLEANFILES removed.
1994-05-30 14:17:23 +00:00
Rodney W. Grimes 662764bce8 Remove unneeded targets for manual page. Remove unneeded cleanfiles. 1994-05-29 16:35:09 +00:00
Rodney W. Grimes 9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00