Skip to content

Commit 6b89c65

Browse files
committed
[𝘀𝗽𝗿] initial version
Created using spr 1.3.6-beta.1
1 parent f0e1857 commit 6b89c65

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

clang/lib/Driver/ToolChains/FreeBSD.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,12 +452,12 @@ void FreeBSD::addLibCxxIncludePaths(const llvm::opt::ArgList &DriverArgs,
452452

453453
void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
454454
ArgStringList &CmdArgs) const {
455+
Generic_ELF::AddCXXStdlibLibArgs(Args, CmdArgs);
455456
unsigned Major = getTriple().getOSMajorVersion();
456-
bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
457-
458-
CmdArgs.push_back(Profiling ? "-lc++_p" : "-lc++");
459-
if (Args.hasArg(options::OPT_fexperimental_library))
460-
CmdArgs.push_back("-lc++experimental");
457+
bool SuffixedLib = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
458+
if (SuffixedLib && GetCXXStdlibType(Args) == CST_Libcxx)
459+
llvm::replace(CmdArgs, static_cast<const char *>("-lc++"),
460+
static_cast<const char *>("-lc++_p"));
461461
}
462462

463463
void FreeBSD::AddCudaIncludeArgs(const ArgList &DriverArgs,

clang/test/Driver/experimental-library-flag.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
// RUN: %clangxx -fexperimental-library -stdlib=libstdc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBSTDCXX %s
1010
// RUN: %clangxx -fexperimental-library -stdlib=libc++ -nostdlib++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-NOSTDLIB %s
1111

12+
/// The FreeBSD driver did not support -stdlib=libstdc++ previously, check that it does the right thing here.
13+
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBCXX %s
14+
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libstdc++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-LIBSTDCXX %s
15+
// RUN: %clangxx --target=x86_64-unknown-freebsd -fexperimental-library -stdlib=libc++ -nostdlib++ -### %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK-NOSTDLIB %s
16+
1217
// -fexperimental-library must be passed to CC1.
1318
// CHECK: -fexperimental-library
1419

clang/test/Driver/freebsd.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
22
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
33
// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \
4-
// RUN: | FileCheck --check-prefix=CHECK-TEN %s
4+
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
5+
// RUN: %clangxx %s -### -o %t.o --target=amdf64-unknown-freebsd -stdlib=libc++ 2>&1 \
6+
// RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s
7+
// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd -stdlib=libstdc++ 2>&1 \
8+
// RUN: | FileCheck --check-prefix=CHECK-STDLIBCXX %s
59
// CHECK-DEFAULT: "-lc++" "-lm"
6-
// CHECK-TEN: "-lc++" "-lm"
10+
// CHECK-STDLIBCXX: "-lstdc++" "-lm"
711

812
// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \
913
// RUN: | FileCheck --check-prefix=CHECK-PG-DEFAULT %s

0 commit comments

Comments
 (0)