Skip to content

Commit 42748a4

Browse files
[Clang driver] Diagnose -maix-shared-lib-tls-model-opt on wrong targets (#130865)
1 parent f34385d commit 42748a4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

clang/lib/Driver/ToolChains/Arch/PPC.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
7272
D.Diag(diag::err_drv_argument_only_allowed_with)
7373
<< "-maix-small-local-[exec|dynamic]-tls" << "-fdata-sections";
7474
}
75+
76+
if (Args.hasArg(options::OPT_maix_shared_lib_tls_model_opt) &&
77+
!(Triple.isOSAIX() && Triple.isArch64Bit()))
78+
D.Diag(diag::err_opt_not_valid_on_target)
79+
<< "-maix-shared-lib-tls-model-opt";
7580
}
7681

7782
ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple,

clang/test/Driver/aix-shared-lib-tls-model-opt.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
// RUN: %clang -target powerpc64-unknown-aix -maix-shared-lib-tls-model-opt -S -emit-llvm \
77
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK-AIX,CHECK-AIX-ON
88

9-
// FIXME: Clang driver diagnostic not implemented.
10-
// RUN: true || not %clang -target powerpc-unknown-aix -maix-shared-lib-tls-model-opt \
9+
// RUN: not %clang -target powerpc-unknown-aix -maix-shared-lib-tls-model-opt \
1110
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
12-
// RUN: true || not %clang -target powerpc64le-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
11+
// RUN: not %clang -target powerpc64le-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
1312
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
14-
// RUN: true || not %clang -target powerpc64-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
13+
// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
1514
// RUN: -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
1615

1716
int test(void) {

0 commit comments

Comments
 (0)