[all-commits] [llvm/llvm-project] 6551ac: [Driver] Make -static-libgcc imply static libunwind

Josh Kunz via All-commits all-commits at lists.llvm.org
Fri Nov 22 15:33:57 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6551ac7489fe070a2edcfac88f68c93321cba9a9
      https://github.com/llvm/llvm-project/commit/6551ac7489fe070a2edcfac88f68c93321cba9a9
  Author: Josh Kunz <jkz at google.com>
  Date:   2019-11-22 (Fri, 22 Nov 2019)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/Driver/compiler-rt-unwind.c

  Log Message:
  -----------
  [Driver] Make -static-libgcc imply static libunwind

In the GNU toolchain, `-static-libgcc` implies that the unwindlib will
be linked statically. However, when `--unwindlib=libunwind`, this flag is
ignored, and a bare `-lunwind` is added to the linker args.  Unfortunately,
this means that if both `libunwind.so`, and `libunwind.a` are present
in the library path, `libunwind.so` will be chosen in all cases where
`-static` is not set.

This change makes `-static-libgcc` affect the `-l` flag produced by
`--unwindlib=libunwind`. After this patch, providing
`-static-libgcc --unwindlib=libunwind` will cause the driver to explicitly
emit `-l:libunwind.a` to statically link libunwind. For all other cases
it will emit `-l:libunwind.so` matching current behavior with a more
explicit link line.

https://reviews.llvm.org/D70416




More information about the All-commits mailing list