[all-commits] [llvm/llvm-project] ae8b2c: [Driver] Support default libc++ library location o...

Petr Hosek via All-commits all-commits at lists.llvm.org
Tue Apr 20 12:31:01 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae8b2cab67408a043a4fe964d16e4803553c4ee0
      https://github.com/llvm/llvm-project/commit/ae8b2cab67408a043a4fe964d16e4803553c4ee0
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-04-20 (Tue, 20 Apr 2021)

  Changed paths:
    M clang/lib/Driver/ToolChains/Darwin.cpp
    M clang/test/Driver/darwin-ld.c

  Log Message:
  -----------
  [Driver] Support default libc++ library location on Darwin

Darwin driver currently uses libc++ headers that are part of Clang
toolchain when available (by default ../include/c++/v1 relative to
executable), but it completely ignores the libc++ library itself
because it doesn't pass the location of libc++ library that's part
of Clang (by default ../lib relative to the exceutable) to the linker
always using the system copy of libc++.

This may lead to subtle issues when the compilation fails because the
headers that are part of Clang toolchain are incompatible with the
system library. Either the driver should ignore both headers as well as
the library, or it should always try to use both when available.

This patch changes the driver behavior to do the latter which seems more
reasonable, it makes it easy to test and use custom libc++ build on
Darwin while still allowing the use of system version. This also matches
the Clang driver behavior on other systems.

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




More information about the All-commits mailing list