[PATCH] D153907: [AIX] [TOC] Add -mtocdata/-mno-tocdata options on AIX

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 11:53:59 PDT 2023


hubert.reinterpretcast added inline comments.


================
Comment at: clang/test/Driver/tocdata-mcmodel-large-warning.c:1-8
+// REQUIRES: powerpc-registered-target
+// RUN: %clang -S --target=powerpc-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// CHECK32: warning: ignoring '-mtocdata' with -mcmodel-large
+
+// RUN: %clang -S --target=powerpc64-ibm-aix-xcoff -mcmodel=large -mtocdata %s 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
----------------
Use `-###` for driver test to:
1. Avoid invocation of further components.
2. Observe the `-cc1` options being passed.

Aside from this driver test for the warning, this patch does not seem to have driver tests for validating that the option is passed to `-cc1` if and only if it should be. The missing tests should be added.



================
Comment at: include/clang/Basic/DiagnosticDriverKinds.td:555
+def warn_drv_unsupported_tocdata: Warning<
+  "ignoring '-mtocdata' with -mcmodel-large">, InGroup<OptionIgnored>;
 def warn_drv_unsupported_sdata : Warning<
----------------
Typo fix.


================
Comment at: lib/Driver/ToolChains/Clang.cpp:7122-7124
+    if (TocDataInEffect
+        && Args.getLastArgValue(options::OPT_mcmodel_EQ).equals("large"))
+      D.Diag(diag::warn_drv_unsupported_tocdata);
----------------
When emitting this message, the option should truly be ignored (e.g., driver should not pass the option to `-cc1`). Also, `-mcmodel=medium` is mapped by the driver to `-mcmodel=large` for AIX targets. The warning (and corresponding tests) should be extended to cover that.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153907/new/

https://reviews.llvm.org/D153907



More information about the llvm-commits mailing list