Skip to content

[Clang driver] Diagnose -maix-shared-lib-tls-model-opt on wrong targets #130865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

hubert-reinterpretcast
Copy link
Collaborator

No description provided.

@hubert-reinterpretcast hubert-reinterpretcast added clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' platform:aix labels Mar 11, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:PowerPC labels Mar 11, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 11, 2025

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: Hubert Tong (hubert-reinterpretcast)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/130865.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Arch/PPC.cpp (+5)
  • (modified) clang/test/Driver/aix-shared-lib-tls-model-opt.c (+3-4)
diff --git a/clang/lib/Driver/ToolChains/Arch/PPC.cpp b/clang/lib/Driver/ToolChains/Arch/PPC.cpp
index 57baa186a9eb7..f0ced406fca86 100644
--- a/clang/lib/Driver/ToolChains/Arch/PPC.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -72,6 +72,11 @@ void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
       D.Diag(diag::err_drv_argument_only_allowed_with)
           << "-maix-small-local-[exec|dynamic]-tls" << "-fdata-sections";
   }
+
+  if (Args.hasArg(options::OPT_maix_shared_lib_tls_model_opt) &&
+      !(Triple.isOSAIX() && Triple.isArch64Bit()))
+    D.Diag(diag::err_opt_not_valid_on_target)
+        << "-maix-shared-lib-tls-model-opt";
 }
 
 ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple,
diff --git a/clang/test/Driver/aix-shared-lib-tls-model-opt.c b/clang/test/Driver/aix-shared-lib-tls-model-opt.c
index e610bb6d15d9d..7acf091f0a049 100644
--- a/clang/test/Driver/aix-shared-lib-tls-model-opt.c
+++ b/clang/test/Driver/aix-shared-lib-tls-model-opt.c
@@ -6,12 +6,11 @@
 // RUN: %clang -target powerpc64-unknown-aix -maix-shared-lib-tls-model-opt -S -emit-llvm \
 // RUN:    %s -o - | FileCheck %s --check-prefixes=CHECK-AIX,CHECK-AIX-ON
 
-// FIXME: Clang driver diagnostic not implemented.
-// RUN: true || not %clang -target powerpc-unknown-aix -maix-shared-lib-tls-model-opt \
+// RUN: not %clang -target powerpc-unknown-aix -maix-shared-lib-tls-model-opt \
 // RUN:    -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
-// RUN: true || not %clang -target powerpc64le-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
 // RUN:    -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
-// RUN: true || not %clang -target powerpc64-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
+// RUN: not %clang -target powerpc64-unknown-linux-gnu -maix-shared-lib-tls-model-opt \
 // RUN:    -fsyntax-only %s 2>&1 | FileCheck --check-prefix=CHECK-UNSUPPORTED-TARGET %s
 
 int test(void) {

Copy link
Member

@daltenty daltenty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from users/hubert-reinterpretcast/powerpc-aix-specific-target-features-clang-cleanup to main March 13, 2025 22:13
@hubert-reinterpretcast hubert-reinterpretcast force-pushed the users/hubert-reinterpretcast/clang-driver-target-diag-maix-shared-lib-tls-model-opt branch from 64f6ce9 to 45827d5 Compare March 13, 2025 22:17
@hubert-reinterpretcast hubert-reinterpretcast merged commit 42748a4 into main Mar 14, 2025
11 checks passed
@hubert-reinterpretcast hubert-reinterpretcast deleted the users/hubert-reinterpretcast/clang-driver-target-diag-maix-shared-lib-tls-model-opt branch March 14, 2025 04:58
frederik-h pushed a commit to frederik-h/llvm-project that referenced this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category platform:aix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants