[all-commits] [llvm/llvm-project] 5e28c8: [Driver] Correctly handle static C++ standard library

Petr Hosek via All-commits all-commits at lists.llvm.org
Thu Sep 23 01:00:28 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5e28c892d06f95600f8b6290ad4de38bfe142637
      https://github.com/llvm/llvm-project/commit/5e28c892d06f95600f8b6290ad4de38bfe142637
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-09-23 (Thu, 23 Sep 2021)

  Changed paths:
    M clang/lib/Driver/ToolChains/Fuchsia.cpp
    M clang/lib/Driver/ToolChains/Gnu.cpp
    M clang/test/Driver/fuchsia.cpp
    M clang/test/Driver/linux-ld.c

  Log Message:
  -----------
  [Driver] Correctly handle static C++ standard library

When statically linking C++ standard library, we shouldn't add -Bdynamic
after including the library on the link line because that might override
user settings like -static and -static-pie. Rather, we should surround
the library with --push-state/--pop-state to make sure that -Bstatic
only applies to C++ standard library and nothing else. This has been
supported since GNU ld 2.25 (2014) so backwards compatibility should
no longer be a concern.

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




More information about the All-commits mailing list