[FreeBSD] Support -stdlib=libstdc++
The experimental-library-flag.cpp test was failing on FreeBSD builders, which turned to be caused by missing support for -stdlib=libcstdc++ (and just using a hardcoded libc++ in all cases). Simplify FreeBSD::AddCXXStdlibLibArgs() by deferring to the parent class and dealing with the FreeSBD < 14 profiling support as a special case. While touching the test file also drop the unnecessary `-o %t.o`. This is not needed since the RUN lines use -### and don't produce any output. Reviewed By: DimitryAndric, MaskRay Pull Request: https://github.com/llvm/llvm-project/pull/126302
This commit is contained in:
committed by
GitHub
parent
b4f91b007f
commit
f75126eeab
@@ -452,12 +452,12 @@ void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
|
||||
|
||||
void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
|
||||
ArgStringList &CmdArgs) const {
|
||||
Generic_ELF::AddCXXStdlibLibArgs(Args, CmdArgs);
|
||||
unsigned Major = getTriple().getOSMajorVersion();
|
||||
bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
|
||||
|
||||
CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
|
||||
if (Args.hasArg(options::OPT_fexperimental_library))
|
||||
CmdArgs.push_back("-lc++experimental");
|
||||
bool SuffixedLib = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
|
||||
if (SuffixedLib && GetCXXStdlibType(Args) == CST_Libcxx)
|
||||
llvm::replace(CmdArgs, static_cast<const char *>("-lc++"),
|
||||
static_cast<const char *>("-lc++_p"));
|
||||
}
|
||||
|
||||
void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
// RUN: %clangxx -fexperimental-library -stdlib=libstdc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBSTDCXX %s
|
||||
// RUN: %clangxx -fexperimental-library -stdlib=libc++ -nostdlib++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-NOSTDLIB %s
|
||||
|
||||
/// The FreeBSD driver did not support -stdlib=libstdc++ previously, check that it does the right thing here.
|
||||
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBCXX %s
|
||||
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libstdc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBSTDCXX %s
|
||||
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libc++ -nostdlib++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-NOSTDLIB %s
|
||||
|
||||
// -fexperimental-library must be passed to CC1.
|
||||
// CHECK: -fexperimental-library
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
|
||||
// RUN: %clangxx %s -### --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
|
||||
// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-TEN %s
|
||||
// RUN: %clangxx %s -### --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
|
||||
// RUN: %clangxx %s -### --target=amd64-unknown-freebsd -stdlib=libc++ 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
|
||||
// RUN: %clangxx %s -### --target=amd64-unknown-freebsd -stdlib=libstdc++ 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-STDLIBCXX %s
|
||||
// CHECK-DEFAULT: "-lc++" "-lm"
|
||||
// CHECK-TEN: "-lc++" "-lm"
|
||||
// CHECK-STDLIBCXX: "-lstdc++" "-lm"
|
||||
|
||||
// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
|
||||
// RUN: %clangxx %s -### -pg --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-PG-DEFAULT %s
|
||||
// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd14.0 -stdlib=platform 2>&1 \
|
||||
// RUN: %clangxx %s -### -pg --target=amd64-unknown-freebsd14.0 -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-PG-FOURTEEN %s
|
||||
// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
|
||||
// RUN: %clangxx %s -### -pg --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
|
||||
// RUN: | FileCheck --check-prefix=CHECK-PG-TEN %s
|
||||
// CHECK-PG-DEFAULT: "-lc++" "-lm"
|
||||
// CHECK-PG-FOURTEEN: "-lc++" "-lm"
|
||||
|
||||
Reference in New Issue
Block a user