forked from OSchip/llvm-project
Revert "[Driver] Correctly handle static C++ standard library"
This reverts commit 5e28c892d0
as
the linker on the clang-ppc64le-rhel bot doesn't seem to support
--push-state/--pop-state.
This commit is contained in:
parent
5e28c892d0
commit
904ca7d2ed
|
@ -138,13 +138,14 @@ void fuchsia::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
|
bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
|
||||||
!Args.hasArg(options::OPT_static);
|
!Args.hasArg(options::OPT_static);
|
||||||
CmdArgs.push_back("--push-state");
|
CmdArgs.push_back("--push-state");
|
||||||
|
CmdArgs.push_back("--as-needed");
|
||||||
if (OnlyLibstdcxxStatic)
|
if (OnlyLibstdcxxStatic)
|
||||||
CmdArgs.push_back("-Bstatic");
|
CmdArgs.push_back("-Bstatic");
|
||||||
else
|
|
||||||
CmdArgs.push_back("--as-needed");
|
|
||||||
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
|
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||||
CmdArgs.push_back("--pop-state");
|
if (OnlyLibstdcxxStatic)
|
||||||
|
CmdArgs.push_back("-Bdynamic");
|
||||||
CmdArgs.push_back("-lm");
|
CmdArgs.push_back("-lm");
|
||||||
|
CmdArgs.push_back("--pop-state");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -577,11 +577,11 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
|
||||||
if (ToolChain.ShouldLinkCXXStdlib(Args)) {
|
if (ToolChain.ShouldLinkCXXStdlib(Args)) {
|
||||||
bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
|
bool OnlyLibstdcxxStatic = Args.hasArg(options::OPT_static_libstdcxx) &&
|
||||||
!Args.hasArg(options::OPT_static);
|
!Args.hasArg(options::OPT_static);
|
||||||
CmdArgs.push_back("--push-state");
|
|
||||||
if (OnlyLibstdcxxStatic)
|
if (OnlyLibstdcxxStatic)
|
||||||
CmdArgs.push_back("-Bstatic");
|
CmdArgs.push_back("-Bstatic");
|
||||||
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
|
ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||||
CmdArgs.push_back("--pop-state");
|
if (OnlyLibstdcxxStatic)
|
||||||
|
CmdArgs.push_back("-Bdynamic");
|
||||||
}
|
}
|
||||||
CmdArgs.push_back("-lm");
|
CmdArgs.push_back("-lm");
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
// CHECK: "--push-state"
|
// CHECK: "--push-state"
|
||||||
// CHECK: "--as-needed"
|
// CHECK: "--as-needed"
|
||||||
// CHECK: "-lc++"
|
// CHECK: "-lc++"
|
||||||
// CHECK: "--pop-state"
|
|
||||||
// CHECK: "-lm"
|
// CHECK: "-lm"
|
||||||
|
// CHECK: "--pop-state"
|
||||||
// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
// CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
||||||
// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
// CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
||||||
// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
// CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
|
||||||
|
@ -55,10 +55,12 @@
|
||||||
// RUN: -fuse-ld=lld 2>&1 \
|
// RUN: -fuse-ld=lld 2>&1 \
|
||||||
// RUN: | FileCheck %s -check-prefix=CHECK-STATIC
|
// RUN: | FileCheck %s -check-prefix=CHECK-STATIC
|
||||||
// CHECK-STATIC: "--push-state"
|
// CHECK-STATIC: "--push-state"
|
||||||
|
// CHECK-STATIC: "--as-needed"
|
||||||
// CHECK-STATIC: "-Bstatic"
|
// CHECK-STATIC: "-Bstatic"
|
||||||
// CHECK-STATIC: "-lc++"
|
// CHECK-STATIC: "-lc++"
|
||||||
// CHECK-STATIC: "--pop-state"
|
// CHECK-STATIC: "-Bdynamic"
|
||||||
// CHECK-STATIC: "-lm"
|
// CHECK-STATIC: "-lm"
|
||||||
|
// CHECK-STATIC: "--pop-state"
|
||||||
// CHECK-STATIC: "-lc"
|
// CHECK-STATIC: "-lc"
|
||||||
|
|
||||||
// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ -fuse-ld=lld 2>&1 \
|
// RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -nostdlib++ -fuse-ld=lld 2>&1 \
|
||||||
|
|
|
@ -496,24 +496,6 @@
|
||||||
// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
|
||||||
// CHECK-GCC-VERSION1: "{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
|
// CHECK-GCC-VERSION1: "{{.*}}/Inputs/basic_linux_tree/usr/lib/gcc/i386-unknown-linux/10.2.0{{/|\\\\}}crtbegin.o"
|
||||||
|
|
||||||
// RUN: %clangxx -x c++ %s -### 2>&1 \
|
|
||||||
// RUN: --target=x86_64-unknown-linux-gnu \
|
|
||||||
// RUN: -stdlib=libc++ \
|
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SHARED %s
|
|
||||||
// CHECK-BASIC-LIBCXX-SHARED: "--push-state"
|
|
||||||
// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lc++"
|
|
||||||
// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "--pop-state"
|
|
||||||
// CHECK-BASIC-LIBCXX-SHARED-SAME: {{^}} "-lm"
|
|
||||||
// RUN: %clangxx -x c++ %s -### 2>&1 \
|
|
||||||
// RUN: --target=x86_64-unknown-linux-gnu \
|
|
||||||
// RUN: -stdlib=libc++ -static-libstdc++ \
|
|
||||||
// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-STATIC %s
|
|
||||||
// CHECK-BASIC-LIBCXX-STATIC: "--push-state"
|
|
||||||
// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-Bstatic"
|
|
||||||
// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lc++"
|
|
||||||
// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "--pop-state"
|
|
||||||
// CHECK-BASIC-LIBCXX-STATIC-SAME: {{^}} "-lm"
|
|
||||||
|
|
||||||
// Test a simulated installation of libc++ on Linux, both through sysroot and
|
// Test a simulated installation of libc++ on Linux, both through sysroot and
|
||||||
// the installation path of Clang.
|
// the installation path of Clang.
|
||||||
// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
|
// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
|
||||||
|
|
Loading…
Reference in New Issue