llvm-project/llvm/docs/CommandGuide/llvm-libtool-darwin.rst
Keith Smiley 4c12a75e69 [llvm-libtool-darwin] Add -warnings_as_errors
libtool can currently produce 2 warnings:

1. No symbols were in the object file
2. An object file with the same basename was specified multiple times

The first warning here is often harmless and may just mean you have some
translation units with no symbols for the target you're building for.
The second warning can lead to real issues like those mentioned in
https://reviews.llvm.org/D113130 where ODR violations can slip in.

This introduces a new -warnings_as_errors flag that can be used by build
systems that want to verify they never hit these warnings. For example
with bazel the libtool caller first uniques names to make sure the
duplicate base name case is not possible, but if that doesn't work as
expected, having it fail would be preferred.

It's also worth noting that llvm-libtool-darwin works around an issue
that cctools libtool experiences related to debug info and duplicate
basenames, the workaround is described here:
30baa5d2a4/llvm/lib/Object/ArchiveWriter.cpp (L424-L465)
And it avoids this bug:
f0cbbb1c37/DuplicateBasenameIssue

Differential Revision: https://reviews.llvm.org/D118931
2022-02-07 14:39:21 -08:00

110 lines
2.8 KiB
ReStructuredText

llvm-libtool-darwin - LLVM tool for creating libraries for Darwin
=================================================================
.. program:: llvm-libtool-darwin
SYNOPSIS
--------
:program:`llvm-libtool-darwin` [*options*] *<input files>*
DESCRIPTION
-----------
:program:`llvm-libtool-darwin` is a tool for creating static and dynamic
libraries for Darwin.
For most scenarios, it works as a drop-in replacement for cctools'
:program:`libtool`.
OPTIONS
--------
:program:`llvm-libtool-darwin` supports the following options:
.. option:: -arch_only <architecture>
Build a static library only for the specified `<architecture>` and ignore all
other architectures in the files.
.. option:: -color
Use colors in output.
.. option:: -D
Use zero for timestamps and UIDs/GIDs. This is set by default.
.. option:: -filelist <listfile[,dirname]>
Read input file names from `<listfile>`. File names are specified in `<listfile>`
one per line, separated only by newlines. Whitespace on a line is assumed
to be part of the filename. If the directory name, `dirname`, is also
specified then it is prepended to each file name in the `<listfile>`.
.. option:: -h, -help
Show help and usage for this command.
.. option:: -help-list
Show help and usage for this command without grouping the options
into categories.
.. option:: -l <x>
Searches for the library libx.a in the library search path. If the string `<x>`
ends with '.o', then the library 'x' is searched for without prepending 'lib'
or appending '.a'. If the library is found, it is added to the list of input
files. Otherwise, an error is raised.
.. option:: -L <dir>
Adds `<dir>` to the list of directories in which to search for libraries. The
directories are searched in the order in which they are specified with
:option:`-L` and before the default search path. The default search path
includes directories `/lib`, `/usr/lib` and `/usr/local/lib`.
.. option:: -no_warning_for_no_symbols
Do not warn about files that have no symbols.
.. option:: -warnings_as_errors
Produce a non-zero exit status if any warnings are emitted.
.. option:: -o <filename>
Specify the output file name. Must be specified exactly once.
.. option:: -static
Produces a static library from the input files.
.. option:: -U
Use actual timestamps and UIDs/GIDs.
.. option:: -V
Display the version of this program and perform any operation specified.
.. option:: -version
Display the version of this program and exit immediately.
EXIT STATUS
-----------
:program:`llvm-libtool-darwin` exits with a non-zero exit code if there is an error.
Otherwise, it exits with code 0.
BUGS
----
To report bugs, please visit <https://github.com/llvm/llvm-project/issues/>.
SEE ALSO
--------
:manpage:`llvm-ar(1)`