[PATCH] D114396: [Driver] Default to current FreeBSD profiling behaviour
Ed Maste via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 22 14:02:23 PST 2021
emaste created this revision.
emaste added a reviewer: dim.
Herald added subscribers: krytarowski, arichardson.
emaste requested review of this revision.
FreeBSD provided special _p.a libraries for use with -pg prior to FreeBSD 14. 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) use the new behaviour.
https://reviews.llvm.org/D114396
Files:
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/test/Driver/freebsd.cpp
Index: clang/test/Driver/freebsd.cpp
===================================================================
--- clang/test/Driver/freebsd.cpp
+++ clang/test/Driver/freebsd.cpp
@@ -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"
Index: clang/lib/Driver/ToolChains/FreeBSD.cpp
===================================================================
--- clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -293,8 +293,8 @@
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::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:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114396.389037.patch
Type: text/x-patch
Size: 1866 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211122/71637691/attachment-0001.bin>
More information about the cfe-commits
mailing list