[all-commits] [llvm/llvm-project] 4c12a7: [llvm-libtool-darwin] Add -warnings_as_errors

Keith Smiley via All-commits all-commits at lists.llvm.org
Mon Feb 7 14:40:45 PST 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c12a75e69927c40b992d568187504b2ee268e92
  Author: Keith Smiley <keithbsmiley at gmail.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M llvm/docs/CommandGuide/llvm-libtool-darwin.rst
    M llvm/test/tools/llvm-libtool-darwin/create-static-lib.test
    M llvm/test/tools/llvm-libtool-darwin/no-symbols-warning.test
    M llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp

  Log Message:
  [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:
And it avoids this bug:

Differential Revision: https://reviews.llvm.org/D118931

More information about the All-commits mailing list