llvm-project/clang/test/Driver/aix-object-mode.c
David Tenty 25ec96d91a [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting
Summary:
AIX uses an environment variable called OBJECT_MODE to indicate to
utilities in the toolchain whether they should be operating in 32-bit or
64-bit mode. This patch makes the clang driver recognize the current
OBJECT_MODE setting when we are operating with an AIX target and adds a
custom diagnostic for invalid settings.

For more details about OBJECT_MODE on AIX see:

https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/tusetenv1.html
https://www.ibm.com/support/knowledgecenter/SSGH2K_13.1.3/com.ibm.xlc1313.aix.doc/compiler_ref/opt_3264.html

Reviewers: stevewan, hubert.reinterpretcast, ShuhongL, jasonliu

Reviewed By: hubert.reinterpretcast, jasonliu

Subscribers: jasonliu, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82476
2020-07-09 15:15:30 -04:00

23 lines
940 B
C

// Check that setting an OBJECT_MODE converts the AIX triple to the right variant.
// RUN: env OBJECT_MODE=64 \
// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK64 %s
// RUN: env OBJECT_MODE=32 \
// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK32 %s
// Command-line options win.
// RUN: env OBJECT_MODE=64 \
// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck -check-prefix=CHECK32 %s
// RUN: env OBJECT_MODE=32 \
// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck -check-prefix=CHECK64 %s
// CHECK32: powerpc-ibm-aix
// CHECK64: powerpc64-ibm-aix
// Emit a diagnostic if there is an invalid mode.
// RUN: env OBJECT_MODE=31 \
// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG %s
// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid setting.