[Driver] Default to contemporary FreeBSD profiling behaviour

Prior to FreeBSD 14, FreeBSD provided special _p.a libraries for use
with -pg.  They are no longer used or provided.  If the target does
not specify a major version (e.g. amd64-unknown-freebsd, rather than
amd64-unknown-freebsd12) default to the new behaviour.

Differential Revision:	https://reviews.llvm.org/D114396
This commit is contained in:
Ed Maste 2021-11-22 16:56:35 -05:00
parent 46bbd254c1
commit b41bb6c1b7
2 changed files with 5 additions and 5 deletions

View File

@ -293,8 +293,8 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
addLinkerCompressDebugSectionsOption(ToolChain, Args, CmdArgs);
AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
bool Profiling = Args.hasArg(options::OPT_pg) &&
ToolChain.getTriple().getOSMajorVersion() < 14;
unsigned Major = ToolChain.getTriple().getOSMajorVersion();
bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
// Use the static OpenMP runtime with -static-openmp
bool StaticOpenMP = Args.hasArg(options::OPT_static_openmp) &&
@ -419,8 +419,8 @@ void FreeBSD::addLibStdCxxIncludePaths(
void FreeBSD::AddCXXStdlibLibArgs(const ArgList &Args,
ArgStringList &CmdArgs) const {
CXXStdlibType Type = GetCXXStdlibType(Args);
bool Profiling =
Args.hasArg(options::OPT_pg) && getTriple().getOSMajorVersion() < 14;
unsigned Major = getTriple().getOSMajorVersion();
bool Profiling = Args.hasArg(options::OPT_pg) && Major != 0 && Major < 14;
switch (Type) {
case ToolChain::CST_Libcxx:

View File

@ -16,7 +16,7 @@
// RUN: | FileCheck --check-prefix=CHECK-PG-TEN %s
// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd9.2 -stdlib=platform 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PG-NINE %s
// CHECK-PG-DEFAULT: "-lc++_p" "-lm_p"
// CHECK-PG-DEFAULT: "-lc++" "-lm"
// CHECK-PG-FOURTEEN: "-lc++" "-lm"
// CHECK-PG-TEN: "-lc++_p" "-lm_p"
// CHECK-PG-NINE: "-lstdc++_p" "-lm_p"