[PATCH] D155408: [Driver] Also warn about -mwatchos-version-min and -mtvos-version-min
Cassie Jones via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 16 14:00:24 PDT 2023
porglezomp created this revision.
porglezomp added reviewers: arphaman, t.p.northover, MaskRay, ahatanak.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
porglezomp requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Sometimes users pass this option when targeting embedded architectures like armv7m on non-darwin platforms.
This applies to watchOS and tvOS as well as iOS.
Depends on D155407 <https://reviews.llvm.org/D155407>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155408
Files:
clang/lib/Driver/ToolChains/Darwin.cpp
clang/test/Driver/macho-embedded.c
Index: clang/test/Driver/macho-embedded.c
===================================================================
--- clang/test/Driver/macho-embedded.c
+++ clang/test/Driver/macho-embedded.c
@@ -8,12 +8,14 @@
// RUN: %clang -arch armv7m --target=thumbv7-apple-ios -mios-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
// RUN: %clang -arch armv7m --target=thumbv7-apple-ios -mios-version-min=5 -mios-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
+// RUN: %clang -arch armv7m --target=thumbv7-apple-watchos -mwatchos-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
+// RUN: %clang -arch armv7m --target=thumbv7-apple-tvos -mtvos-version-min=5 -fdriver-only -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-MACHO-EMBEDDED-DIAG
// CHECK-IOS: "-triple" "thumbv7" "thumbv7-apple-ios
// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"
-// CHECK-MACHO-EMBEDDED-DIAG: warning: argument unused during compilation: '-mios-version-min=5'
+// CHECK-MACHO-EMBEDDED-DIAG: warning: argument unused during compilation: '-m{{ios|watchos|tvos}}-version-min=5'
// CHECK-MACHO-EMBEDDED: "-triple" "{{thumbv[67]e?m}}-apple-unknown-macho"
// CHECK-MACHO-EMBEDDED: "-mrelocation-model" "pic"
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -85,10 +85,16 @@
if (ArchKind == llvm::ARM::ArchKind::ARMV6M ||
ArchKind == llvm::ARM::ArchKind::ARMV7M ||
ArchKind == llvm::ARM::ArchKind::ARMV7EM) {
- // Don't reject -mios-version-min= if we have an iOS triple.
+ // Don't reject these -version-min= if we have the appropriate triple.
if (T.isiOS())
for (Arg *A : Args.filtered(options::OPT_mios_version_min_EQ))
A->ignoreTargetSpecific();
+ if (T.isWatchOS())
+ for (Arg *A : Args.filtered(options::OPT_mwatchos_version_min_EQ))
+ A->ignoreTargetSpecific();
+ if (T.isTvOS())
+ for (Arg *A : Args.filtered(options::OPT_mtvos_version_min_EQ))
+ A->ignoreTargetSpecific();
T.setOS(llvm::Triple::UnknownOS);
T.setObjectFormat(llvm::Triple::MachO);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155408.540829.patch
Type: text/x-patch
Size: 2335 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230716/e0b6b4af/attachment.bin>
More information about the cfe-commits
mailing list