[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
      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:
https://github.com/llvm/llvm-project/blob/30baa5d2a450d5e302d8cba3fc7a26a59d4b7ae1/llvm/lib/Object/ArchiveWriter.cpp#L424-L465
And it avoids this bug:
https://github.com/keith/radars/tree/f0cbbb1c37126ec6528c132510b29e08566377a7/DuplicateBasenameIssue

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




More information about the All-commits mailing list