// Enable -mconstructor-aliases except on darwin, where we have to work around
// a linker bug (see <rdar://problem/7651567>), and CUDA device code, where
- // aliases aren't supported.
- if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX())
+ // aliases aren't supported. Similarly, aliases aren't yet supported for AIX.
+ if (!RawTriple.isOSDarwin() && !RawTriple.isNVPTX() && !RawTriple.isOSAIX())
CmdArgs.push_back("-mconstructor-aliases");
// Darwin's kernel doesn't support guard variables; just die if we
--- /dev/null
+// Check that we don't pass -mconstructor-aliases when compiling for AIX.
+
+// RUN: %clang -### -target powerpc-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN: | FileCheck %s
+// RUN: %clang -### -target powerpc64-ibm-aix7.1.0.0 %s -c -o %t.o 2>&1 \
+// RUN: | FileCheck %s
+// CHECK-NOT: "-mconstructor-aliases"
StringRef getPassName() const override { return "AIX PPC Assembly Printer"; }
+ bool doInitialization(Module &M) override {
+ if (M.alias_size() > 0u)
+ report_fatal_error(
+ "module has aliases, which LLVM does not yet support for AIX");
+
+ return PPCAsmPrinter::doInitialization(M);
+ }
+
void SetupMachineFunction(MachineFunction &MF) override;
void emitGlobalVariable(const GlobalVariable *GV) override;
--- /dev/null
+; RUN: not --crash llc < %s -mtriple powerpc-ibm-aix-xcoff 2>&1 | FileCheck %s
+; RUN: not --crash llc < %s -mtriple powerpc64-ibm-aix-xcoff 2>&1 | FileCheck %s
+
+; Check that, while generation of aliases on AIX remains unimplemented, llc dies
+; with an appropriate message instead of generating incorrect output when an
+; alias is encountered.
+
+define i32 @a() { ret i32 0 }
+; CHECK: ERROR: module has aliases
+@b = internal alias i32 (), i32 ()* @a