[clang] [clang][AIX] Fix -print-runtime-dir on AIX (PR #104806)

2024-08-30 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/104806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][AIX] Fix -print-runtime-dir on AIX (PR #104806)

2024-08-19 Thread David Tenty via cfe-commits

daltenty wrote:

I think you should add a test similar to this one: 
https://github.com/llvm/llvm-project/blob/main/clang/test/Driver/darwin-print-runtime-dir.c

https://github.com/llvm/llvm-project/pull/104806
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][AIX] Fix the wrong traceback from signal handler (PR #101069)

2024-07-29 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/101069
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][AIX] Fix the wrong traceback from signal handler (PR #101069)

2024-07-29 Thread David Tenty via cfe-commits

https://github.com/daltenty milestoned 
https://github.com/llvm/llvm-project/pull/101069
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind] fix unwinding from signal handler (PR #92291)

2024-07-26 Thread David Tenty via cfe-commits

daltenty wrote:

This is breaking a number of tests for the UBSAN on AIX, the traceback produced 
by the runtime are no longer correct.

Before this change:
```
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==52887862==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 
0x (pc 0x1784 bp 0x2ff22020 sp 0x2ff22020 T59639729)
==52887862==The signal is caused by a UNKNOWN memory access.
==52887862==Hint: address points to the zero page.
#0 0x1784 in .void Xyz::Abc() 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
#1 0x173c in .bar 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:25
#2 0x17cc in .FOO() 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:29
#3 0x1834 in .main 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:33
#4 0x12d0 in .__start 
(/home/daltenty/llvm/dev/build/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/ubsan-powerpc-AIX/Posix/Output/dedup_token_length_test.cpp.tmp+0x12d0)

DEDUP_TOKEN: .void Xyz::Abc()--.bar
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
 in .void Xyz::Abc()
==52887862==ABORTING
```

After:
```
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==1704572==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 
0x (pc 0x1784 bp 0x2ff221b0 sp 0x2ff221b0 T56035233)
==1704572==The signal is caused by a UNKNOWN memory access.
==1704572==Hint: address points to the zero page.
#0 0x1784 in .void Xyz::Abc() 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
#1 0x1001d764 in .ubsan_GetStackTrace(__sanitizer::BufferedStackTrace*, 
unsigned int, unsigned int, unsigned int, void*, bool) 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/ubsan/ubsan_diag.cpp:41
#2 0x10025ca4 in .__ubsan::OnStackUnwind(__sanitizer::SignalContext const&, 
void const*, __sanitizer::BufferedStackTrace*) 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/ubsan/ubsan_signals_standalone.cpp:53
#3 0x1001cd10 in ReportDeadlySignalImpl 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:272
#4 0x1001cd10 in 
.__sanitizer::ReportDeadlySignal(__sanitizer::SignalContext const&, unsigned 
int, void (*)(__sanitizer::SignalContext const&, void const*, 
__sanitizer::BufferedStackTrace*), void const*) 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:286
#5 0x1001d2d4 in .__sanitizer::HandleDeadlySignal(void*, void*, unsigned 
int, void (*)(__sanitizer::SignalContext const&, void const*, 
__sanitizer::BufferedStackTrace*), void const*) 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp:295

DEDUP_TOKEN: .void Xyz::Abc()--.ubsan_GetStackTrace(__sanitizer::BufferedStackTrace*, unsigned int, 
unsigned int, unsigned int, void*, bool)
UndefinedBehaviorSanitizer can not provide additional info.
SUMMARY: UndefinedBehaviorSanitizer: SEGV 
/home/daltenty/llvm/dev/llvm-project/compiler-rt/test/sanitizer_common/TestCases/Posix/dedup_token_length_test.cpp:20
 in .void Xyz::Abc()
==1704572==ABORTING
```


https://github.com/llvm/llvm-project/pull/92291
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-23 Thread David Tenty via cfe-commits

daltenty wrote:

/cherry-pick 63b382b

https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-23 Thread David Tenty via cfe-commits

https://github.com/daltenty milestoned 
https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-23 Thread David Tenty via cfe-commits

daltenty wrote:

/cherry-pick 1df4d86

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-23 Thread David Tenty via cfe-commits

https://github.com/daltenty closed 
https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-23 Thread David Tenty via cfe-commits

https://github.com/daltenty closed 
https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-22 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-22 Thread David Tenty via cfe-commits

daltenty wrote:

> > Should there be a lit test for the linux part as well?
> 
> Is there a pre-existing test already, or should I add a new one? I can't seem 
> to find an equivalent to `clang/test/CodeGen/aix-builtin-cpu-is.c`

There's an existing `ppc64le` block in 
`clang/test/CodeGen/builtin-cpu-supports.c`, I think we should just add the 
missing cases for Power8+ there.

https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-22 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

Sorry for the delay, LGTM

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-22 Thread David Tenty via cfe-commits


@@ -124,6 +124,14 @@ enum PPCMachineCombinerPattern : unsigned {
 PPC::RESTORE_UACC, NoInstr, NoInstr, PPC::RESTORE_QUADWORD 
\
   }
 
+#define Pwr11LoadOpcodes   
\

daltenty wrote:

Ditto earlier comment: I don't think this needs to be copied out, we can simply 
use the P10 one

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-22 Thread David Tenty via cfe-commits


@@ -156,6 +164,14 @@ enum PPCMachineCombinerPattern : unsigned {
 NoInstr, NoInstr, PPC::SPILL_QUADWORD  
\
   }
 
+#define Pwr11StoreOpcodes  
\

daltenty wrote:

Ditto: remove copy

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-22 Thread David Tenty via cfe-commits


@@ -3485,9 +3485,11 @@ unsigned PPCInstrInfo::getSpillTarget() const {
   // With P10, we may need to spill paired vector registers or accumulator
   // registers. MMA implies paired vectors, so we can just check that.
   bool IsP10Variant = Subtarget.isISA3_1() || Subtarget.pairedVectorMemops();
-  return Subtarget.isISAFuture() ? 3 : IsP10Variant ?
-   2 : Subtarget.hasP9Vector() ?
-   1 : 0;
+  // P11 uses the P10 target.
+  return Subtarget.isISAFuture()   ? 4

daltenty wrote:

This doesn't quite make sense to me, we extended the length of the array but we 
don't cover all elements. We should probably just leave this as is and make 
sure `IsP10Variant` is true for pwr11. 

If I understand right, our additional lit run lines already added (e.g. 
[mma-acc-spill.ll](https://github.com/llvm/llvm-project/commit/37c4ac8545537077788d4e00be7473fe0e2113c3#diff-563c38a308e920559647a63033a141ada8b6e1332c51310ce5fbcc40df8121c3,
 etc.) should do that.

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-22 Thread David Tenty via cfe-commits


@@ -632,13 +632,33 @@
 // PPCPOWER10:#define __PCREL__ 1
 // PPCPOWER10-NOT:#define __ROP_PROTECT__ 1
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-cpu pwr11 -fno-signed-char < /dev/null | FileCheck -match-full-lines 
-check-prefix PPCPOWER11 %s
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none 
-target-cpu power11 -fno-signed-char < /dev/null | FileCheck -match-full-lines 
-check-prefix PPCPOWER11 %s
+//
+// PPCPOWER11:#define _ARCH_PPC 1
+// PPCPOWER11:#define _ARCH_PPC64 1
+// PPCPOWER11:#define _ARCH_PPCGR 1
+// PPCPOWER11:#define _ARCH_PPCSQ 1
+// PPCPOWER11:#define _ARCH_PWR10 1
+// PPCPOWER11:#define _ARCH_PWR11 1
+// PPCPOWER11:#define _ARCH_PWR4 1
+// PPCPOWER11:#define _ARCH_PWR5 1
+// PPCPOWER11:#define _ARCH_PWR5X 1
+// PPCPOWER11:#define _ARCH_PWR6 1
+// PPCPOWER11-NOT:#define _ARCH_PWR6X 1
+// PPCPOWER11:#define _ARCH_PWR7 1
+// PPCPOWER11:#define _ARCH_PWR8 1
+// PPCPOWER11:#define _ARCH_PWR9 1
+// PPCPOWER11-NOT:#define __ROP_PROTECT__ 1

daltenty wrote:

Should we not have the MMA and PCREL macros here too?

```suggestion
// PPCPOWER11:#define __MMA__ 1
// PPCPOWER11:#define __PCREL__ 1
// PPCPOWER11-NOT:#define __ROP_PROTECT__ 1
```

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-22 Thread David Tenty via cfe-commits


@@ -84,6 +85,7 @@
 #define AIX_PPC8_VALUE 0x0001
 #define AIX_PPC9_VALUE 0x0002
 #define AIX_PPC10_VALUE 0x0004
+#define AIX_PPC11_VALUE 0x0008

daltenty wrote:

We've discussed with the AIX OS team, and this is the value in their 
development builds

https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-22 Thread David Tenty via cfe-commits


@@ -103,6 +105,7 @@ PPC_CPU("ppc476",SYS_CALL,44,BUILTIN_PPC_FALSE,0)
 PPC_CPU("power8",SYS_CALL,45,USE_SYS_CONF,AIX_PPC8_VALUE)
 PPC_CPU("power9",SYS_CALL,46,USE_SYS_CONF,AIX_PPC9_VALUE)
 PPC_CPU("power10",SYS_CALL,47,USE_SYS_CONF,AIX_PPC10_VALUE)
+PPC_CPU("power11",SYS_CALL,48,USE_SYS_CONF,AIX_PPC11_VALUE)

daltenty wrote:

Note: we discussed this with the GCC folks, this is the unofficial value they 
are using as well.

https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-22 Thread David Tenty via cfe-commits

https://github.com/daltenty edited 
https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add builtin_cpu_is P11 support (PR #99550)

2024-07-22 Thread David Tenty via cfe-commits

https://github.com/daltenty commented:

Should there be a lit test for the linux part as well?

https://github.com/llvm/llvm-project/pull/99550
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] Add support for -mcpu=pwr11 / -mtune=pwr11 (PR #99511)

2024-07-19 Thread David Tenty via cfe-commits


@@ -0,0 +1,122 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; ; This test is a copy of mma-acc-spill.ll except that it uses mcpu=pwr11.
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \
+; RUN:   -mcpu=pwr11 -ppc-asm-full-reg-names -disable-auto-paired-vec-st=false 
\

daltenty wrote:

I don't quite follow why this test got versioned. If I understand correctly, 
the codegen should be identical (at least for now), so I think we should just 
add the extra run lines to the existing test if anything.

https://github.com/llvm/llvm-project/pull/99511
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -1963,8 +1964,11 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
   const llvm::Triple &T = getToolChain().getTriple();
   if (Args.getLastArg(options::OPT_mtune_EQ)) {
 CmdArgs.push_back("-tune-cpu");
-std::string CPU = ppc::getPPCTuneCPU(Args, T);
-CmdArgs.push_back(Args.MakeArgString(CPU));
+StringRef CPU = "";
+if (Arg *A = Args.getLastArg(clang::driver::options::OPT_mtune_EQ))

daltenty wrote:

nit: You can get just do this assignment in the outer if condition, to avoid 
calling `Args.getLastArg` twice with the exact same arguments. Then just check 
the result here:
```suggestion
if (A)
```

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -1,52 +1,60 @@
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc970\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc970\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc-cell-be\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc-cell-be\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppca2\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppca2\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc405\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc405\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc440\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc440\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc464\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc464\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"ppc476\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"ppc476\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power4\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power4\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power5\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power5\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power5+\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power5+\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power6\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power6\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power6x\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power6x\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power7\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"power7\");}" > %t.c
 // RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s -DVALUE=32768 \
 // RUN:   --check-prefix=CHECKOP
 
-// RUN: echo "int main() { return __builtin_cpu_is(\"power8\");}" > %t.c 
+// RUN: echo "int main() { return __builtin_cpu_is(\"pwr7\");}" > %t.c
+// RUN: %clang_cc1 -triple powerpc-ibm-aix7.2.0.0 -emit-llvm -o - %t.c | 
FileCheck %s -DVALUE=32768 \
+// RUN:   --check-prefix=CHECKOP
+
+// RUN: echo "int main() { return __builtin_cpu_is(\"power8\");}" > %t.c

daltenty wrote:

nit: why no `pwr8` and `pwr9` cases?

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -85,8 +85,59 @@
 #define AIX_PPC9_VALUE 0x0002
 #define AIX_PPC10_VALUE 0x0004
 
-// __builtin_cpu_is() and __builtin_cpu_supports() are supported only on 
Power7 and up on AIX.
 // PPC_CPU(Name, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID)
+
+// Valid CPUs not supported by __builtin_cpu_is()
+PPC_CPU("generic",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("440",SYS_CALL,42,BUILTIN_PPC_FALSE,0)

daltenty wrote:

nit: I feel like we should be adding new test cases for these linux cases we 
support now, but I also can't find any test cases to cover the existing linux 
ones...

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -85,8 +85,59 @@
 #define AIX_PPC9_VALUE 0x0002
 #define AIX_PPC10_VALUE 0x0004
 
-// __builtin_cpu_is() and __builtin_cpu_supports() are supported only on 
Power7 and up on AIX.
 // PPC_CPU(Name, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD, AIXID)
+
+// Valid CPUs not supported by __builtin_cpu_is()
+PPC_CPU("generic",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("440",SYS_CALL,42,BUILTIN_PPC_FALSE,0)
+PPC_CPU("440fp",SYS_CALL,42,BUILTIN_PPC_FALSE,0)
+PPC_CPU("450",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("601",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("602",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("603",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("603e",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("603ev",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("604",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("604e",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("620",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("630",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("g3",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("7400",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("g4",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("7450",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("g4+",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("750",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("8548",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("970",SYS_CALL,33,BUILTIN_PPC_FALSE,0)
+PPC_CPU("g5",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("a2",SYS_CALL,40,BUILTIN_PPC_FALSE,0)
+PPC_CPU("e500",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("e500mc",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("e5500",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("power3",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr3",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr4",SYS_CALL,32,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr5",SYS_CALL,34,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr5+",SYS_CALL,35,BUILTIN_PPC_FALSE,0)
+PPC_CPU("power5x",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr5x",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr6",SYS_CALL,36,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr6x",SYS_CALL,38,BUILTIN_PPC_FALSE,0)
+PPC_CPU("pwr7",SYS_CALL,39,USE_SYS_CONF,AIX_PPC7_VALUE)
+PPC_CPU("pwr8",SYS_CALL,45,USE_SYS_CONF,AIX_PPC8_VALUE)
+PPC_CPU("pwr9",SYS_CALL,46,USE_SYS_CONF,AIX_PPC9_VALUE)
+PPC_CPU("pwr10",SYS_CALL,47,USE_SYS_CONF,AIX_PPC10_VALUE)
+PPC_CPU("powerpc",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("ppc",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("ppc32",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("powerpc64",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("ppc64",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("powerpc64le",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("ppc64le",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+PPC_CPU("future",BUILTIN_PPC_FALSE,0,BUILTIN_PPC_FALSE,0)
+
+// __builtin_cpu_is() and __builtin_cpu_supports() are supported only on 
Power7 and up on AIX.

daltenty wrote:

nit: I'm not sure the placement of this comment really makes sense after the 
change. You have added supported  for AIX aliases (i.e. pwr7)  above this 
comment, so it's not clear why we're grouping the comment to only the CPUs 
below. (Maybe best to leave the comment where it was, and not try to split this 
into two lists) 

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -1963,8 +1964,11 @@ void Clang::AddPPCTargetArgs(const ArgList &Args,
   const llvm::Triple &T = getToolChain().getTriple();
   if (Args.getLastArg(options::OPT_mtune_EQ)) {

daltenty wrote:

See below:
```suggestion
  if (Arg *A = Args.getLastArg(options::OPT_mtune_EQ)) {
```

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [llvm] [PowerPC] add TargetParser for PPC target (PR #97541)

2024-07-03 Thread David Tenty via cfe-commits


@@ -0,0 +1,120 @@
+//=== PPCTargetParser.cpp - Parser for target features --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements a target parser to recognise hardware features
+// for PPC CPUs.
+//
+//===--===//
+
+#include "llvm/TargetParser/PPCTargetParser.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/TargetParser/Host.h"
+
+namespace llvm {
+namespace PPC {
+
+struct CPUInfo {
+  StringLiteral Name;
+  // FIXME: add the features field for this CPU.
+};
+
+constexpr CPUInfo PPCCPUInfo[] = {
+#define PPC_CPU(Name, Linux_SUPPORT_METHOD, LinuxID, AIX_SUPPORT_METHOD,   
\
+AIXID) 
\
+  Name,
+#include "llvm/TargetParser/PPCTargetParser.def"
+};
+
+static const CPUInfo *getCPUInfoByName(StringRef CPU) {
+  for (auto &C : PPCCPUInfo)
+if (C.Name == CPU)
+  return &C;
+  return nullptr;
+}
+
+StringRef normalizeCPUName(StringRef CPUName) {
+  // Clang/LLVM does not actually support code generation
+  // for the 405 CPU. However, there are uses of this CPU ID
+  // in projects that previously used GCC and rely on Clang
+  // accepting it. Clang has always ignored it and passed the
+  // generic CPU ID to the back end.
+  return StringSwitch(CPUName)
+  .Cases("common", "405", "generic")
+  .Cases("ppc440", "440fp", "440")
+  .Cases("630", "power3", "pwr3")
+  .Case("G3", "g3")
+  .Case("G4", "g4")
+  .Case("G4+", "g4+")
+  .Case("8548", "e500")
+  .Case("ppc970", "970")
+  .Case("G5", "g5")
+  .Case("ppca2", "a2")
+  .Case("power4", "pwr4")
+  .Case("power5", "pwr5")
+  .Case("power5x", "pwr5x")
+  .Case("power5+", "pwr5+")
+  .Case("power6", "pwr6")
+  .Case("power6x", "pwr6x")
+  .Case("power7", "pwr7")
+  .Case("power8", "pwr8")
+  .Case("power9", "pwr9")
+  .Case("power10", "pwr10")
+  .Cases("powerpc", "powerpc32", "ppc")
+  .Case("powerpc64", "ppc64")
+  .Case("powerpc64le", "ppc64le")
+  .Default(CPUName);
+}
+
+void fillValidCPUList(SmallVectorImpl &Values) {
+  for (const auto &C : PPCCPUInfo)
+Values.emplace_back(C.Name);
+}
+
+void fillValidTuneCPUList(SmallVectorImpl &Values) {
+  for (const auto &C : PPCCPUInfo)
+Values.emplace_back(C.Name);
+}
+
+bool isValidCPU(StringRef CPU) {
+  const CPUInfo *Info = getCPUInfoByName(CPU);
+  if (!Info)
+return false;
+  return true;
+}
+
+StringRef getPPCGenericTargetCPU(const Triple &T, StringRef CPUName) {
+  if (!CPUName.empty()) {
+if (CPUName == "native") {
+  std::string CPU = std::string(sys::getHostCPUName());
+  if (!CPU.empty() && CPU != "generic")
+return CPU;
+}
+
+StringRef CPU = normalizeCPUName(CPUName);
+if (CPU != "generic")
+  return CPU;
+  }
+
+  // LLVM may default to generating code for the native CPU, but, like gcc, we
+  // default to a more generic option for each architecture. (except on AIX)
+  if (T.isOSAIX())
+return "pwr7";
+  else if (T.getArch() == Triple::ppc64le)
+return "ppc64le";
+  else if (T.getArch() == Triple::ppc64)
+return "ppc64";

daltenty wrote:

I'm not sure that the AIX changes should be part of this patch (to keep the 
scope of what's changing clear), but if it is, I'd suggest we key this to the 
minimum supported CPUs per OS level: 

```suggestion
  if (T.isOSAIX()) {
if (T.isOSVersionLT(7, 2))
  return "pwr4";
else if (T.isOSVersionLT(7, 3))
  return "pwr7";
else // AIX 7.3 and above
  return "pwr8";
  }
  else if (T.getArch() == Triple::ppc64le)
return "ppc64le";
  else if (T.getArch() == Triple::ppc64)
return "ppc64";
```

https://github.com/llvm/llvm-project/pull/97541
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][AIX] Cast NULL as type uintptr_t. (PR #93204)

2024-05-23 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM, assuming the CI passes

https://github.com/llvm/llvm-project/pull/93204
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] XFAIL clang/Driver/test/compress.c on AIX (PR #87269)

2024-04-18 Thread David Tenty via cfe-commits

https://github.com/daltenty closed 
https://github.com/llvm/llvm-project/pull/87269
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [clang][AIX] set OpenMP include path (PR #88545)

2024-04-17 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/88545
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] XFAIL clang/Driver/compress.c on AIX (PR #87269)

2024-04-01 Thread David Tenty via cfe-commits

https://github.com/daltenty edited 
https://github.com/llvm/llvm-project/pull/87269
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] XFAIL clang/Driver/compress.c on AIX (PR #87269)

2024-04-01 Thread David Tenty via cfe-commits


@@ -1,5 +1,9 @@
+// XFAIL: system-aix
+
 // REQUIRES: zlib
 
+; XFAIL: target={{.*}}-aix{{.*}}

daltenty wrote:

You should use the C++ comment format here:
```suggestion
// XFAIL: target={{.*}}-aix{{.*}}
```

https://github.com/llvm/llvm-project/pull/87269
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a85cbe8 - Disable autolink_private_module.m for z/OS & AIX

2024-01-09 Thread David Tenty via cfe-commits

Author: Zibi Sarbinowski
Date: 2024-01-09T10:33:45-05:00
New Revision: a85cbe8f9036c8771fbf61335eb288eaefcda365

URL: 
https://github.com/llvm/llvm-project/commit/a85cbe8f9036c8771fbf61335eb288eaefcda365
DIFF: 
https://github.com/llvm/llvm-project/commit/a85cbe8f9036c8771fbf61335eb288eaefcda365.diff

LOG: Disable autolink_private_module.m for z/OS & AIX

This change disables it on z/OS and AIX since it fails on both platforms with:
fatal error: error in backend: Objective-C support is unimplemented for object 
file format

Added: 


Modified: 
clang/test/Modules/autolink_private_module.m

Removed: 




diff  --git a/clang/test/Modules/autolink_private_module.m 
b/clang/test/Modules/autolink_private_module.m
index 54bebc3a587b1b..f83f0a26b5309a 100644
--- a/clang/test/Modules/autolink_private_module.m
+++ b/clang/test/Modules/autolink_private_module.m
@@ -1,4 +1,6 @@
 // Test that autolink hints for frameworks don't use the private module name.
+// UNSUPPORTED: target={{.*}}-zos{{.*}}, target={{.*}}-aix{{.*}}
+
 // RUN: rm -rf %t && mkdir %t
 // RUN: split-file %s %t
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [compiler-rt] [AIX] Undefine __STDC_NO_ATOMICS__ to enable c11 atomics functionality (PR #76025)

2023-12-20 Thread David Tenty via cfe-commits

https://github.com/daltenty requested changes to this pull request.

Last time I tested this functionality, we had some deadlocks if the standard 
library interfaces were used, which was part of the motivation for leaving this 
macro in.

It's possible the situation has changed since, but I'd like to confirm that 
first before we go ahead with removing the macro.

https://github.com/llvm/llvm-project/pull/76025
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] [libunwind][AIX] static_cast the value from getLR() to avoid the warning from -Wconversion (PR #69767)

2023-10-24 Thread David Tenty via cfe-commits

https://github.com/daltenty approved this pull request.

LGTM, thanks!

https://github.com/llvm/llvm-project/pull/69767
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX][clang][driver] fix no-pthread option (PR #69363)

2023-10-17 Thread David Tenty via cfe-commits

https://github.com/daltenty updated 
https://github.com/llvm/llvm-project/pull/69363

>From 560bf7329998e88d0ba12a2030b376d4a5aa173b Mon Sep 17 00:00:00 2001
From: David Tenty 
Date: Tue, 17 Oct 2023 11:53:55 -0400
Subject: [PATCH 1/2] [AIX][clang][driver] fix no-pthread option

We don't properly check the boolean pthread option in the AIX toolchain, so we 
don't
respect the no- form of the option.
---
 clang/lib/Driver/ToolChains/AIX.cpp |  3 ++-
 clang/test/Driver/aix-ld.c  | 27 +++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 3e5ebafa15ebe1c..257c0e19a5c0093 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -303,7 +303,8 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   }
 
   // Support POSIX threads if "-pthreads" or "-pthread" is present.
-  if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
+  if (Args.hasArg(options::OPT_pthreads) ||
+  Args.hasFlag(options::OPT_pthread, options::OPT_no_pthread, false))
 CmdArgs.push_back("-lpthreads");
 
   if (D.CCCIsCXX())
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7e0f2bf91e06ee5..579d028b9a7a8de 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -109,6 +109,33 @@
 // CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Disable POSIX thread support.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:-pthread -no-pthread\
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOPTHREAD %s
+// CHECK-LD32-NOPTHREAD-NOT: warning:
+// CHECK-LD32-NOPTHREAD: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOPTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-LD32-NOPTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOPTHREAD: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOPTHREAD-NOT: "-bnso"
+// CHECK-LD32-NOPTHREAD: "-b32"
+// CHECK-LD32-NOPTHREAD: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOPTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOPTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
+// CHECK-LD32-NOPTHREAD-NOT: "-lc++"
+// CHECK-LD32-NOPTHREAD-NOT: "-lc++abi"
+// CHECK-LD32-NOPTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOPTHREAD-NOT: "--as-needed"
+// CHECK-LD32-NOPTHREAD: "-lunwind"
+// CHECK-LD32-NOPTHREAD-NOT: "--no-as-needed"
+// CHECK-LD32-NOPTHREAD-NOT: "-lm"
+// CHECK-LD32-NOPTHREAD: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
 // RUN: %clang %s -### 2>&1 \
 // RUN:-resource-dir=%S/Inputs/resource_dir \

>From 2a02aa2fb1f82a9814361d04d6d3083a54bb7dbc Mon Sep 17 00:00:00 2001
From: David Tenty 
Date: Tue, 17 Oct 2023 14:35:16 -0400
Subject: [PATCH 2/2] Explicitly check NOT lpthread

---
 clang/test/Driver/aix-ld.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 579d028b9a7a8de..d61c2ab146a84a5 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -133,6 +133,7 @@
 // CHECK-LD32-NOPTHREAD-NOT: "--as-needed"
 // CHECK-LD32-NOPTHREAD: "-lunwind"
 // CHECK-LD32-NOPTHREAD-NOT: "--no-as-needed"
+// CHECK-LD32-NOPTHREAD-NOT: "-lpthreads"
 // CHECK-LD32-NOPTHREAD-NOT: "-lm"
 // CHECK-LD32-NOPTHREAD: "-lc"
 

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [AIX][clang][driver] fix no-pthread option (PR #69363)

2023-10-17 Thread David Tenty via cfe-commits

https://github.com/daltenty created 
https://github.com/llvm/llvm-project/pull/69363

We don't properly check the boolean pthread option in the AIX toolchain, so we 
don't respect the no- form of the option.

>From 560bf7329998e88d0ba12a2030b376d4a5aa173b Mon Sep 17 00:00:00 2001
From: David Tenty 
Date: Tue, 17 Oct 2023 11:53:55 -0400
Subject: [PATCH] [AIX][clang][driver] fix no-pthread option

We don't properly check the boolean pthread option in the AIX toolchain, so we 
don't
respect the no- form of the option.
---
 clang/lib/Driver/ToolChains/AIX.cpp |  3 ++-
 clang/test/Driver/aix-ld.c  | 27 +++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 3e5ebafa15ebe1c..257c0e19a5c0093 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -303,7 +303,8 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   }
 
   // Support POSIX threads if "-pthreads" or "-pthread" is present.
-  if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
+  if (Args.hasArg(options::OPT_pthreads) ||
+  Args.hasFlag(options::OPT_pthread, options::OPT_no_pthread, false))
 CmdArgs.push_back("-lpthreads");
 
   if (D.CCCIsCXX())
diff --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7e0f2bf91e06ee5..579d028b9a7a8de 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -109,6 +109,33 @@
 // CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Disable POSIX thread support.
+// RUN: %clang %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:-pthread -no-pthread\
+// RUN:--target=powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:--unwindlib=libunwind \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOPTHREAD %s
+// CHECK-LD32-NOPTHREAD-NOT: warning:
+// CHECK-LD32-NOPTHREAD: "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOPTHREAD: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-LD32-NOPTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOPTHREAD: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOPTHREAD-NOT: "-bnso"
+// CHECK-LD32-NOPTHREAD: "-b32"
+// CHECK-LD32-NOPTHREAD: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOPTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOPTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
+// CHECK-LD32-NOPTHREAD-NOT: "-lc++"
+// CHECK-LD32-NOPTHREAD-NOT: "-lc++abi"
+// CHECK-LD32-NOPTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOPTHREAD-NOT: "--as-needed"
+// CHECK-LD32-NOPTHREAD: "-lunwind"
+// CHECK-LD32-NOPTHREAD-NOT: "--no-as-needed"
+// CHECK-LD32-NOPTHREAD-NOT: "-lm"
+// CHECK-LD32-NOPTHREAD: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
 // RUN: %clang %s -### 2>&1 \
 // RUN:-resource-dir=%S/Inputs/resource_dir \

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] cf08c10 - [NFC][clang] add extra member-alignment testcase

2023-07-05 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2023-07-05T16:44:05-04:00
New Revision: cf08c103266b7ee59cbc2352c4d20f27472cb257

URL: 
https://github.com/llvm/llvm-project/commit/cf08c103266b7ee59cbc2352c4d20f27472cb257
DIFF: 
https://github.com/llvm/llvm-project/commit/cf08c103266b7ee59cbc2352c4d20f27472cb257.diff

LOG: [NFC][clang] add extra member-alignment testcase

for when an alignment attribute is used. This will be useful for D147184 to 
demonstrate what changes.

Added: 


Modified: 
clang/test/CodeGenCXX/member-alignment.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/member-alignment.cpp 
b/clang/test/CodeGenCXX/member-alignment.cpp
index ff6bb442b8470d..72f992ffe8f980 100644
--- a/clang/test/CodeGenCXX/member-alignment.cpp
+++ b/clang/test/CodeGenCXX/member-alignment.cpp
@@ -11,8 +11,19 @@ class t {
 public:
   virtual void foo(void);
   void bar(void);
+  void baz(void);
 };
 
+// The original alignment is observed if >=2, regardless of any extra alignment
+// of member functions.
+[[gnu::aligned(16)]]
+void
+t::baz(void) {
+// CHECK-NOEXTRAALIGN: @_ZN1t3bazEv({{.*}}) #0 align 16 {
+// CHECK-EXTRAALIGN: @_ZN1t3bazEv({{.*}}) #0 align 16 {
+// CHECK-MSVC: @"?baz@t@@QEAAXXZ"({{.*}}) #0 align 16 {
+}
+
 void
 t::bar(void) {
 // CHECK-ITANIUM: @_ZN1t3barEv({{.*}}) #0 align 2 {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8d2e9fc - [PowerPC] Add function pointer alignment to DataLayout

2023-04-18 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2023-04-18T13:00:27-04:00
New Revision: 8d2e9fc8553c91b1f22e82ffc2c00020f40bb0a2

URL: 
https://github.com/llvm/llvm-project/commit/8d2e9fc8553c91b1f22e82ffc2c00020f40bb0a2
DIFF: 
https://github.com/llvm/llvm-project/commit/8d2e9fc8553c91b1f22e82ffc2c00020f40bb0a2.diff

LOG: [PowerPC] Add function pointer alignment to DataLayout

The alignment of function pointers was added to the Datalayout by
D57335 but currently is unset for the Power target. This will cause us
to compute a conservative minimum alignment of one if places like
Value::getPointerAlignment.

This patch implements the function pointer alignment in the Datalayout
for the Power backend and Power targets in clang, so we can query the
value for a particular Power target.

We come up with the correct value one of two ways:

- If the target uses function descriptor objects (i.e. ELFv1 & AIX ABIs),
  then a function pointer points to the descriptor, so use the alignment
  we would emit the descriptor with.
- If the target doesn't use function descriptor objects (i.e. ELFv2), a
  function pointer points to the global entry point, so use the minimum
  alignment for code on Power (i.e. 4-bytes).

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D147016

Added: 


Modified: 
clang/lib/Basic/Targets/OSTargets.h
clang/lib/Basic/Targets/PPC.h
clang/test/CodeGen/target-data.c
llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
llvm/test/CodeGen/PowerPC/pr45301.ll
llvm/test/ThinLTO/X86/builtin-nostrip-aix.ll

Removed: 




diff  --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index ea21f7eafaba1..cb2a68f27edaa 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -519,7 +519,7 @@ class LLVM_LIBRARY_VISIBILITY PS3PPUTargetInfo : public 
OSTargetInfo {
 this->IntMaxType = TargetInfo::SignedLongLong;
 this->Int64Type = TargetInfo::SignedLongLong;
 this->SizeType = TargetInfo::UnsignedInt;
-this->resetDataLayout("E-m:e-p:32:32-i64:64-n32:64");
+this->resetDataLayout("E-m:e-p:32:32-Fi64-i64:64-n32:64");
   }
 };
 

diff  --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index 07a8a3aefca7f..8564fc0346406 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -363,11 +363,11 @@ class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public 
PPCTargetInfo {
   PPC32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : PPCTargetInfo(Triple, Opts) {
 if (Triple.isOSAIX())
-  resetDataLayout("E-m:a-p:32:32-i64:64-n32");
+  resetDataLayout("E-m:a-p:32:32-Fi32-i64:64-n32");
 else if (Triple.getArch() == llvm::Triple::ppcle)
-  resetDataLayout("e-m:e-p:32:32-i64:64-n32");
+  resetDataLayout("e-m:e-p:32:32-Fn32-i64:64-n32");
 else
-  resetDataLayout("E-m:e-p:32:32-i64:64-n32");
+  resetDataLayout("E-m:e-p:32:32-Fn32-i64:64-n32");
 
 switch (getTriple().getOS()) {
 case llvm::Triple::Linux:
@@ -418,19 +418,23 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public 
PPCTargetInfo {
 
 if (Triple.isOSAIX()) {
   // TODO: Set appropriate ABI for AIX platform.
-  DataLayout = "E-m:a-i64:64-n32:64";
+  DataLayout = "E-m:a-Fi64-i64:64-n32:64";
   LongDoubleWidth = 64;
   LongDoubleAlign = DoubleAlign = 32;
   LongDoubleFormat = &llvm::APFloat::IEEEdouble();
 } else if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-  DataLayout = "e-m:e-i64:64-n32:64";
+  DataLayout = "e-m:e-Fn32-i64:64-n32:64";
   ABI = "elfv2";
 } else {
-  DataLayout = "E-m:e-i64:64-n32:64";
-  if (Triple.isPPC64ELFv2ABI())
+  DataLayout = "E-m:e";
+  if (Triple.isPPC64ELFv2ABI()) {
 ABI = "elfv2";
-  else
+DataLayout += "-Fn32";
+  } else {
 ABI = "elfv1";
+DataLayout += "-Fi64";
+  }
+  DataLayout += "-i64:64-n32:64";
 }
 
 if (Triple.isOSFreeBSD() || Triple.isOSOpenBSD() || Triple.isMusl()) {

diff  --git a/clang/test/CodeGen/target-data.c 
b/clang/test/CodeGen/target-data.c
index e5ee17bc38a7f..a7650c88df201 100644
--- a/clang/test/CodeGen/target-data.c
+++ b/clang/test/CodeGen/target-data.c
@@ -88,7 +88,7 @@
 
 // RUN: %clang_cc1 -triple powerpc64-lv2 -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PS3
-// PS3: target datalayout = "E-m:e-p:32:32-i64:64-n32:64"
+// PS3: target datalayout = "E-m:e-p:32:32-Fi64-i64:64-n32:64"
 
 // RUN: %clang_cc1 -triple i686-nacl -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=I686-NACL
@@ -120,43 +120,43 @@
 
 // RUN: %clang_cc1 -triple powerpc-unknown -o - -emit-llvm %s | \
 // RUN: FileCheck %s -check-prefix=PPC
-// PPC: target datalayout = "E-m:e-p:32:32-i64:64-n32"
+// PPC: target datalayout = "E-m:e-p:32:32-Fn32-i64:64-n32"
 
 // RUN: %clang_cc1 -triple powerpcle-unknown -o - 

[clang] 2fe49ea - [clang][PowerPC] Remove remaining Darwin support

2023-03-28 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2023-03-28T17:12:49-04:00
New Revision: 2fe49ea0d07d503aedd0872bf0a66724552d4dcf

URL: 
https://github.com/llvm/llvm-project/commit/2fe49ea0d07d503aedd0872bf0a66724552d4dcf
DIFF: 
https://github.com/llvm/llvm-project/commit/2fe49ea0d07d503aedd0872bf0a66724552d4dcf.diff

LOG: [clang][PowerPC] Remove remaining Darwin support

POWER Darwin support in the backend has been removed for some time: 
https://discourse.llvm.org/t/rfc-remove-darwin-support-from-power-backends
but Clang still has the TargetInfo and other remnants lying around.

This patch does some cleanup and removes those and other related frontend 
support still remaining. We adjust any tests using the triple to either remove
the test if unneeded or switch to another Power triple.

Reviewed By: MaskRay, nemanjai

Differential Revision: https://reviews.llvm.org/D146459

Added: 


Modified: 
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/PPC.cpp
clang/lib/Basic/Targets/PPC.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Driver/ToolChains/Darwin.cpp
clang/lib/Sema/SemaAttr.cpp
clang/test/Driver/default-toolchain.c
clang/test/Parser/altivec.c
clang/test/Parser/cxx-altivec.cpp
clang/test/Preprocessor/init-ppc.c
clang/test/Sema/altivec-init.c
clang/test/SemaCXX/cxx-altivec.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 7e687c119c1c4..b8932b1d56a20 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -347,8 +347,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
 return new Le64TargetInfo(Triple, Opts);
 
   case llvm::Triple::ppc:
-if (Triple.isOSDarwin())
-  return new DarwinPPC32TargetInfo(Triple, Opts);
 switch (os) {
 case llvm::Triple::Linux:
   return new LinuxTargetInfo(Triple, Opts);
@@ -377,8 +375,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple,
 }
 
   case llvm::Triple::ppc64:
-if (Triple.isOSDarwin())
-  return new DarwinPPC64TargetInfo(Triple, Opts);
 switch (os) {
 case llvm::Triple::Linux:
   return new LinuxTargetInfo(Triple, Opts);

diff  --git a/clang/lib/Basic/Targets/PPC.cpp b/clang/lib/Basic/Targets/PPC.cpp
index d46b1c55cf818..b27561729dfc4 100644
--- a/clang/lib/Basic/Targets/PPC.cpp
+++ b/clang/lib/Basic/Targets/PPC.cpp
@@ -336,9 +336,8 @@ void PPCTargetInfo::getTargetDefines(const LangOptions 
&Opts,
 Builder.defineMacro("__LONGDOUBLE64");
   }
 
-  // Define this for elfv2 (64-bit only) or 64-bit darwin.
-  if (ABI == "elfv2" ||
-  (getTriple().getOS() == llvm::Triple::Darwin && PointerWidth == 64))
+  // Define this for elfv2 (64-bit only).
+  if (ABI == "elfv2")
 Builder.defineMacro("__STRUCT_PARM_ALIGN__", "16");
 
   if (ArchDefs & ArchDefineName)

diff  --git a/clang/lib/Basic/Targets/PPC.h b/clang/lib/Basic/Targets/PPC.h
index 27fef6a2d5d47..07a8a3aefca7f 100644
--- a/clang/lib/Basic/Targets/PPC.h
+++ b/clang/lib/Basic/Targets/PPC.h
@@ -400,7 +400,7 @@ class LLVM_LIBRARY_VISIBILITY PPC32TargetInfo : public 
PPCTargetInfo {
   }
 
   BuiltinVaListKind getBuiltinVaListKind() const override {
-// This is the ELF definition, and is overridden by the Darwin sub-target
+// This is the ELF definition
 return TargetInfo::PowerABIBuiltinVaList;
   }
 };
@@ -481,33 +481,6 @@ class LLVM_LIBRARY_VISIBILITY PPC64TargetInfo : public 
PPCTargetInfo {
   }
 };
 
-class LLVM_LIBRARY_VISIBILITY DarwinPPC32TargetInfo
-: public DarwinTargetInfo {
-public:
-  DarwinPPC32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : DarwinTargetInfo(Triple, Opts) {
-HasAlignMac68kSupport = true;
-BoolWidth = BoolAlign = 32; // XXX support -mone-byte-bool?
-PtrDiffType = SignedInt; // for http://llvm.org/bugs/show_bug.cgi?id=15726
-LongLongAlign = 32;
-resetDataLayout("E-m:o-p:32:32-f64:32:64-n32", "_");
-  }
-
-  BuiltinVaListKind getBuiltinVaListKind() const override {
-return TargetInfo::CharPtrBuiltinVaList;
-  }
-};
-
-class LLVM_LIBRARY_VISIBILITY DarwinPPC64TargetInfo
-: public DarwinTargetInfo {
-public:
-  DarwinPPC64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
-  : DarwinTargetInfo(Triple, Opts) {
-HasAlignMac68kSupport = true;
-resetDataLayout("E-m:o-i64:64-n32:64", "_");
-  }
-};
-
 class LLVM_LIBRARY_VISIBILITY AIXPPC32TargetInfo :
   public AIXTargetInfo {
 public:

diff  --git a/clang/lib/CodeGen/TargetInfo.cpp 
b/clang/lib/CodeGen/TargetInfo.cpp
index dd838c3746000..e8761879b7f05 100644
--- a/clang/lib/CodeGen/TargetInfo.cpp
+++ b/clang/lib/CodeGen/TargetInfo.cpp
@@ -467,7 +467,7 @@ unsigned TargetCodeGenInfo::getSizeOfUnwindException() 
const {
   // Verified for:
   //   x86-64 FreeBSD, Linux, Darwin
   //   x86-32 FreeBSD, Linux, Darwin
-  //   PowerPCLinux, Darwin
+  //   PowerPCLinux
   //   ARMDarwi

[clang] 9a733e8 - [clang][driver] accept maix32/maix64 gcc compat options

2023-03-13 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2023-03-13T17:05:52-04:00
New Revision: 9a733e8a2c58957591e4dc0a02f9cfa6a06603de

URL: 
https://github.com/llvm/llvm-project/commit/9a733e8a2c58957591e4dc0a02f9cfa6a06603de
DIFF: 
https://github.com/llvm/llvm-project/commit/9a733e8a2c58957591e4dc0a02f9cfa6a06603de.diff

LOG: [clang][driver] accept maix32/maix64 gcc compat options

GCC on AIX primarily uses the -maix32 and -maix64 to select the bitmode
to target. In order to be compatible with existing build configurations,
clang should accept these options as well. In this patch we implement
these options for AIX targets.

Differential Revision: https://reviews.llvm.org/D145610

Added: 
clang/test/Driver/aix-maix.c

Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 5c49450914a65..a2dbef1cc7cfe 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3416,10 +3416,12 @@ def mbig_endian : Flag<["-"], "mbig-endian">, 
Flags<[NoXarchOption]>;
 def EB : Flag<["-"], "EB">, Alias;
 def m16 : Flag<["-"], "m16">, Group, Flags<[NoXarchOption, 
CoreOption]>;
 def m32 : Flag<["-"], "m32">, Group, Flags<[NoXarchOption, 
CoreOption]>;
+def maix32 : Flag<["-"], "maix32">, Group, Flags<[NoXarchOption]>;
 def mqdsp6_compat : Flag<["-"], "mqdsp6-compat">, Group, 
Flags<[NoXarchOption,CC1Option]>,
   HelpText<"Enable hexagon-qdsp6 backward compatibility">,
   MarshallingInfoFlag>;
 def m64 : Flag<["-"], "m64">, Group, Flags<[NoXarchOption, 
CoreOption]>;
+def maix64 : Flag<["-"], "maix64">, Group, Flags<[NoXarchOption]>;
 def mx32 : Flag<["-"], "mx32">, Group, Flags<[NoXarchOption, 
CoreOption]>;
 def mabi_EQ : Joined<["-"], "mabi=">, Group;
 def miamcu : Flag<["-"], "miamcu">, Group, Flags<[NoXarchOption, 
CoreOption]>,

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 0f5f35c14a7d0..b991a1822812c 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -594,13 +594,21 @@ static llvm::Triple computeTargetTriple(const Driver &D,
 }
   }
 
+  // The `-maix[32|64]` flags are only valid for AIX targets.
+  if (Arg *A = Args.getLastArgNoClaim(options::OPT_maix32, 
options::OPT_maix64);
+  A && !Target.isOSAIX())
+D.Diag(diag::err_drv_unsupported_opt_for_target)
+<< A->getAsString(Args) << Target.str();
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
-   options::OPT_m32, options::OPT_m16);
+   options::OPT_m32, options::OPT_m16,
+   options::OPT_maix32, options::OPT_maix64);
   if (A) {
 llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
 
-if (A->getOption().matches(options::OPT_m64)) {
+if (A->getOption().matches(options::OPT_m64) ||
+A->getOption().matches(options::OPT_maix64)) {
   AT = Target.get64BitArchVariant().getArch();
   if (Target.getEnvironment() == llvm::Triple::GNUX32)
 Target.setEnvironment(llvm::Triple::GNU);
@@ -613,7 +621,8 @@ static llvm::Triple computeTargetTriple(const Driver &D,
 Target.setEnvironment(llvm::Triple::MuslX32);
   else
 Target.setEnvironment(llvm::Triple::GNUX32);
-} else if (A->getOption().matches(options::OPT_m32)) {
+} else if (A->getOption().matches(options::OPT_m32) ||
+   A->getOption().matches(options::OPT_maix32)) {
   AT = Target.get32BitArchVariant().getArch();
   if (Target.getEnvironment() == llvm::Triple::GNUX32)
 Target.setEnvironment(llvm::Triple::GNU);

diff  --git a/clang/test/Driver/aix-maix.c b/clang/test/Driver/aix-maix.c
new file mode 100644
index 0..2bdcea22dfbdb
--- /dev/null
+++ b/clang/test/Driver/aix-maix.c
@@ -0,0 +1,17 @@
+// Check GCC AIX bitmode compat options.
+
+// RUN: %clang -target powerpc-ibm-aix -maix64 -### -c %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK64 %s
+
+// RUN: %clang -target powerpc64-ibm-aix -maix32 -### -c %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=CHECK32 %s
+
+// RUN: %clang -target powerpc-unknown-linux -maix64 -### -c %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=ERROR %s
+
+// RUN: %clang -target powerpc64-unknown-linux -maix32 -### -c %s 2>&1 | \
+// RUN:   FileCheck --check-prefix=ERROR %s
+
+// CHECK32: Target: powerpc-ibm-aix
+// CHECK64: Target: powerpc64-ibm-aix
+// ERROR: error: unsupported option '-maix



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] c9aff5d - Revert "[libunwind] Use .irp directives. NFC"

2022-12-07 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-12-07T15:41:29-05:00
New Revision: c9aff5d2f9d93636009ae389824f3beacfcbc7b7

URL: 
https://github.com/llvm/llvm-project/commit/c9aff5d2f9d93636009ae389824f3beacfcbc7b7
DIFF: 
https://github.com/llvm/llvm-project/commit/c9aff5d2f9d93636009ae389824f3beacfcbc7b7.diff

LOG: Revert "[libunwind] Use .irp directives. NFC"

This reverts commit 8482e95f75d02227fbf51527680c0b5424bacb69, which breaks on 
AIX
due to unsupported psudeo-ops in the assembly.

Differential Revision: https://reviews.llvm.org/D139368

Added: 


Modified: 
libunwind/src/UnwindRegistersRestore.S
libunwind/src/UnwindRegistersSave.S

Removed: 




diff  --git a/libunwind/src/UnwindRegistersRestore.S 
b/libunwind/src/UnwindRegistersRestore.S
index 94b2aba3586ca..08f208ec7c2d6 100644
--- a/libunwind/src/UnwindRegistersRestore.S
+++ b/libunwind/src/UnwindRegistersRestore.S
@@ -8,12 +8,6 @@
 
 #include "assembly.h"
 
-#define FROM_0_TO_15 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
-#define FROM_16_TO_31 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
-
-#define FROM_0_TO_31 
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
-#define FROM_32_TO_63 
32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
-
 #if defined(_AIX)
   .toc
 #else
@@ -158,9 +152,32 @@ 
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_ppc646jumptoEv)
   // skip r3 for now
   // skip r4 for now
   // skip r5 for now
-  .irp 
i,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
-PPC64_LR(\i)
-  .endr
+  PPC64_LR(6)
+  PPC64_LR(7)
+  PPC64_LR(8)
+  PPC64_LR(9)
+  PPC64_LR(10)
+  PPC64_LR(11)
+  PPC64_LR(12)
+  PPC64_LR(13)
+  PPC64_LR(14)
+  PPC64_LR(15)
+  PPC64_LR(16)
+  PPC64_LR(17)
+  PPC64_LR(18)
+  PPC64_LR(19)
+  PPC64_LR(20)
+  PPC64_LR(21)
+  PPC64_LR(22)
+  PPC64_LR(23)
+  PPC64_LR(24)
+  PPC64_LR(25)
+  PPC64_LR(26)
+  PPC64_LR(27)
+  PPC64_LR(28)
+  PPC64_LR(29)
+  PPC64_LR(30)
+  PPC64_LR(31)
 
 #if defined(__VSX__)
 
@@ -176,9 +193,38 @@ 
DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind15Registers_ppc646jumptoEv)
   addi4, 4, 16
 
   // restore the first 32 VS regs (and also all floating point regs)
-  .irp i,FROM_0_TO_31
-PPC64_LVS(\i)
-  .endr
+  PPC64_LVS(0)
+  PPC64_LVS(1)
+  PPC64_LVS(2)
+  PPC64_LVS(3)
+  PPC64_LVS(4)
+  PPC64_LVS(5)
+  PPC64_LVS(6)
+  PPC64_LVS(7)
+  PPC64_LVS(8)
+  PPC64_LVS(9)
+  PPC64_LVS(10)
+  PPC64_LVS(11)
+  PPC64_LVS(12)
+  PPC64_LVS(13)
+  PPC64_LVS(14)
+  PPC64_LVS(15)
+  PPC64_LVS(16)
+  PPC64_LVS(17)
+  PPC64_LVS(18)
+  PPC64_LVS(19)
+  PPC64_LVS(20)
+  PPC64_LVS(21)
+  PPC64_LVS(22)
+  PPC64_LVS(23)
+  PPC64_LVS(24)
+  PPC64_LVS(25)
+  PPC64_LVS(26)
+  PPC64_LVS(27)
+  PPC64_LVS(28)
+  PPC64_LVS(29)
+  PPC64_LVS(30)
+  PPC64_LVS(31)
 
 #define PPC64_CLVS_RESTORE(n)\
   addi   4, 3, PPC64_OFFS_FP + n * 16   ;\
@@ -211,12 +257,38 @@ Ldone##n:
 
 #endif // !defined(_AIX)
 
-  .irp i,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
-PPC64_CLVSl(\i)
-  .endr
-  .irp i,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
-PPC64_CLVSh(\i)
-  .endr
+  PPC64_CLVSl(32)
+  PPC64_CLVSl(33)
+  PPC64_CLVSl(34)
+  PPC64_CLVSl(35)
+  PPC64_CLVSl(36)
+  PPC64_CLVSl(37)
+  PPC64_CLVSl(38)
+  PPC64_CLVSl(39)
+  PPC64_CLVSl(40)
+  PPC64_CLVSl(41)
+  PPC64_CLVSl(42)
+  PPC64_CLVSl(43)
+  PPC64_CLVSl(44)
+  PPC64_CLVSl(45)
+  PPC64_CLVSl(46)
+  PPC64_CLVSl(47)
+  PPC64_CLVSh(48)
+  PPC64_CLVSh(49)
+  PPC64_CLVSh(50)
+  PPC64_CLVSh(51)
+  PPC64_CLVSh(52)
+  PPC64_CLVSh(53)
+  PPC64_CLVSh(54)
+  PPC64_CLVSh(55)
+  PPC64_CLVSh(56)
+  PPC64_CLVSh(57)
+  PPC64_CLVSh(58)
+  PPC64_CLVSh(59)
+  PPC64_CLVSh(60)
+  PPC64_CLVSh(61)
+  PPC64_CLVSh(62)
+  PPC64_CLVSh(63)
 
 #else
 
@@ -225,9 +297,38 @@ Ldone##n:
   lfd   n, (PPC64_OFFS_FP + n * 16)(3)
 
   // restore float registers
-  .irp i,FROM_0_TO_31
-PPC64_LF(\i)
-  .endr
+  PPC64_LF(0)
+  PPC64_LF(1)
+  PPC64_LF(2)
+  PPC64_LF(3)
+  PPC64_LF(4)
+  PPC64_LF(5)
+  PPC64_LF(6)
+  PPC64_LF(7)
+  PPC64_LF(8)
+  PPC64_LF(9)
+  PPC64_LF(10)
+  PPC64_LF(11)
+  PPC64_LF(12)
+  PPC64_LF(13)
+  PPC64_LF(14)
+  PPC64_LF(15)
+  PPC64_LF(16)
+  PPC64_LF(17)
+  PPC64_LF(18)
+  PPC64_LF(19)
+  PPC64_LF(20)
+  PPC64_LF(21)
+  PPC64_LF(22)
+  PPC64_LF(23)
+  PPC64_LF(24)
+  PPC64_LF(25)
+  PPC64_LF(26)
+  PPC64_LF(27)
+  PPC64_LF(28)
+  PPC64_LF(29)
+  PPC64_LF(30)
+  PPC64_LF(31)
 
 #if defined(__ALTIVEC__)
 
@@ -269,12 +370,38 @@ Ldone  ## n:
   // the _vectorScalarRegisters may not be 16-byte aligned
   // so copy via red zone temp buffer
 
-  .irp i,FROM_0_TO_15
-PPC64_CLV_UNALIGNEDl(\i)
-  .endr
-  .irp i,FROM_16_TO_31
-PPC64_CLV_UNALIGNEDh(\i)
-  .endr
+  PPC64_CLV_UNALIGNEDl(0)
+  PPC64_CLV_UNALIGNEDl(1)
+  PPC64_CLV_UNALIGNEDl(2)
+  PPC64_CLV_UNALIGNEDl(3)
+  PPC64_CLV_UNALIGNEDl(4)
+  PPC64_CLV_UNALIGNEDl(5)
+  PPC64_CLV_UNALIGNEDl(6)
+  PPC64_CLV_UNA

[clang] b888caf - XFAIL hidden-duplicates.m for AIX and zOS

2022-11-22 Thread David Tenty via cfe-commits

Author: Nancy Wang
Date: 2022-11-22T16:26:06-05:00
New Revision: b888cafcbc0a16f68bc0ebea495920b952290ea2

URL: 
https://github.com/llvm/llvm-project/commit/b888cafcbc0a16f68bc0ebea495920b952290ea2
DIFF: 
https://github.com/llvm/llvm-project/commit/b888cafcbc0a16f68bc0ebea495920b952290ea2.diff

LOG: XFAIL hidden-duplicates.m for AIX and zOS

as this is failing on the build bots:

https://lab.llvm.org/buildbot/#/builders/214/builds/4442/steps/6/logs/FAIL__Clang__hidden-duplicates_m

and is being investigate under https://reviews.llvm.org/D130327.

Added: 


Modified: 
clang/test/Modules/hidden-duplicates.m

Removed: 




diff  --git a/clang/test/Modules/hidden-duplicates.m 
b/clang/test/Modules/hidden-duplicates.m
index de46a4ab56c2f..ec9549dab53ea 100644
--- a/clang/test/Modules/hidden-duplicates.m
+++ b/clang/test/Modules/hidden-duplicates.m
@@ -1,3 +1,4 @@
+// XFAIL: aix, -zos
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: %clang_cc1 -emit-llvm -o %t/test.bc -I %t/include %t/test.m -verify \



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8c974bf - Reland: unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after 8c8a2679a20f

2022-06-13 Thread David Tenty via cfe-commits

Author: Nico Weber
Date: 2022-06-13T13:45:13-04:00
New Revision: 8c974bfe1cb944a760d3b838aec4179577d0c3f5

URL: 
https://github.com/llvm/llvm-project/commit/8c974bfe1cb944a760d3b838aec4179577d0c3f5
DIFF: 
https://github.com/llvm/llvm-project/commit/8c974bfe1cb944a760d3b838aec4179577d0c3f5.diff

LOG: Reland: unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV 
after 8c8a2679a20f

See revision b8b7a9dcdcbc for prior art.

Reland of: 4463bd0f89181234e0cef982e21de2e96038f873 since the dependent
patch D126340 is also relanding.

Added: 


Modified: 
clang/include/clang/Serialization/ASTBitCodes.h

Removed: 




diff  --git a/clang/include/clang/Serialization/ASTBitCodes.h 
b/clang/include/clang/Serialization/ASTBitCodes.h
index 1ed234e644e79..0ea8b9002a974 100644
--- a/clang/include/clang/Serialization/ASTBitCodes.h
+++ b/clang/include/clang/Serialization/ASTBitCodes.h
@@ -41,7 +41,7 @@ namespace serialization {
 /// Version 4 of AST files also requires that the version control branch and
 /// revision match exactly, since there is no backward compatibility of
 /// AST files at this time.
-const unsigned VERSION_MAJOR = 19;
+const unsigned VERSION_MAJOR = 20;
 
 /// AST file minor version number supported by this version of
 /// Clang.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6a86730 - Reland [clang][AIX] add option mdefault-visibility-export-mapping

2022-06-13 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-06-13T13:43:46-04:00
New Revision: 6a8673038b0c7e20962d732515cd2cd4812f52ef

URL: 
https://github.com/llvm/llvm-project/commit/6a8673038b0c7e20962d732515cd2cd4812f52ef
DIFF: 
https://github.com/llvm/llvm-project/commit/6a8673038b0c7e20962d732515cd2cd4812f52ef.diff

LOG: Reland [clang][AIX] add option mdefault-visibility-export-mapping

The option mdefault-visibility-export-mapping is created to allow
mapping default visibility to an explicit shared library export
(e.g. dllexport). Exactly how and if this is manifested is target
dependent (since it depends on how they map dllexport in the IR).

Three values are provided for the option:

* none: the default and behavior without the option, no additional export 
linkage information is created.
* explicit: add the export for entities with explict default visibility from 
the source, including RTTI
* all: add the export for all entities with default visibility

This option is useful for targets which do not export symbols as part of
their usual default linkage behaviour (e.g. AIX), such targets
traditionally specified such information in external files (e.g. export
lists), but this mapping allows them to use the visibility information
typically used for this purpose on other (e.g. ELF) platforms.

This relands commit: 8c8a2679a20f621994fa904bcfc68775e7345edc

with fixes for the compile time and assert problems that were reported
by:

* making shouldMapVisibilityToDLLExport inline and provide an early return
in the case where no mapping is in effect (aka non-AIX platforms)
* don't try to export RTTI types which we will give internal linkage to

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D126340

Added: 
clang/test/CodeGen/mdefault-visibility-export-mapping.c
clang/test/CodeGenCXX/mdefault-visibility-export-mapping-alias.cpp
clang/test/CodeGenCXX/mdefault-visibility-export-mapping-rtti.cpp
clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp

Modified: 
clang/docs/UsersManual.rst
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index b8c468333a67b..e12dc72407b13 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3626,6 +3626,23 @@ Clang expects the GCC executable "gcc.exe" compiled for
 `Some tests might fail `_ on
 ``x86_64-w64-mingw32``.
 
+AIX
+^^^
+
+The ``-mdefault-visibility-export-mapping=`` option can be used to control
+mapping of default visibility to an explicit shared object export
+(i.e. XCOFF exported visibility). Three values are provided for the option:
+
+* ``-mdefault-visibility-export-mapping=none``: no additional export
+  information is created for entities with default visibility.
+* ``-mdefault-visibility-export-mapping=explicit``: mark entities for export
+  if they have explict (e.g. via an attribute) default visibility from the
+  source, including RTTI.
+* ``-mdefault-visibility-export-mapping=all``: set XCOFF exported visibility
+  for all entities with default visibility from any source. This gives a
+  export behavior similar to ELF platforms where all entities with default
+  visibility are exported.
+
 .. _spir-v:
 
 SPIR-V support

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index af6ff6292256e..aa346ba239391 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -290,6 +290,7 @@ BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping 
the AST layout of all
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")
+BENIGN_ENUM_LANGOPT(DefaultVisibilityExportMapping, 
DefaultVisiblityExportMapping, 2, DefaultVisiblityExportMapping::None, 
"controls mapping of default visibility to dllexport")
 BENIGN_LANGOPT(IgnoreXCOFFVisibility, 1, 0, "All the visibility attributes 
that are specified in the source code are ignored in aix XCOFF.")
 BENIGN_LANGOPT(VisibilityInlinesHiddenStaticLocalVar, 1, 0,
"hidden visibility for static local variables in inline C++ "

diff  --git a/clang/include/clang/Basic/LangOptions.h 
b/clang/include/clang/Basic/LangOptions.h
index 6e7763a4a2b47..cf121de6699c8 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -350,6 +350,14 @@ class LangOptions

[clang] 8c8a267 - [clang][AIX] add option mdefault-visibility-export-mapping

2022-06-01 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-06-01T18:07:17-04:00
New Revision: 8c8a2679a20f621994fa904bcfc68775e7345edc

URL: 
https://github.com/llvm/llvm-project/commit/8c8a2679a20f621994fa904bcfc68775e7345edc
DIFF: 
https://github.com/llvm/llvm-project/commit/8c8a2679a20f621994fa904bcfc68775e7345edc.diff

LOG: [clang][AIX] add option mdefault-visibility-export-mapping

The option mdefault-visibility-export-mapping is created to allow
mapping default visibility to an explicit shared library export
(e.g. dllexport). Exactly how and if this is manifested is target
dependent (since it depends on how they map dllexport in the IR).

Three values are provided for the option:

* none: the default and behavior without the option, no additional export 
linkage information is created.
* explicit: add the export for entities with explict default visibility from 
the source, including RTTI
* all: add the export for all entities with default visibility

This option is useful for targets which do not export symbols as part of
their usual default linkage behaviour (e.g. AIX), such targets
traditionally specified such information in external files (e.g. export
lists), but this mapping allows them to use the visibility information
typically used for this purpose on other (e.g. ELF) platforms.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D126340

Added: 
clang/test/CodeGen/mdefault-visibility-export-mapping.c
clang/test/CodeGenCXX/mdefault-visibility-export-mapping-alias.cpp
clang/test/CodeGenCXX/mdefault-visibility-export-mapping-rtti.cpp
clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp

Modified: 
clang/docs/UsersManual.rst
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Basic/LangOptions.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/lib/Driver/ToolChains/Clang.cpp

Removed: 




diff  --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index b8c468333a67b..e12dc72407b13 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3626,6 +3626,23 @@ Clang expects the GCC executable "gcc.exe" compiled for
 `Some tests might fail `_ on
 ``x86_64-w64-mingw32``.
 
+AIX
+^^^
+
+The ``-mdefault-visibility-export-mapping=`` option can be used to control
+mapping of default visibility to an explicit shared object export
+(i.e. XCOFF exported visibility). Three values are provided for the option:
+
+* ``-mdefault-visibility-export-mapping=none``: no additional export
+  information is created for entities with default visibility.
+* ``-mdefault-visibility-export-mapping=explicit``: mark entities for export
+  if they have explict (e.g. via an attribute) default visibility from the
+  source, including RTTI.
+* ``-mdefault-visibility-export-mapping=all``: set XCOFF exported visibility
+  for all entities with default visibility from any source. This gives a
+  export behavior similar to ELF platforms where all entities with default
+  visibility are exported.
+
 .. _spir-v:
 
 SPIR-V support

diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 6e1a01c6c9767..4a52a65847bbb 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -289,6 +289,7 @@ BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping 
the AST layout of all
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")
+BENIGN_ENUM_LANGOPT(DefaultVisibilityExportMapping, 
DefaultVisiblityExportMapping, 2, DefaultVisiblityExportMapping::None, 
"controls mapping of default visibility to dllexport")
 BENIGN_LANGOPT(IgnoreXCOFFVisibility, 1, 0, "All the visibility attributes 
that are specified in the source code are ignored in aix XCOFF.")
 BENIGN_LANGOPT(VisibilityInlinesHiddenStaticLocalVar, 1, 0,
"hidden visibility for static local variables in inline C++ "

diff  --git a/clang/include/clang/Basic/LangOptions.h 
b/clang/include/clang/Basic/LangOptions.h
index 6e7763a4a2b47..575fa5a920cbf 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -350,6 +350,14 @@ class LangOptions : public LangOptionsBase {
 PerThread,
   };
 
+  enum class DefaultVisiblityExportMapping {
+None,
+/// map only explicit default visibilities to exported
+Explicit,
+/// map all default visibilities to exported
+All,
+  };
+
 public:
   /// The used language standard.
   LangStandard::Kind LangStd;
@@ -581,6 +589,16 @@ class LangOp

[clang] 9519dac - Revert "[NFC][tests][AIX] XFAIL test for lack of visibility support"

2022-05-11 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-05-11T20:47:48-04:00
New Revision: 9519dacab7b8afd537811fc2abaceb4d14f4e16a

URL: 
https://github.com/llvm/llvm-project/commit/9519dacab7b8afd537811fc2abaceb4d14f4e16a
DIFF: 
https://github.com/llvm/llvm-project/commit/9519dacab7b8afd537811fc2abaceb4d14f4e16a.diff

LOG: Revert "[NFC][tests][AIX] XFAIL test for lack of visibility support"

This reverts commit f5a9b5cc12658f4d6caa3e0cfc3e771698fb3798 since
https://reviews.llvm.org/D125141 has resolved the test issue.

Added: 


Modified: 
clang/test/OpenMP/target_update_messages.cpp

Removed: 




diff  --git a/clang/test/OpenMP/target_update_messages.cpp 
b/clang/test/OpenMP/target_update_messages.cpp
index d79b57943065..f936a075e1b4 100644
--- a/clang/test/OpenMP/target_update_messages.cpp
+++ b/clang/test/OpenMP/target_update_messages.cpp
@@ -1,6 +1,3 @@
-// Visibility hidden is not currently implemented on AIX.
-// XFAIL: aix
-
 // RUN: %clang_cc1 -verify=expected,lt50,lt51 -fopenmp -fopenmp-version=45 
-ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
 // RUN: %clang_cc1 -verify=expected,ge50,lt51 -fopenmp -fopenmp-version=50 
-ferror-limit 100 -o - -std=c++11 %s -Wuninitialized
 // RUN: %clang_cc1 -verify=expected,ge50,ge51 -fopenmp -fopenmp-version=51 
-ferror-limit 100 -o - -std=c++11 %s -Wuninitialized



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] d9c1d3c - [clang][AIX] Don't ignore XCOFF visibility by default

2022-05-11 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-05-11T13:27:48-04:00
New Revision: d9c1d3cbcb9751a6a82cc5e4ada0533cbbc79a1a

URL: 
https://github.com/llvm/llvm-project/commit/d9c1d3cbcb9751a6a82cc5e4ada0533cbbc79a1a
DIFF: 
https://github.com/llvm/llvm-project/commit/d9c1d3cbcb9751a6a82cc5e4ada0533cbbc79a1a.diff

LOG: [clang][AIX] Don't ignore XCOFF visibility by default

D87451 added -mignore-xcoff-visibility for AIX targets and made it the default 
(which mimicked the behaviour of the XL 16.1 compiler on AIX).

However, ignoring hidden visibility has unwanted side effects and some 
libraries depend on visibility to hide non-ABI facing entities from user 
headers and
reserve the right to change these implementation details based on this 
(https://libcxx.llvm.org/DesignDocs/VisibilityMacros.html). This forces us to 
use
internal linkage fallbacks for these cases on AIX and creates an unwanted 
divergence in implementations on the plaform.

For these reasons, it's preferable to not add -mignore-xcoff-visibility by 
default, which is what this patch does.

Reviewed By: DiggerLin

Differential Revision: https://reviews.llvm.org/D125141

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp
clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 5a3b2066d68fc..6d2a1b8885ce9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -298,6 +298,17 @@ Windows Support
   JustMyCode feature. Note, you may need to manually add ``/JMC`` as additional
   compile options in the Visual Studio since it currently assumes clang-cl 
does not support ``/JMC``.
 
+AIX Support
+---
+
+- The driver no longer adds ``-mignore-xcoff-visibility`` by default for AIX
+  targets when no other visibility command-line options are in effect, as
+  ignoring hidden visibility can silently have undesirable side effects (e.g
+  when libraries depend on visibility to hide non-ABI facing entities). The
+  ``-mignore-xcoff-visibility`` option can be manually specified on the
+  command-line to recover the previous behavior if desired.
+
+
 C Language Changes in Clang
 ---
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index a9dd4ca65333c..05988cbbf8d7e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5922,9 +5922,7 @@ def stack_protector_buffer_size : Separate<["-"], 
"stack-protector-buffer-size">
   MarshallingInfoInt, "8">;
 def fvisibility : Separate<["-"], "fvisibility">,
   HelpText<"Default type and symbol visibility">,
-  MarshallingInfoVisibility, 
"DefaultVisibility">,
-  // Always emitting because of the relation to `-mignore-xcoff-visibility`.
-  AlwaysEmit;
+  MarshallingInfoVisibility, 
"DefaultVisibility">;
 def ftype_visibility : Separate<["-"], "ftype-visibility">,
   HelpText<"Default type visibility">,
   MarshallingInfoVisibility, 
fvisibility.KeyPath>;

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index 847766a58c021..2e205f3429bd4 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3739,28 +3739,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions 
&Opts, ArgList &Args,
 Opts.GNUCVersion = Major * 100 * 100 + Minor * 100 + Patch;
   }
 
-  // In AIX OS, the -mignore-xcoff-visibility is enable by default if there is
-  // no -fvisibility=* option.
-  // This is the reason why '-fvisibility' needs to be always generated:
-  // its absence implies '-mignore-xcoff-visibility'.
-  //
-  // Suppose the original cc1 command line does contain '-fvisibility default':
-  // '-mignore-xcoff-visibility' should not be implied.
-  // * If '-fvisibility' is not generated (as most options with default values
-  //   don't), its absence would imply '-mignore-xcoff-visibility'. This 
changes
-  //   the command line semantics.
-  // * If '-fvisibility' is generated regardless of its presence and value,
-  //   '-mignore-xcoff-visibility' won't be implied and the command line
-  //   semantics are kept intact.
-  //
-  // When the original cc1 command line does **not** contain '-fvisibility',
-  // '-mignore-xcoff-visibility' is implied. The generated command line will
-  // contain both '-fvisibility default' and '-mignore-xcoff-visibility' and
-  // subsequent calls to `CreateFromArgs`/`generateCC1CommandLine` will always
-  // produce the same arguments.
-
-  if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) ||
-  !Args.hasArg(OPT_fvisibility)))
+  if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility)))
 Opts.Ignor

[clang] a70cf56 - Reland: [clang] Adding Platform/Architecture Specific Resource Header Installation Targets

2022-04-28 Thread David Tenty via cfe-commits

Author: Qiongsi Wu
Date: 2022-04-29T00:03:06-04:00
New Revision: a70cf56d20b956fc008d24420e14226127ba9f4a

URL: 
https://github.com/llvm/llvm-project/commit/a70cf56d20b956fc008d24420e14226127ba9f4a
DIFF: 
https://github.com/llvm/llvm-project/commit/a70cf56d20b956fc008d24420e14226127ba9f4a.diff

LOG: Reland: [clang] Adding Platform/Architecture Specific Resource Header 
Installation Targets

The goal of this patch is to improve distribution build's flexibility to 
include only applicable header files.

Currently, the clang-resource-headers target contains nearly all the files in 
clang/lib/Headers. Most of these files are platform specific (e.g. immintrin.h 
is x86 specific). A distribution build will have to either include all the 
headers for all the platforms, or not include any headers. For example, if a 
distribution build for powerpc includes the clang-resource-headers target, it 
will include all the x86 specific headers, even-though the x86 specific headers 
cannot be used.

This patch breaks up the clang-resource-headers list to a core list and 
platform specific lists. With the patch, a distribution build can now include 
the ppc-resource-headers to include the headers applicable to the powerpc 
platform.

Specifically, one can now have

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;ppc-resource-headers" ... ../llvm
ninja install-distribution then installs the powerpc headers.

Similarly, one can do

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;x86-resource-headers" ... ../llvm
to include headers applicable to the x86 platform in a distribution 
installation.

To implement this behaviour, the patch does two things

It breaks up the long files header file list to a core list and platform 
specific lists.
It adds numerous platform specific installation targets.

Differential Revision: https://reviews.llvm.org/D123498

Added: 


Modified: 
clang/lib/Headers/CMakeLists.txt

Removed: 




diff  --git a/clang/lib/Headers/CMakeLists.txt 
b/clang/lib/Headers/CMakeLists.txt
index f1106b97bb38..bb24b4274380 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -1,19 +1,107 @@
-set(files
-  adxintrin.h
-  altivec.h
-  ammintrin.h
-  amxintrin.h
+# core_files list contains the headers shared by all platforms.
+# Please consider adding new platform specific headers
+# to platform specific lists below.
+set(core_files
+  builtins.h
+  float.h
+  inttypes.h
+  iso646.h
+  limits.h
+  module.modulemap
+  stdalign.h
+  stdarg.h
+  stdatomic.h
+  stdbool.h
+  stddef.h
+  __stddef_max_align_t.h
+  stdint.h
+  stdnoreturn.h
+  tgmath.h
+  unwind.h
+  varargs.h
+  )
+
+set(arm_common_files
+  # Headers shared by Arm and AArch64
   arm_acle.h
+  )
+
+set(arm_only_files
   arm_cmse.h
   armintr.h
+  )
+
+set(aarch64_only_files
   arm64intr.h
+  )
+
+set(cuda_files
+  __clang_cuda_builtin_vars.h
+  __clang_cuda_math.h
+  __clang_cuda_cmath.h
+  __clang_cuda_complex_builtins.h
+  __clang_cuda_device_functions.h
+  __clang_cuda_intrinsics.h
+  __clang_cuda_texture_intrinsics.h
+  __clang_cuda_libdevice_declares.h
+  __clang_cuda_math_forward_declares.h
+  __clang_cuda_runtime_wrapper.h
+  )
+
+set(hexagon_files
+  hexagon_circ_brev_intrinsics.h
+  hexagon_protos.h
+  hexagon_types.h
+  hvx_hexagon_protos.h
+  )
+
+set(hip_files
+  __clang_hip_libdevice_declares.h
+  __clang_hip_cmath.h
+  __clang_hip_math.h
+  __clang_hip_runtime_wrapper.h
+  )
+
+set(mips_msa_files
+  msa.h
+  )
+
+set(opencl_files
+  opencl-c.h
+  opencl-c-base.h
+  )
+
+set(ppc_files
+  altivec.h
+  htmintrin.h
+  htmxlintrin.h
+  )
+
+set(systemz_files
+  s390intrin.h
+  vecintrin.h
+  )
+
+set(ve_files
+  velintrin.h
+  velintrin_gen.h
+  velintrin_approx.h
+  )
+
+set(webassembly_files
+  wasm_simd128.h
+  )
+
+set(x86_files
+# Intrinsics
+  adxintrin.h
+  ammintrin.h
+  amxintrin.h
   avx2intrin.h
   avx512bf16intrin.h
-  avx512bwintrin.h
   avx512bitalgintrin.h
-  avx512vlbitalgintrin.h
+  avx512bwintrin.h
   avx512cdintrin.h
-  avx512vpopcntdqintrin.h
   avx512dqintrin.h
   avx512erintrin.h
   avx512fintrin.h
@@ -21,86 +109,55 @@ set(files
   avx512ifmaintrin.h
   avx512ifmavlintrin.h
   avx512pfintrin.h
+  avx512vbmi2intrin.h
   avx512vbmiintrin.h
   avx512vbmivlintrin.h
-  avx512vbmi2intrin.h
-  avx512vlvbmi2intrin.h
   avx512vlbf16intrin.h
+  avx512vlbitalgintrin.h
   avx512vlbwintrin.h
   avx512vlcdintrin.h
   avx512vldqintrin.h
   avx512vlfp16intrin.h
   avx512vlintrin.h
-  avx512vp2intersectintrin.h
+  avx512vlvbmi2intrin.h
+  avx512vlvnniintrin.h
   avx512vlvp2intersectintrin.h
-  avx512vpopcntdqvlintrin.h
   avx512vnniintrin.h
-  avx512vlvnniintrin.h
+  avx512vp2intersectintrin.h
+  avx512vpopcntdqintrin.h
+  avx512vpopcntdqvlintrin.h
   avxintrin.h
   avxvnniintrin.h
   bmi2intrin.h
   bmiintrin.h
-  builtins.h
-  __clang_cuda_builtin_vars.h
-  __clang_cuda_math.h
-  __clang_cuda_cmath.h
-  __clang_cuda_complex_b

[clang] aa643f4 - Fixup D123950 to address revert of D123345

2022-04-20 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-04-20T19:59:07-04:00
New Revision: aa643f455a5362de7189eac630050d2c8aefe8f2

URL: 
https://github.com/llvm/llvm-project/commit/aa643f455a5362de7189eac630050d2c8aefe8f2
DIFF: 
https://github.com/llvm/llvm-project/commit/aa643f455a5362de7189eac630050d2c8aefe8f2.diff

LOG: Fixup D123950 to address revert of D123345

Since D123345 got reverted Builtin::BIaddressof and Builtin::BI__addressof 
don't exist and cause build breaks.

Added: 


Modified: 
clang/lib/CodeGen/CGExpr.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index fbe1586001b19..b2947e3927165 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -1175,8 +1175,6 @@ Address CodeGenFunction::EmitPointerWithAlignment(const 
Expr *E,
 switch (Call->getBuiltinCallee()) {
 default:
   break;
-case Builtin::BIaddressof:
-case Builtin::BI__addressof:
 case Builtin::BI__builtin_addressof: {
   LValue LV = EmitLValue(Call->getArg(0));
   if (BaseInfo) *BaseInfo = LV.getBaseInfo();



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 98d911e - Revert "Treat `std::move`, `forward`, etc. as builtins."

2022-04-20 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-04-20T19:14:37-04:00
New Revision: 98d911e01f3ac62a9f78850b4209effcf2f54c91

URL: 
https://github.com/llvm/llvm-project/commit/98d911e01f3ac62a9f78850b4209effcf2f54c91
DIFF: 
https://github.com/llvm/llvm-project/commit/98d911e01f3ac62a9f78850b4209effcf2f54c91.diff

LOG: Revert "Treat `std::move`, `forward`, etc. as builtins."

This reverts commit b27430f9f46b88bcd54d992debc8d72e131e1bd0 as the
parent https://reviews.llvm.org/D123345 breaks the AIX CI:

https://lab.llvm.org/buildbot/#/builders/214/builds/819

Added: 


Modified: 
clang/docs/CommandGuide/clang.rst
clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/Builtins.def
clang/include/clang/Basic/Builtins.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/ExprConstant.cpp
clang/lib/Analysis/BodyFarm.cpp
clang/lib/Basic/Builtins.cpp
clang/lib/CodeGen/CGBuiltin.cpp
clang/lib/CodeGen/CGCall.cpp
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaExprCXX.cpp
clang/lib/Sema/SemaInit.cpp
clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/Analysis/inner-pointer.cpp
clang/test/Analysis/use-after-move.cpp
clang/test/CodeGenCXX/builtins.cpp
clang/test/CodeGenCXX/microsoft-abi-throw.cpp
clang/test/SemaCXX/unqualified-std-call-fixits.cpp
clang/test/SemaCXX/unqualified-std-call.cpp
clang/test/SemaCXX/warn-consumed-analysis.cpp
clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp

Removed: 
clang/test/CodeGenCXX/builtin-std-move.cpp
clang/test/SemaCXX/builtin-std-move-nobuiltin.cpp
clang/test/SemaCXX/builtin-std-move.cpp



diff  --git a/clang/docs/CommandGuide/clang.rst 
b/clang/docs/CommandGuide/clang.rst
index 658a30458043e..aec62789a43e6 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -252,24 +252,8 @@ Language Selection and Mode Options
 
 .. option:: -fno-builtin
 
- Disable special handling and optimizations of well-known library functions,
- like :c:func:`strlen` and :c:func:`malloc`.
-
-.. option:: -fno-builtin-
-
- Disable special handling and optimizations for the specific library function.
- For example, ``-fno-builtin-strlen`` removes any special handling for the
- :c:func:`strlen` library function.
-
-.. option:: -fno-builtin-std-
-
- Disable special handling and optimizations for the specific C++ standard
- library function in namespace ``std``. For example,
- ``-fno-builtin-std-move_if_noexcept`` removes any special handling for the
- :cpp:func:`std::move_if_noexcept` library function.
-
- For C standard library functions that the C++ standard library also provides
- in namespace ``std``, use :option:`-fno-builtin-\` instead.
+ Disable special handling and optimizations of builtin functions like
+ :c:func:`strlen` and :c:func:`malloc`.
 
 .. option:: -fmath-errno
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index cb5cad717e347..4e63effe5769f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -250,10 +250,7 @@ C2x Feature Support
 C++ Language Changes in Clang
 -
 
-- Improved ``-O0`` code generation for calls to ``std::move``, 
``std::forward``,
-  ``std::move_if_noexcept``, ``std::addressof``, and ``std::as_const``. These
-  are now treated as compiler builtins and implemented directly, rather than
-  instantiating the definition from the standard library.
+- ...
 
 C++20 Feature Support
 ^

diff  --git a/clang/include/clang/Basic/Builtins.def 
b/clang/include/clang/Basic/Builtins.def
index c22957e14de7d..62e82cd36321d 100644
--- a/clang/include/clang/Basic/Builtins.def
+++ b/clang/include/clang/Basic/Builtins.def
@@ -81,9 +81,7 @@
 //   builtin even if type doesn't match signature, and don't warn if we
 //   can't be sure the type is right
 //  F -> this is a libc/libm function with a '__builtin_' prefix added.
-//  f -> this is a libc/libm function without a '__builtin_' prefix, or with
-//   'z', a C++ standard library function in namespace std::. This builtin
-//   is disableable by '-fno-builtin-foo' / '-fno-builtin-std-foo'.
+//  f -> this is a libc/libm function without the '__builtin_' prefix.
 //  h -> this function requires a specific header or an explicit declaration.
 //  i -> this is a runtime library implemented function without the
 //   '__builtin_' prefix. It will be implemented in compiler-rt or libgcc.
@@ -103,7 +101,6 @@
 //  V:N: -> requires vectors of at least N bits to be legal
 //  C -> callback behavior: argument N is called with argument
 //  M_0, ..., M_k as payload
-//  z -> this is a function in (possibly-versioned) namespace std
 //  FIXME: gcc has nonnull
 
 #if defined(BUILTIN) && !defined(LIB

[clang] de6ddae - Revert "Don't treat 'T &forward(T&&)' as builtin."

2022-04-20 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-04-20T19:14:36-04:00
New Revision: de6ddaeef3aaa8a9ae3663c12cdb57d9afc0f906

URL: 
https://github.com/llvm/llvm-project/commit/de6ddaeef3aaa8a9ae3663c12cdb57d9afc0f906
DIFF: 
https://github.com/llvm/llvm-project/commit/de6ddaeef3aaa8a9ae3663c12cdb57d9afc0f906.diff

LOG: Revert "Don't treat 'T &forward(T&&)' as builtin."

This reverts commit e43c93dd63cca295ef26ab69cd305816a71d45fd as the
parent https://reviews.llvm.org/D123345 breaks the AIX CI.

Added: 


Modified: 
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/SemaCXX/builtin-std-move.cpp
libcxx/test/std/utilities/utility/forward/forward.fail.cpp

Removed: 




diff  --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp 
b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index f11a1748e5c68..8b0147fc66c36 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -621,20 +621,6 @@ static bool isRelevantAttr(Sema &S, const Decl *D, const 
Attr *A) {
 return true;
   }
 
-  if (const auto *BA = dyn_cast(A)) {
-// Do not treat 'std::forward' as a builtin if it takes an rvalue reference
-// type and returns an lvalue reference type. The library implementation
-// will produce an error in this case; don't get in its way.
-if (BA->getID() == Builtin::BIforward) {
-  const FunctionDecl *FD = dyn_cast(D);
-  if (FD && FD->getNumParams() >= 1 &&
-  FD->getParamDecl(0)->getType()->isRValueReferenceType() &&
-  FD->getReturnType()->isLValueReferenceType()) {
-return false;
-  }
-}
-  }
-
   return true;
 }
 

diff  --git a/clang/test/SemaCXX/builtin-std-move.cpp 
b/clang/test/SemaCXX/builtin-std-move.cpp
index 7f1b01e43d788..a53e57c86c14c 100644
--- a/clang/test/SemaCXX/builtin-std-move.cpp
+++ b/clang/test/SemaCXX/builtin-std-move.cpp
@@ -30,18 +30,11 @@ namespace std {
   template struct remove_reference { using type = T; };
   template struct remove_reference { using type = T; };
 
-  template struct is_lvalue_reference { static constexpr bool 
value = false; };
-  template struct is_lvalue_reference { static constexpr bool 
value = true; };
-
   template CONSTEXPR T &&forward(typename 
remove_reference::type &x) {
 static_assert(T::moveable, "instantiated forward"); // expected-error {{no 
member named 'moveable' in 'B'}}
 // expected-error@-1 
{{no member named 'moveable' in 'C'}}
 return static_cast(x);
   }
-  template CONSTEXPR T &&forward(typename 
remove_reference::type &&x) {
-static_assert(!is_lvalue_reference::value, "should not forward rval as 
lval"); // expected-error {{static_assert failed}}
-return static_cast(x);
-  }
 
   template CONSTEXPR const T &as_const(T &x) {
 static_assert(T::moveable, "instantiated as_const"); // expected-error 
{{no member named 'moveable' in 'B'}}
@@ -83,11 +76,6 @@ static_assert(f({}), "should be constexpr");
 // expected-note@#call {{}}
 #endif
 
-A &forward_rval_as_lval() {
-  std::forward(A()); // expected-warning {{const attribute}}
-  return std::forward(A()); // expected-note {{instantiation of}}
-}
-
 struct B {};
 B &&(*pMove)(B&) = std::move; // #1 expected-note {{instantiation of}}
 B &&(*pMoveIfNoexcept)(B&) = &std::move_if_noexcept; // #2 expected-note 
{{instantiation of}}

diff  --git a/libcxx/test/std/utilities/utility/forward/forward.fail.cpp 
b/libcxx/test/std/utilities/utility/forward/forward.fail.cpp
index f913b835c2248..4d7790a751481 100644
--- a/libcxx/test/std/utilities/utility/forward/forward.fail.cpp
+++ b/libcxx/test/std/utilities/utility/forward/forward.fail.cpp
@@ -22,7 +22,7 @@ const A csource() {return A();}
 int main(int, char**)
 {
 {
-(void)std::forward(source());  // expected-note {{requested here}}
+std::forward(source());  // expected-note {{requested here}}
 // expected-error-re@*:* 1 {{static_assert failed{{.*}} "cannot 
forward an rvalue as an lvalue"}}
 }
 {



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 2512a87 - [clang] Adding Platform/Architecture Specific Resource Header Installation Targets

2022-04-19 Thread David Tenty via cfe-commits

Author: Qiongsi Wu
Date: 2022-04-19T10:10:07-04:00
New Revision: 2512a875ccac158bc9b654b09e3347db167e33df

URL: 
https://github.com/llvm/llvm-project/commit/2512a875ccac158bc9b654b09e3347db167e33df
DIFF: 
https://github.com/llvm/llvm-project/commit/2512a875ccac158bc9b654b09e3347db167e33df.diff

LOG: [clang] Adding Platform/Architecture Specific Resource Header Installation 
Targets

The goal of this patch is to improve distribution build's flexibility to 
include only applicable header files.

Currently, the clang-resource-headers target contains nearly all the files in 
clang/lib/Headers. Most of these files are platform specific (e.g. immintrin.h 
is x86 specific). A distribution build will have to either include all the 
headers for all the platforms, or not include any headers. For example, if a 
distribution build for powerpc includes the clang-resource-headers target, it 
will include all the x86 specific headers, even-though the x86 specific headers 
cannot be used.

This patch breaks up the clang-resource-headers list to a core list and 
platform specific lists. With the patch, a distribution build can now include 
the ppc-resource-headers to include the headers applicable to the powerpc 
platform.

Specifically, one can now have

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;ppc-resource-headers" ... ../llvm
ninja install-distribution then installs the powerpc headers.

Similarly, one can do

cmake ... LLVM_DISTRIBUTION_COMPONENTS="clang;x86-resource-headers" ... ../llvm
to include headers applicable to the x86 platform in a distribution 
installation.

To implement this behaviour, the patch does two things:
* It breaks up the long files header file list to a core list and platform 
specific lists.
* It adds numerous platform specific installation targets.

Differential Revision: https://reviews.llvm.org/D123498

Added: 


Modified: 
clang/lib/Headers/CMakeLists.txt

Removed: 




diff  --git a/clang/lib/Headers/CMakeLists.txt 
b/clang/lib/Headers/CMakeLists.txt
index f1106b97bb382..e506ecb7a8c0e 100644
--- a/clang/lib/Headers/CMakeLists.txt
+++ b/clang/lib/Headers/CMakeLists.txt
@@ -1,19 +1,107 @@
-set(files
-  adxintrin.h
-  altivec.h
-  ammintrin.h
-  amxintrin.h
+# core_files list contains the headers shared by all platforms.
+# Please consider adding new platform specific headers
+# to platform specific lists below.
+set(core_files
+  builtins.h
+  float.h
+  inttypes.h
+  iso646.h
+  limits.h
+  module.modulemap
+  stdalign.h
+  stdarg.h
+  stdatomic.h
+  stdbool.h
+  stddef.h
+  __stddef_max_align_t.h
+  stdint.h
+  stdnoreturn.h
+  tgmath.h
+  unwind.h
+  varargs.h
+  )
+
+set(arm_common_files
+  # Headers shared by Arm and AArch64
   arm_acle.h
+  )
+
+set(arm_only_files
   arm_cmse.h
   armintr.h
+  )
+
+set(aarch64_only_files
   arm64intr.h
+  )
+
+set(cuda_files
+  __clang_cuda_builtin_vars.h
+  __clang_cuda_math.h
+  __clang_cuda_cmath.h
+  __clang_cuda_complex_builtins.h
+  __clang_cuda_device_functions.h
+  __clang_cuda_intrinsics.h
+  __clang_cuda_texture_intrinsics.h
+  __clang_cuda_libdevice_declares.h
+  __clang_cuda_math_forward_declares.h
+  __clang_cuda_runtime_wrapper.h
+  )
+
+set(hexagon_files
+  hexagon_circ_brev_intrinsics.h
+  hexagon_protos.h
+  hexagon_types.h
+  hvx_hexagon_protos.h
+  )
+
+set(hip_files
+  __clang_hip_libdevice_declares.h
+  __clang_hip_cmath.h
+  __clang_hip_math.h
+  __clang_hip_runtime_wrapper.h
+  )
+
+set(mips_msa_files
+  msa.h
+  )
+
+set(opencl_files
+  opencl-c.h
+  opencl-c-base.h
+  )
+
+set(ppc_files
+  altivec.h
+  htmintrin.h
+  htmxlintrin.h
+  )
+
+set(systemz_files
+  s390intrin.h
+  vecintrin.h
+  )
+
+set(ve_files
+  velintrin.h
+  velintrin_gen.h
+  velintrin_approx.h
+  )
+
+set(webassembly_files
+  wasm_simd128.h
+  )
+
+set(x86_files
+# Intrinsics
+  adxintrin.h
+  ammintrin.h
+  amxintrin.h
   avx2intrin.h
   avx512bf16intrin.h
-  avx512bwintrin.h
   avx512bitalgintrin.h
-  avx512vlbitalgintrin.h
+  avx512bwintrin.h
   avx512cdintrin.h
-  avx512vpopcntdqintrin.h
   avx512dqintrin.h
   avx512erintrin.h
   avx512fintrin.h
@@ -21,86 +109,55 @@ set(files
   avx512ifmaintrin.h
   avx512ifmavlintrin.h
   avx512pfintrin.h
+  avx512vbmi2intrin.h
   avx512vbmiintrin.h
   avx512vbmivlintrin.h
-  avx512vbmi2intrin.h
-  avx512vlvbmi2intrin.h
   avx512vlbf16intrin.h
+  avx512vlbitalgintrin.h
   avx512vlbwintrin.h
   avx512vlcdintrin.h
   avx512vldqintrin.h
   avx512vlfp16intrin.h
   avx512vlintrin.h
-  avx512vp2intersectintrin.h
+  avx512vlvbmi2intrin.h
+  avx512vlvnniintrin.h
   avx512vlvp2intersectintrin.h
-  avx512vpopcntdqvlintrin.h
   avx512vnniintrin.h
-  avx512vlvnniintrin.h
+  avx512vp2intersectintrin.h
+  avx512vpopcntdqintrin.h
+  avx512vpopcntdqvlintrin.h
   avxintrin.h
   avxvnniintrin.h
   bmi2intrin.h
   bmiintrin.h
-  builtins.h
-  __clang_cuda_builtin_vars.h
-  __clang_cuda_math.h
-  __clang_cuda_cmath.h
-  __clang_cuda_complex_bui

[clang] 27ee911 - [AIX][clang] include_next through clang provided float.h

2022-01-28 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-01-28T13:27:10-05:00
New Revision: 27ee91162dd3f01d692e8f092903dd79f4e54348

URL: 
https://github.com/llvm/llvm-project/commit/27ee91162dd3f01d692e8f092903dd79f4e54348
DIFF: 
https://github.com/llvm/llvm-project/commit/27ee91162dd3f01d692e8f092903dd79f4e54348.diff

LOG: [AIX][clang] include_next through clang provided float.h

AIX provides additional definitions in the system libc float.h that we
would like to be available to users, so we need to include_next through,
similar to what is done on some other platforms.

We also adjust the guards for some definitions which are restricted
based on language level to also be provide with the _ALL_SOURCE feature
test macro on AIX, similar to what is done by the platform float.h
header, so we don't run into cases where we don't provide the compiler
macro but still have a different definition from the system.

Differential Revision: https://reviews.llvm.org/D117935

Added: 
clang/test/Headers/Inputs/include/float.h
clang/test/Headers/float-aix.c

Modified: 
clang/lib/Headers/float.h

Removed: 




diff  --git a/clang/lib/Headers/float.h b/clang/lib/Headers/float.h
index ed610b24aa103..c6a6cc08462da 100644
--- a/clang/lib/Headers/float.h
+++ b/clang/lib/Headers/float.h
@@ -14,10 +14,11 @@
  * additional definitions provided for Windows.
  * For more details see http://msdn.microsoft.com/en-us/library/y0ybw9fy.aspx
  *
- * Also fall back on Darwin to allow additional definitions and
+ * Also fall back on Darwin and AIX to allow additional definitions and
  * implementation-defined values.
  */
-#if (defined(__APPLE__) || (defined(__MINGW32__) || defined(_MSC_VER))) && \
+#if (defined(__APPLE__) || defined(__MINGW32__) || defined(_MSC_VER) ||
\
+ defined(_AIX)) && 
\
 __STDC_HOSTED__ && __has_include_next()
 
 /* Prior to Apple's 10.7 SDK, float.h SDK header used to apply an extra level
@@ -37,7 +38,9 @@
 #  undef FLT_MANT_DIG
 #  undef DBL_MANT_DIG
 #  undef LDBL_MANT_DIG
-#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201103L
+#  if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201103L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef DECIMAL_DIG
 #  endif
 #  undef FLT_DIG
@@ -64,7 +67,9 @@
 #  undef FLT_MIN
 #  undef DBL_MIN
 #  undef LDBL_MIN
-#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus 
>= 201703L
+#  if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||  
\
+  __cplusplus >= 201703L ||
\
+  (__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #undef FLT_TRUE_MIN
 #undef DBL_TRUE_MIN
 #undef LDBL_TRUE_MIN
@@ -87,7 +92,9 @@
 #define DBL_MANT_DIG __DBL_MANT_DIG__
 #define LDBL_MANT_DIG __LDBL_MANT_DIG__
 
-#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201103L
+#if __STDC_VERSION__ >= 199901L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201103L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define DECIMAL_DIG __DECIMAL_DIG__
 #endif
 
@@ -123,7 +130,9 @@
 #define DBL_MIN __DBL_MIN__
 #define LDBL_MIN __LDBL_MIN__
 
-#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) || __cplusplus >= 
201703L
+#if __STDC_VERSION__ >= 201112L || !defined(__STRICT_ANSI__) ||
\
+__cplusplus >= 201703L ||  
\
+(__STDC_HOSTED__ && defined(_AIX) && defined(_ALL_SOURCE))
 #  define FLT_TRUE_MIN __FLT_DENORM_MIN__
 #  define DBL_TRUE_MIN __DBL_DENORM_MIN__
 #  define LDBL_TRUE_MIN __LDBL_DENORM_MIN__

diff  --git a/clang/test/Headers/Inputs/include/float.h 
b/clang/test/Headers/Inputs/include/float.h
new file mode 100644
index 0..616a02c9c95c9
--- /dev/null
+++ b/clang/test/Headers/Inputs/include/float.h
@@ -0,0 +1,2 @@
+#pragma once
+#define FLOAT_LOCAL_DEF 1

diff  --git a/clang/test/Headers/float-aix.c b/clang/test/Headers/float-aix.c
new file mode 100644
index 0..d43eae79bcd17
--- /dev/null
+++ b/clang/test/Headers/float-aix.c
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -fsyntax-only -verify 
-internal-isystem %S/Inputs/include %s
+// expected-no-diagnostics
+
+#include 
+
+_Static_assert(FLOAT_LOCAL_DEF, "");



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 9939bb6 - [NFC][AIX][clang] un-XFAIL gcc profile flag compat test

2022-01-28 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2022-01-28T11:18:55-05:00
New Revision: 9939bb6682128235c9f0f6076d15ae5191d2dd05

URL: 
https://github.com/llvm/llvm-project/commit/9939bb6682128235c9f0f6076d15ae5191d2dd05
DIFF: 
https://github.com/llvm/llvm-project/commit/9939bb6682128235c9f0f6076d15ae5191d2dd05.diff

LOG: [NFC][AIX][clang] un-XFAIL gcc profile flag compat test

We can pass this test now thanks to recent changes that allow us to use PGO 
without LTO, so un-XFAIL the test and update the comments.

Differential Revision: https://reviews.llvm.org/D118474

Added: 


Modified: 
clang/test/Profile/gcc-flag-compatibility-aix.c
clang/test/Profile/gcc-flag-compatibility.c

Removed: 




diff  --git a/clang/test/Profile/gcc-flag-compatibility-aix.c 
b/clang/test/Profile/gcc-flag-compatibility-aix.c
index ead654dd102fb..db12e05c247b5 100644
--- a/clang/test/Profile/gcc-flag-compatibility-aix.c
+++ b/clang/test/Profile/gcc-flag-compatibility-aix.c
@@ -7,7 +7,8 @@
 // -fprofile-use=Uses the profile file /default.profdata
 // -fprofile-use=/file   Uses the profile file /file
 
-// On AIX, -flto is required with -fprofile-generate
+// On AIX, -flto used to be required with -fprofile-generate, so test those
+// extra cases.
 
 // RUN: %clang %s -c -S -o - -emit-llvm -target powerpc64-unknown-aix -flto 
-fprofile-generate | FileCheck -check-prefix=PROFILE-GEN %s
 // PROFILE-GEN: @__profc_main = {{(private|internal)}} global [2 x i64] 
zeroinitializer, section

diff  --git a/clang/test/Profile/gcc-flag-compatibility.c 
b/clang/test/Profile/gcc-flag-compatibility.c
index cdec997a7aaa2..9f83117c1ccdf 100644
--- a/clang/test/Profile/gcc-flag-compatibility.c
+++ b/clang/test/Profile/gcc-flag-compatibility.c
@@ -7,8 +7,7 @@
 // -fprofile-use=Uses the profile file /default.profdata
 // -fprofile-use=/file   Uses the profile file /file
 
-// On AIX, -flto is required with -fprofile-generate. 
gcc-flag-compatibility-aix.c is used to do the testing on AIX with -flto
-// XFAIL: aix
+// On AIX, -flto used to be required with -fprofile-generate. 
gcc-flag-compatibility-aix.c is used to do the testing on AIX with -flto
 // RUN: %clang %s -c -S -o - -emit-llvm -fprofile-generate | FileCheck 
-check-prefix=PROFILE-GEN %s
 // PROFILE-GEN: @__profc_main = {{(private|internal)}} global [2 x i64] 
zeroinitializer, section
 // PROFILE-GEN: @__profd_main =



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1f3925e - [clang][driver][AIX] Add system libc++ header paths to driver

2021-09-15 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2021-09-15T10:41:18-04:00
New Revision: 1f3925e25ae010c30273501d24b2bd4e0318fe7a

URL: 
https://github.com/llvm/llvm-project/commit/1f3925e25ae010c30273501d24b2bd4e0318fe7a
DIFF: 
https://github.com/llvm/llvm-project/commit/1f3925e25ae010c30273501d24b2bd4e0318fe7a.diff

LOG: [clang][driver][AIX] Add system libc++ header paths to driver

This change adds the system libc++ header location to the driver. As well we 
define
the `__LIBC_NO_CPP_MATH_OVERLOADS__` macro when using those headers, in order 
to suppress
conflicting C++ overloads in the system libc headers that were used by XL C++.

Reviewed By: ZarkoCA

Differential Revision: https://reviews.llvm.org/D109078

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/test/Driver/aix-ld.c
clang/test/Driver/aix-toolchain-include.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 3000b8416adfd..2a380d9676003 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -218,15 +218,44 @@ void AIX::AddClangSystemIncludeArgs(const ArgList 
&DriverArgs,
   addSystemInclude(DriverArgs, CC1Args, UP.str());
 }
 
+void AIX::AddClangCXXStdlibIncludeArgs(
+const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const {
+
+  if (DriverArgs.hasArg(options::OPT_nostdinc) ||
+  DriverArgs.hasArg(options::OPT_nostdincxx) ||
+  DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;
+
+  switch (GetCXXStdlibType(DriverArgs)) {
+  case ToolChain::CST_Libstdcxx:
+llvm::report_fatal_error(
+"picking up libstdc++ headers is unimplemented on AIX");
+  case ToolChain::CST_Libcxx: {
+llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
+SmallString<128> PathCPP(Sysroot);
+llvm::sys::path::append(PathCPP, "opt/IBM/openxlCSDK", "include", "c++",
+"v1");
+addSystemInclude(DriverArgs, CC1Args, PathCPP.str());
+// Required in order to suppress conflicting C++ overloads in the system
+// libc headers that were used by XL C++.
+CC1Args.push_back("-D__LIBC_NO_CPP_MATH_OVERLOADS__");
+return;
+  }
+  }
+
+  llvm_unreachable("Unexpected C++ library type; only libc++ is supported.");
+}
+
 void AIX::AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
   llvm::opt::ArgStringList &CmdArgs) const {
   switch (GetCXXStdlibType(Args)) {
+  case ToolChain::CST_Libstdcxx:
+llvm::report_fatal_error("linking libstdc++ unimplemented on AIX");
   case ToolChain::CST_Libcxx:
 CmdArgs.push_back("-lc++");
 CmdArgs.push_back("-lc++abi");
 return;
-  case ToolChain::CST_Libstdcxx:
-llvm::report_fatal_error("linking libstdc++ unimplemented on AIX");
   }
 
   llvm_unreachable("Unexpected C++ library type; only libc++ is supported.");

diff  --git a/clang/lib/Driver/ToolChains/AIX.h 
b/clang/lib/Driver/ToolChains/AIX.h
index d1ec6d10fb3a0..5fcea1305c7c1 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -70,6 +70,10 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
   AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
 llvm::opt::ArgStringList &CC1Args) const override;
 
+  void AddClangCXXStdlibIncludeArgs(
+  const llvm::opt::ArgList &DriverArgs,
+  llvm::opt::ArgStringList &CC1Args) const override;
+
   void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs) const override;
 

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index c5f1061f03466..de70c2f030464 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -584,14 +584,14 @@
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
-// RUN:-stdlib=libstdc++ \
+// RUN:-stdlib=libstdc++ -nostdinc++ \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. -stdlib=libstdc++ invokes fatal 
error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
-// RUN:-stdlib=libstdc++ \
+// RUN:-stdlib=libstdc++ -nostdinc++ \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX

diff  --git a/clang/test/Driver/aix-toolchain-include.cpp 
b/clang/test/Driver/aix-toolchain-include.cpp
index dc8b272936a48..2ea60b2722977 100644
--- a/clang/test/Driver/aix-toolchain-include.cpp
+++ b/clan

[clang] 7942ebd - [clang] Add cc1 option for dumping layout for all complete types

2021-06-22 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2021-06-22T16:27:26-04:00
New Revision: 7942ebdf01b35fae240cd8a0550a3da9f03615c4

URL: 
https://github.com/llvm/llvm-project/commit/7942ebdf01b35fae240cd8a0550a3da9f03615c4
DIFF: 
https://github.com/llvm/llvm-project/commit/7942ebdf01b35fae240cd8a0550a3da9f03615c4.diff

LOG: [clang] Add cc1 option for dumping layout for all complete types

This change adds an option which, in addition to dumping the record
layout as is done by -fdump-record-layouts, causes us to compute the
layout for all complete record types (rather than the as-needed basis
which is usually done by clang), so that we will dump them as well.
This is useful if we are looking for layout differences across large
code bases without needing to instantiate every type we are interested in.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D104484

Added: 
clang/test/Layout/dump-complete.cpp

Modified: 
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/AST/Decl.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/LangOptions.def 
b/clang/include/clang/Basic/LangOptions.def
index 32429f019064d..b6d9160f89a00 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -265,6 +265,7 @@ BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug 
info")
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 016a565e77a57..cddc924dacd2e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5381,10 +5381,13 @@ def stats_file : Joined<["-"], "stats-file=">,
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
+  HelpText<"Dump record layout information for all complete types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;

diff  --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 27b34d3d16996..0fbe8ec161910 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,13 @@ RecordDecl::field_iterator RecordDecl::field_begin() 
const {
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx = getASTContext();
+
+  // Layouts are dumped when computed, so if we are dumping for all complete
+  // types, we need to force usage to get types that wouldn't be used 
elsewhere.
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+(void)Ctx.getASTRecordLayout(this);
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.

diff  --git a/clang/test/Layout/dump-complete.cpp 
b/clang/test/Layout/dump-complete.cpp
new file mode 100644
index 0..9ccbf477c7052
--- /dev/null
+++ b/clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | 
FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 66799bf - [AIX][clang][driver] Restrict /usr/lib to internal library search paths

2021-03-03 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2021-03-03T10:48:35-05:00
New Revision: 66799bf0e281099f05b781e5279a7025b1e365cf

URL: 
https://github.com/llvm/llvm-project/commit/66799bf0e281099f05b781e5279a7025b1e365cf
DIFF: 
https://github.com/llvm/llvm-project/commit/66799bf0e281099f05b781e5279a7025b1e365cf.diff

LOG: [AIX][clang][driver] Restrict /usr/lib to internal library search paths

Adding it to the general filepaths results in it being added to the
linker arguments. The AIX linker always looks in this path anyway
and adds it as a default library path component. Adding this duplicate
explicitly results in duplicate entries in path in the loader section
of executables and messes up tools like CMake that parse the default
library flags.

Reviewed By: ZarkoCA

Differential Revision: https://reviews.llvm.org/D97574

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 36fe578fcb3d..6cd12e16ec02 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -176,7 +176,7 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 /// AIX - AIX tool chain which can call as(1) and ld(1) directly.
 AIX::AIX(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
 : ToolChain(D, Triple, Args) {
-  getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
+  getLibraryPaths().push_back(getDriver().SysRoot + "/usr/lib");
 }
 
 // Returns the effective header sysroot path to use.

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 6abfa10c92f6..467374b93720 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -17,7 +17,6 @@
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NOT: "-lm"
@@ -39,7 +38,6 @@
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NOT: "-lm"
@@ -62,7 +60,6 @@
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -86,7 +83,6 @@
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -110,7 +106,6 @@
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PROF-NOT: "-lm"
@@ -133,7 +128,6 @@
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-GPROF-NOT: "-lm"
@@ -156,7 +150,6 @@
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-STATIC-NOT: "-lm"
@@ -180,7 +173,6 @@
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD3

[clang] afc277b - [AIX][Clang][Driver] Link libm in c++ mode

2020-09-30 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-30T14:02:17-04:00
New Revision: afc277b0ed0dcd9fbbde6015bbdf289349fb2104

URL: 
https://github.com/llvm/llvm-project/commit/afc277b0ed0dcd9fbbde6015bbdf289349fb2104
DIFF: 
https://github.com/llvm/llvm-project/commit/afc277b0ed0dcd9fbbde6015bbdf289349fb2104.diff

LOG: [AIX][Clang][Driver] Link libm in c++ mode

since that is the normal behaviour of other compilers on the platform.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D88500

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index b56ddf55cb30..351b34e8bf90 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -162,6 +162,9 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
   CmdArgs.push_back("-lpthreads");
 
+if (D.CCCIsCXX())
+  CmdArgs.push_back("-lm");
+
 CmdArgs.push_back("-lc");
   }
 

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 224e355aac13..7ccbeff3b8b6 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -20,6 +20,7 @@
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-NOT: "-lm"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
@@ -41,6 +42,7 @@
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-NOT: "-lm"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
@@ -64,6 +66,7 @@
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD-NOT: "-lm"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
@@ -87,6 +90,7 @@
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD-NOT: "-lm"
 // CHECK-LD64-PTHREAD: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
@@ -109,6 +113,7 @@
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-PROF-NOT: "-lm"
 // CHECK-LD32-PROF: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. Enable g-profiling.
@@ -131,6 +136,7 @@
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
+// CHECK-LD64-GPROF-NOT: "-lm"
 // CHECK-LD64-GPROF: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Static linking.
@@ -153,6 +159,7 @@
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-STATIC-NOT: "-lm"
 // CHECK-LD32-STATIC: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Library search path.
@@ -176,6 +183,7 @@
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
+// CHECK-LD32-LIBP-NOT: "-lm"
 // CHECK-LD32-LIBP: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. nostdlib.
@@ -200,6 +208,7 @@
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
+// CHECK-LD32-NO-STD-LIB-NOT: "-lm"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. nodefaultlibs.
@@ -224,6 +233,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lm"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
@@ -247,6 +257,7 @@
 // CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
 // CHECK-LD32-CXX-ARG-ORDER: "-lc++"
 // CHECK-LD32-CXX-ARG-ORDER: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{

[clang] ee80615 - [clang][driver][AIX] Set compiler-rt as default rtlib

2020-09-28 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-28T19:45:43-04:00
New Revision: ee80615b5c1c5b15c90a92d6954007b3a82825b0

URL: 
https://github.com/llvm/llvm-project/commit/ee80615b5c1c5b15c90a92d6954007b3a82825b0
DIFF: 
https://github.com/llvm/llvm-project/commit/ee80615b5c1c5b15c90a92d6954007b3a82825b0.diff

LOG: [clang][driver][AIX] Set compiler-rt as default rtlib

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D88182

Added: 
clang/test/Driver/aix-rtlib.c

Modified: 
clang/lib/Driver/ToolChain.cpp
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 0831791c8d06..8991216da676 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -391,6 +391,8 @@ StringRef ToolChain::getOSLibName() const {
 return "openbsd";
   case llvm::Triple::Solaris:
 return "sunos";
+  case llvm::Triple::AIX:
+return "aix";
   default:
 return getOS();
   }

diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 0d4d7e3dbf9f..b56ddf55cb30 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -156,6 +156,8 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs);
 
   if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
+
 // Support POSIX threads if "-pthreads" or "-pthread" is present.
 if (Args.hasArg(options::OPT_pthreads, options::OPT_pthread))
   CmdArgs.push_back("-lpthreads");
@@ -228,6 +230,10 @@ ToolChain::CXXStdlibType AIX::GetDefaultCXXStdlibType() 
const {
   return ToolChain::CST_Libcxx;
 }
 
+ToolChain::RuntimeLibType AIX::GetDefaultRuntimeLibType() const {
+  return ToolChain::RLT_CompilerRT;
+}
+
 auto AIX::buildAssembler() const -> Tool * { return new aix::Assembler(*this); 
}
 
 auto AIX::buildLinker() const -> Tool * { return new aix::Linker(*this); }

diff  --git a/clang/lib/Driver/ToolChains/AIX.h 
b/clang/lib/Driver/ToolChains/AIX.h
index f63b20da969e..d4e593255736 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -72,6 +72,8 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
 
   CXXStdlibType GetDefaultCXXStdlibType() const override;
 
+  RuntimeLibType GetDefaultRuntimeLibType() const override;
+
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 6dd14dc164df..224e355aac13 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: 
"[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc

[clang] e8fb4eb - [AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode

2020-09-22 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-22T09:55:06-04:00
New Revision: e8fb4eba4fb6cbda661080d76059f2b130df5020

URL: 
https://github.com/llvm/llvm-project/commit/e8fb4eba4fb6cbda661080d76059f2b130df5020
DIFF: 
https://github.com/llvm/llvm-project/commit/e8fb4eba4fb6cbda661080d76059f2b130df5020.diff

LOG: [AIX][clang][driver] Make sure crti[_64].o is linked in C++ mode

since crti is required for functional static initialization.

Reviewed By: hubert.reinterpretcast

Differential Revision: https://reviews.llvm.org/D87927

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index f4bab833fa9d..0d4d7e3dbf9f 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -133,6 +133,10 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
+
+if (D.CCCIsCXX())
+  CmdArgs.push_back(Args.MakeArgString(
+  ToolChain.GetFilePath(IsArch32Bit ? "crti.o" : "crti_64.o")));
   }
 
   // Collect all static constructor and destructor functions in CXX mode. This

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 22b0378aa3dd..6dd14dc164df 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -14,6 +14,7 @@
 // CHECK-LD32: "-b32"
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "-lc"
@@ -31,6 +32,7 @@
 // CHECK-LD64: "-b64"
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "-lc"
@@ -49,6 +51,7 @@
 // CHECK-LD32-PTHREAD: "-b32"
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -68,6 +71,7 @@
 // CHECK-LD64-PTHREAD: "-b64"
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -87,6 +91,7 @@
 // CHECK-LD32-PROF: "-b32"
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
+// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "-lc"
@@ -105,6 +110,7 @@
 // CHECK-LD64-GPROF: "-b64"
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
+// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "-lc"
@@ -123,6 +129,7 @@
 // CHECK-LD32-STATIC: "-b32"
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "-lc"
@@ -141,6 +148,7 @@
 // CHECK-LD32-LIBP: "-b32"
 // CHECK-LD32-LIBP: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-LIBP-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
@@ -161,6 +169,7 @@
 // CHECK-LD32-NO-STD-LIB: "-b32"
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -181,6 +190,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-b64"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-D

[clang] d854042 - [AIX][Clang][Driver] Add handling of shared option

2020-09-21 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-21T14:03:08-04:00
New Revision: d8540427419ec0c4b9bc02f432ef39c01898e826

URL: 
https://github.com/llvm/llvm-project/commit/d8540427419ec0c4b9bc02f432ef39c01898e826
DIFF: 
https://github.com/llvm/llvm-project/commit/d8540427419ec0c4b9bc02f432ef39c01898e826.diff

LOG: [AIX][Clang][Driver] Add handling of shared option

Reviewed By: jasonliu

Differential Revision: https://reviews.llvm.org/D87914

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index e492cd7d196f..f4bab833fa9d 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -92,6 +92,12 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-bnso");
 
+  // Add options for shared libraries.
+  if (Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-bM:SRE");
+CmdArgs.push_back("-bnoentry");
+  }
+
   // Specify linker output file.
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
@@ -123,7 +129,8 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+   options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 695260bbe2bd..22b0378aa3dd 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED: "-bnoentry"
+// CHECK-LD64-SHARED: "-b64"
+// CHECK-LD64-SHARED: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-SHARED: "-lc"



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 699089f - [AIX][Clang][Driver] Add handling of nostartfiles option

2020-09-21 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-09-21T10:42:46-04:00
New Revision: 699089f2a9702baa987dc2dbe915a2c845c7027f

URL: 
https://github.com/llvm/llvm-project/commit/699089f2a9702baa987dc2dbe915a2c845c7027f
DIFF: 
https://github.com/llvm/llvm-project/commit/699089f2a9702baa987dc2dbe915a2c845c7027f.diff

LOG: [AIX][Clang][Driver] Add handling of nostartfiles option

Reviewed By: jasonliu

Differential Revision: https://reviews.llvm.org/D87904

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/test/Driver/aix-ld.c

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index bc130a5557e9..e492cd7d196f 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }

diff  --git a/clang/test/Driver/aix-ld.c b/clang/test/Driver/aix-ld.c
index 7b3710ca21ef..695260bbe2bd 100644
--- a/clang/test/Driver/aix-ld.c
+++ b/clang/test/Driver/aix-ld.c
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 25ec96d - [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting

2020-07-09 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-07-09T15:15:30-04:00
New Revision: 25ec96d91a3a5326a403496fa5532ff0bdb6a15b

URL: 
https://github.com/llvm/llvm-project/commit/25ec96d91a3a5326a403496fa5532ff0bdb6a15b
DIFF: 
https://github.com/llvm/llvm-project/commit/25ec96d91a3a5326a403496fa5532ff0bdb6a15b.diff

LOG: [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

Added: 
clang/test/Driver/aix-object-mode.c

Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index dcb3b96cd057..baf01d853233 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -509,4 +509,6 @@ def warn_drv_libstdcxx_not_found : Warning<
   InGroup>;
 
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
+
+def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 }

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 596e694760d0..ece8222dcf24 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -475,6 +475,26 @@ static llvm::Triple computeTargetTriple(const Driver &D,
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
+
+  if (ObjectMode.equals("64")) {
+AT = Target.get64BitArchVariant().getArch();
+  } else if (ObjectMode.equals("32")) {
+AT = Target.get32BitArchVariant().getArch();
+  } else {
+D.Diag(diag::err_drv_invalid_object_mode) << ObjectMode;
+  }
+
+  if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
+Target.setArch(AT);
+}
+  }
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
options::OPT_m32, options::OPT_m16);

diff  --git a/clang/test/Driver/aix-object-mode.c 
b/clang/test/Driver/aix-object-mode.c
new file mode 100644
index ..a4bc79a4b41d
--- /dev/null
+++ b/clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// 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.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 1a2f482 - [Clang] Handle AIX Include management in the driver

2020-07-07 Thread David Tenty via cfe-commits

Author: Shuhong Liu
Date: 2020-07-07T11:15:06-04:00
New Revision: 1a2f4824cb2d472649e65f845510ac0e47ca98c1

URL: 
https://github.com/llvm/llvm-project/commit/1a2f4824cb2d472649e65f845510ac0e47ca98c1
DIFF: 
https://github.com/llvm/llvm-project/commit/1a2f4824cb2d472649e65f845510ac0e47ca98c1.diff

LOG: [Clang] Handle AIX Include management in the driver

Summary: Modify the AIX clang toolchain to include AIX dependencies in the 
search path

Reviewers: daltenty, stevewan, hubert.reinterpretcast

Reviewed By: daltenty, stevewan, hubert.reinterpretcast

Subscribers: ormris, hubert.reinterpretcast, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D82677

Added: 
clang/test/Driver/aix-toolchain-include.cpp

Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/lib/Frontend/InitHeaderSearch.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 0194f452111a..ac5544eedb00 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -13,12 +13,15 @@
 #include "clang/Driver/Options.h"
 #include "clang/Driver/SanitizerArgs.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/Path.h"
 
 using AIX = clang::driver::toolchains::AIX;
 using namespace clang::driver;
 using namespace clang::driver::tools;
+using namespace clang::driver::toolchains;
 
 using namespace llvm::opt;
+using namespace llvm::sys;
 
 void aix::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
   const InputInfo &Output,
@@ -163,6 +166,43 @@ AIX::AIX(const Driver &D, const llvm::Triple &Triple, 
const ArgList &Args)
   getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
 }
 
+// Returns the effective header sysroot path to use.
+// This comes from either -isysroot or --sysroot.
+llvm::StringRef
+AIX::GetHeaderSysroot(const llvm::opt::ArgList &DriverArgs) const {
+  if (DriverArgs.hasArg(options::OPT_isysroot))
+return DriverArgs.getLastArgValue(options::OPT_isysroot);
+  if (!getDriver().SysRoot.empty())
+return getDriver().SysRoot;
+  return "/";
+}
+
+void AIX::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
+ArgStringList &CC1Args) const {
+  // Return if -nostdinc is specified as a driver option.
+  if (DriverArgs.hasArg(options::OPT_nostdinc))
+return;
+
+  llvm::StringRef Sysroot = GetHeaderSysroot(DriverArgs);
+  const Driver &D = getDriver();
+
+  // Add the Clang builtin headers (/include).
+  if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
+SmallString<128> P(D.ResourceDir);
+path::append(P, "/include");
+addSystemInclude(DriverArgs, CC1Args, P.str());
+  }
+
+  // Return if -nostdlibinc is specified as a driver option.
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;
+
+  // Add /usr/include.
+  SmallString<128> UP(Sysroot);
+  path::append(UP, "/usr/include");
+  addSystemInclude(DriverArgs, CC1Args, UP.str());
+}
+
 auto AIX::buildAssembler() const -> Tool * { return new aix::Assembler(*this); 
}
 
 auto AIX::buildLinker() const -> Tool * { return new aix::Linker(*this); }

diff  --git a/clang/lib/Driver/ToolChains/AIX.h 
b/clang/lib/Driver/ToolChains/AIX.h
index 69b948bc0ea8..942bb3cceb8a 100644
--- a/clang/lib/Driver/ToolChains/AIX.h
+++ b/clang/lib/Driver/ToolChains/AIX.h
@@ -63,9 +63,16 @@ class LLVM_LIBRARY_VISIBILITY AIX : public ToolChain {
   bool isPIEDefault() const override { return false; }
   bool isPICDefaultForced() const override { return true; }
 
+  void
+  AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args) const override;
+
 protected:
   Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
+
+private:
+  llvm::StringRef GetHeaderSysroot(const llvm::opt::ArgList &DriverArgs) const;
 };
 
 } // end namespace toolchains

diff  --git a/clang/lib/Frontend/InitHeaderSearch.cpp 
b/clang/lib/Frontend/InitHeaderSearch.cpp
index 159cd47f7831..16f1f1670e8d 100644
--- a/clang/lib/Frontend/InitHeaderSearch.cpp
+++ b/clang/lib/Frontend/InitHeaderSearch.cpp
@@ -381,6 +381,7 @@ void InitHeaderSearch::AddDefaultCPlusPlusIncludePaths(
   case llvm::Triple::Linux:
   case llvm::Triple::Hurd:
   case llvm::Triple::Solaris:
+  case llvm::Triple::AIX:
 llvm_unreachable("Include management is handled in the driver.");
 break;
   case llvm::Triple::Win32:
@@ -424,6 +425,7 @@ void InitHeaderSearch::AddDefaultIncludePaths(const 
LangOptions &Lang,
   case llvm::Triple::Hurd:
   case llvm::Triple::Solaris:
   case llvm::Triple::WASI:
+  case llvm::Triple::AIX:
 return;
 
   case llvm::Triple::Win32:

diff  --git a/clang/test/Driver/aix-toolchain-include.cpp 
b/clang/test/Driver/aix-toolchain-include.cpp
new file mode 100644
index .

[clang] 58817a0 - [clang][XCOFF] Indicate that XCOFF does not support COMDATs

2020-02-18 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2020-02-18T16:10:11-05:00
New Revision: 58817a0783ca405cd36a312c7ee80e061d1cecc5

URL: 
https://github.com/llvm/llvm-project/commit/58817a0783ca405cd36a312c7ee80e061d1cecc5
DIFF: 
https://github.com/llvm/llvm-project/commit/58817a0783ca405cd36a312c7ee80e061d1cecc5.diff

LOG: [clang][XCOFF] Indicate that XCOFF does not support COMDATs

Summary: XCOFF doesn't support COMDATs, so clang shouldn't emit them.

Reviewers: stevewan, sfertile, Xiangling_L

Reviewed By: sfertile

Subscribers: dschuff, aheejin, dexonsmith, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D74631

Added: 
clang/test/CodeGen/xcoff-comdat.cpp

Modified: 
llvm/docs/LangRef.rst
llvm/include/llvm/ADT/Triple.h

Removed: 




diff  --git a/clang/test/CodeGen/xcoff-comdat.cpp 
b/clang/test/CodeGen/xcoff-comdat.cpp
new file mode 100644
index ..7da8d9a2cc22
--- /dev/null
+++ b/clang/test/CodeGen/xcoff-comdat.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple powerpc64-ibm-aix -emit-llvm -o - %s | FileCheck %s
+
+class a {
+  virtual void d() {}
+  virtual void e();
+};
+void a::e() {}
+
+// CHECK-NOT: = comdat

diff  --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index 2a61e0b19987..d14853a4e0d5 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -910,8 +910,8 @@ The selection kind must be one of the following:
 The linker may choose any COMDAT key but the sections must contain the
 same amount of data.
 
-Note that the Mach-O platform doesn't support COMDATs, and ELF and WebAssembly
-only support ``any`` as a selection kind.
+Note that XCOFF and the Mach-O platform don't support COMDATs, and ELF and
+WebAssembly only support ``any`` as a selection kind.
 
 Here is an example of a COMDAT group where a function will only be selected if
 the COMDAT key's section is the largest:

diff  --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h
index 76a754d671fb..64ba8d7e21e4 100644
--- a/llvm/include/llvm/ADT/Triple.h
+++ b/llvm/include/llvm/ADT/Triple.h
@@ -743,7 +743,7 @@ class Triple {
 
   /// Tests whether the target supports comdat
   bool supportsCOMDAT() const {
-return !isOSBinFormatMachO();
+return !(isOSBinFormatMachO() || isOSBinFormatXCOFF());
   }
 
   /// Tests whether the target uses emulated TLS as default.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3ebfab7 - Add AIX assembler support

2019-12-02 Thread David Tenty via cfe-commits

Author: stevewan
Date: 2019-12-02T11:29:36-05:00
New Revision: 3ebfab709583cfa7635693b123e56f76a1de765b

URL: 
https://github.com/llvm/llvm-project/commit/3ebfab709583cfa7635693b123e56f76a1de765b
DIFF: 
https://github.com/llvm/llvm-project/commit/3ebfab709583cfa7635693b123e56f76a1de765b.diff

LOG: Add AIX assembler support

Summary:
A skeleton of AIX toolchain and system linker support has been introduced in 
D68340, and this is a follow on patch to it.
This patch adds support to system assembler invocation to the AIX toolchain.

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L, dlj

Reviewed By: daltenty, hubert.reinterpretcast

Subscribers: wuzish, nemanjai, kbarton, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69620

Added: 
clang/test/Driver/Inputs/aix_ppc_tree/dummy0.s
clang/test/Driver/Inputs/aix_ppc_tree/dummy1.s
clang/test/Driver/Inputs/aix_ppc_tree/dummy2.s
clang/test/Driver/aix-as.c

Modified: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 50450b7deb56..6fbff61f7656 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -20,6 +20,62 @@ using namespace clang::driver::tools;
 
 using namespace llvm::opt;
 
+void aix::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
+  const InputInfo &Output,
+  const InputInfoList &Inputs,
+  const ArgList &Args,
+  const char *LinkingOutput) const {
+  ArgStringList CmdArgs;
+
+  const bool IsArch32Bit = getToolChain().getTriple().isArch32Bit();
+  const bool IsArch64Bit = getToolChain().getTriple().isArch64Bit();
+  // Only support 32 and 64 bit.
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value.");
+
+  // Specify the mode in which the as(1) command operates.
+  if (IsArch32Bit) {
+CmdArgs.push_back("-a32");
+  } else {
+// Must be 64-bit, otherwise asserted already.
+CmdArgs.push_back("-a64");
+  }
+
+  // Accept an undefined symbol as an extern so that an error message is not
+  // displayed. Otherwise, undefined symbols are flagged with error messages.
+  // FIXME: This should be removed when the assembly generation from the
+  // compiler is able to write externs properly.
+  CmdArgs.push_back("-u");
+
+  // Accept any mixture of instructions.
+  // On Power for AIX and Linux, this behaviour matches that of GCC for both 
the
+  // user-provided assembler source case and the compiler-produced assembler
+  // source case. Yet XL with user-provided assembler source would not add 
this.
+  CmdArgs.push_back("-many");
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  // Specify assembler output file.
+  assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
+  if (Output.isFilename()) {
+CmdArgs.push_back("-o");
+CmdArgs.push_back(Output.getFilename());
+  }
+
+  // Specify assembler input file.
+  // The system assembler on AIX takes exactly one input file. The driver is
+  // expected to invoke as(1) separately for each assembler source input file.
+  if (Inputs.size() != 1)
+llvm_unreachable("Invalid number of input files.");
+  const InputInfo &II = Inputs[0];
+  assert((II.isFilename() || II.isNothing()) && "Invalid input.");
+  if (II.isFilename())
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, Exec, CmdArgs, Inputs));
+}
+
 void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
const InputInfo &Output,
const InputInfoList &Inputs, const ArgList 
&Args,
@@ -42,7 +98,7 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   if (Output.isFilename()) {
 CmdArgs.push_back("-o");
 CmdArgs.push_back(Output.getFilename());
-  } 
+  }
 
   // Set linking mode (i.e., 32/64-bit) and the address of
   // text and data sections based on arch bit width.
@@ -92,11 +148,12 @@ void aix::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   C.addCommand(std::make_unique(JA, *this, Exec, CmdArgs, Inputs));
 }
 
-/// AIX - AIX tool chain which can call ld(1) directly.
-// TODO: Enable direct call to as(1).
+/// AIX - AIX tool chain which can call as(1) and ld(1) directly.
 AIX::AIX(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
 : ToolChain(D, Triple, Args) {
   getFilePaths().push_back(getDriver().SysRoot + "/usr/lib");
 }
 
+auto AIX::buildAssembler() const -> Tool * { return new aix::Assembler(*this); 
}
+
 auto AIX::buildLinker() const

[clang] a38fc61 - [AIX] Disable clang python binding tests

2019-11-26 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-11-26T15:30:38-05:00
New Revision: a38fc61648797a10629ed160779b5df6b8d577e7

URL: 
https://github.com/llvm/llvm-project/commit/a38fc61648797a10629ed160779b5df6b8d577e7
DIFF: 
https://github.com/llvm/llvm-project/commit/a38fc61648797a10629ed160779b5df6b8d577e7.diff

LOG: [AIX] Disable clang python binding tests

Summary:
The Python ctypes FFI interface is broken on AIX, it cannot properly pass
structures containing  arrays ( https://bugs.python.org/issue38628). So
disable the clang python binding tests on AIX till this is resolved.

Reviewers: stevewan, jasonliu, hubert.reinterpretcast, mgorny

Reviewed By: jasonliu, hubert.reinterpretcast

Subscribers: mgorny, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70675

Added: 


Modified: 
clang/bindings/python/tests/CMakeLists.txt

Removed: 




diff  --git a/clang/bindings/python/tests/CMakeLists.txt 
b/clang/bindings/python/tests/CMakeLists.txt
index 3f5ac957f81d..626256af9c1b 100644
--- a/clang/bindings/python/tests/CMakeLists.txt
+++ b/clang/bindings/python/tests/CMakeLists.txt
@@ -32,6 +32,11 @@ if(WIN32)
   set(RUN_PYTHON_TESTS FALSE)
 endif()
 
+# The Python FFI interface is broken on AIX: 
https://bugs.python.org/issue38628.
+if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  set(RUN_PYTHON_TESTS FALSE)
+endif()
+
 # AArch64, Hexagon, and Sparc have known test failures that need to be
 # addressed.
 # SystemZ has broken Python/FFI interface:



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6740a88 - [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

2019-11-06 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-11-06T14:32:35-05:00
New Revision: 6740a88dc18d0be14926a5e709bd5062e31ee81c

URL: 
https://github.com/llvm/llvm-project/commit/6740a88dc18d0be14926a5e709bd5062e31ee81c
DIFF: 
https://github.com/llvm/llvm-project/commit/6740a88dc18d0be14926a5e709bd5062e31ee81c.diff

LOG: [NFC] Add SUPPORT_PLUGINS to add_llvm_executable()

Summary:
this allows us to move logic about when it is appropriate set
LLVM_NO_DEAD_STRIP out of each tool and into add_llvm_executable,
which will enable future platform specific handling.

This is a follow on to the reverted D69356

Reviewers: hubert.reinterpretcast, beanz, lhames

Reviewed By: beanz

Subscribers: mgorny, cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D69638

Added: 


Modified: 
clang/tools/driver/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/tools/bugpoint/CMakeLists.txt
llvm/tools/llc/CMakeLists.txt
llvm/tools/opt/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 590d708d837c..52a95e6bc6b1 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -19,10 +19,9 @@ set( LLVM_LINK_COMPONENTS
 
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
-# Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(support_plugins SUPPORT_PLUGINS)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)
@@ -37,6 +36,7 @@ add_clang_tool(clang
 
   DEPENDS
   ${tablegen_deps}
+  ${support_plugins}
   )
 
 clang_target_link_libraries(clang

diff  --git a/llvm/cmake/modules/AddLLVM.cmake 
b/llvm/cmake/modules/AddLLVM.cmake
index 63f6fc7bf5d1..0508b621622b 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -732,7 +732,7 @@ endmacro(add_llvm_library name)
 
 macro(add_llvm_executable name)
   cmake_parse_arguments(ARG
-
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH"
+
"DISABLE_LLVM_LINK_LLVM_DYLIB;IGNORE_EXTERNALIZE_DEBUGINFO;NO_INSTALL_RPATH;SUPPORT_PLUGINS"
 "ENTITLEMENTS;BUNDLE_PATH"
 "DEPENDS"
 ${ARGN})
@@ -782,6 +782,11 @@ macro(add_llvm_executable name)
   if(NOT LLVM_ENABLE_OBJLIB)
 llvm_update_compile_flags(${name})
   endif()
+
+  if (ARG_SUPPORT_PLUGINS)
+set(LLVM_NO_DEAD_STRIP On)
+  endif()
+
   add_link_opts( ${name} )
 
   # Do not add -Dname_EXPORTS to the command-line when building files in this

diff  --git a/llvm/tools/bugpoint/CMakeLists.txt 
b/llvm/tools/bugpoint/CMakeLists.txt
index 031f51480cce..c1ef9173928c 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -21,9 +21,6 @@ set(LLVM_LINK_COMPONENTS
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(bugpoint
   BugDriver.cpp
   CrashDebugger.cpp
@@ -37,6 +34,7 @@ add_llvm_tool(bugpoint
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(bugpoint)
 

diff  --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt
index 300efdab10d0..880deefa539c 100644
--- a/llvm/tools/llc/CMakeLists.txt
+++ b/llvm/tools/llc/CMakeLists.txt
@@ -19,13 +19,11 @@ set(LLVM_LINK_COMPONENTS
   Vectorize
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(llc
   llc.cpp
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(llc)

diff  --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index cb4ba5cfbced..25a4ebba6992 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -24,9 +24,6 @@ set(LLVM_LINK_COMPONENTS
   Passes
   )
 
-# Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
-
 add_llvm_tool(opt
   AnalysisWrappers.cpp
   BreakpointPrinter.cpp
@@ -39,6 +36,7 @@ add_llvm_tool(opt
 
   DEPENDS
   intrinsics_gen
+  SUPPORT_PLUGINS
   )
 export_executable_symbols(opt)
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 23df0c7 - Revert "[NFC] Rename LLVM_NO_DEAD_STRIP"

2019-10-30 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-30T14:56:20-04:00
New Revision: 23df0c783c7053ddcdf665ebc8ddda350abd5bf2

URL: 
https://github.com/llvm/llvm-project/commit/23df0c783c7053ddcdf665ebc8ddda350abd5bf2
DIFF: 
https://github.com/llvm/llvm-project/commit/23df0c783c7053ddcdf665ebc8ddda350abd5bf2.diff

LOG: Revert "[NFC] Rename LLVM_NO_DEAD_STRIP"

This reverts commit 11c2a85db8849db1a5907e80d9966592248ef825.

Added: 


Modified: 
clang/tools/driver/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/tools/bugpoint/CMakeLists.txt
llvm/tools/llc/CMakeLists.txt
llvm/tools/opt/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 5a8f57eb4668..590d708d837c 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@ set( LLVM_LINK_COMPONENTS
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_SUPPORT_PLUGINS.
+# LLVM_NO_DEAD_STRIP.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_SUPPORT_PLUGINS 1)
+  set(LLVM_NO_DEAD_STRIP 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)

diff  --git a/llvm/cmake/modules/AddLLVM.cmake 
b/llvm/cmake/modules/AddLLVM.cmake
index 41e72c7e9bcc..b5f612469ff9 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@ function(add_link_opts target_name)
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_SUPPORT_PLUGINS)
+if(NOT LLVM_NO_DEAD_STRIP)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@ function(add_link_opts target_name)
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_SUPPORT_PLUGINS
+else() #LLVM_NO_DEAD_STRIP
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")

diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake 
b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 5aa72568c656..03acea487977 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -744,7 +744,7 @@ endif()
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_SUPPORT_PLUGINS is set.
+# flags instead if LLVM_NO_DEAD_STRIP is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")

diff  --git a/llvm/tools/bugpoint/CMakeLists.txt 
b/llvm/tools/bugpoint/CMakeLists.txt
index 8b468691fa6b..031f51480cce 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
+set(LLVM_NO_DEAD_STRIP 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp

diff  --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt
index 8435b9de6fb4..300efdab10d0 100644
--- a/llvm/tools/llc/CMakeLists.txt
+++ b/llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
+set(LLVM_NO_DEAD_STRIP 1)
 
 add_llvm_tool(llc
   llc.cpp

diff  --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index 4f74a0571203..cb4ba5cfbced 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_SUPPORT_PLUGINS 1)
+set(LLVM_NO_DEAD_STRIP 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 11c2a85 - [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-25 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-25T09:32:00-04:00
New Revision: 11c2a85db8849db1a5907e80d9966592248ef825

URL: 
https://github.com/llvm/llvm-project/commit/11c2a85db8849db1a5907e80d9966592248ef825
DIFF: 
https://github.com/llvm/llvm-project/commit/11c2a85db8849db1a5907e80d9966592248ef825.diff

LOG: [NFC] Rename LLVM_NO_DEAD_STRIP

Summary:
The variable LLVM_NO_DEAD_STRIP is set in LLVM cmake files when building 
executables that might make use of plugins .The name of the variable does not 
convey the actual intended usage (i.e. for use with tools that have plugins), 
just what the eventual effect of setting in on some (i.e. not garbage 
collecting unused symbols).

This patch renames it to LLVM_SUPPORT_PLUGINS to convey the intended usage, 
which will allow subsequent patches to add behavior to support that in 
different ways without confusion about whether it will do on, for example, 
non-gnu platforms.

Reviewers: hubert.reinterpretcast, stevewan

Reviewed By: stevewan

Subscribers: cfe-commits, mgorny, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D69356

Added: 


Modified: 
clang/tools/driver/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
llvm/cmake/modules/HandleLLVMOptions.cmake
llvm/tools/bugpoint/CMakeLists.txt
llvm/tools/llc/CMakeLists.txt
llvm/tools/opt/CMakeLists.txt

Removed: 




diff  --git a/clang/tools/driver/CMakeLists.txt 
b/clang/tools/driver/CMakeLists.txt
index 590d708d837c..5a8f57eb4668 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@ set( LLVM_LINK_COMPONENTS
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)

diff  --git a/llvm/cmake/modules/AddLLVM.cmake 
b/llvm/cmake/modules/AddLLVM.cmake
index b5f612469ff9..41e72c7e9bcc 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@ function(add_link_opts target_name)
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@ function(add_link_opts target_name)
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")

diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake 
b/llvm/cmake/modules/HandleLLVMOptions.cmake
index a84aff104a44..75c2df9eb559 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@ endif()
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")

diff  --git a/llvm/tools/bugpoint/CMakeLists.txt 
b/llvm/tools/bugpoint/CMakeLists.txt
index 031f51480cce..8b468691fa6b 100644
--- a/llvm/tools/bugpoint/CMakeLists.txt
+++ b/llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp

diff  --git a/llvm/tools/llc/CMakeLists.txt b/llvm/tools/llc/CMakeLists.txt
index 300efdab10d0..8435b9de6fb4 100644
--- a/llvm/tools/llc/CMakeLists.txt
+++ b/llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp

diff  --git a/llvm/tools/opt/CMakeLists.txt b/llvm/tools/opt/CMakeLists.txt
index cb4ba5cfbced..4f74a0571203 100644
--- a/llvm/tools/opt/CMakeLists.txt
+++ b/llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@ set(LLVM_LINK_COMPONENTS
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listin

[clang] 201ed14 - Follow on to Namespace fixup for D68340

2019-10-24 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-24T17:01:17-04:00
New Revision: 201ed14aea8cd03e776dbe8484fa7de3ac94a3cf

URL: 
https://github.com/llvm/llvm-project/commit/201ed14aea8cd03e776dbe8484fa7de3ac94a3cf
DIFF: 
https://github.com/llvm/llvm-project/commit/201ed14aea8cd03e776dbe8484fa7de3ac94a3cf.diff

LOG: Follow on to Namespace fixup for D68340

remove using directive that can make lookup ambiguous.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index b548919526df..50450b7deb56 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -14,7 +14,6 @@
 #include "clang/Driver/SanitizerArgs.h"
 #include "llvm/Option/ArgList.h"
 
-namespace aix = clang::driver::tools::aix;
 using AIX = clang::driver::toolchains::AIX;
 using namespace clang::driver;
 using namespace clang::driver::tools;



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 76ee21e - Namespace fixup for D68340 build on MSVC

2019-10-24 Thread David Tenty via cfe-commits

Author: David Tenty
Date: 2019-10-24T15:47:08-04:00
New Revision: 76ee21e1d09084288bbfee7f960ce0b9e4306d60

URL: 
https://github.com/llvm/llvm-project/commit/76ee21e1d09084288bbfee7f960ce0b9e4306d60
DIFF: 
https://github.com/llvm/llvm-project/commit/76ee21e1d09084288bbfee7f960ce0b9e4306d60.diff

LOG: Namespace fixup for D68340 build on MSVC

we seem to run into issues with nested namespace lookups in recently landed
D68340 so just make them explicit.

Added: 


Modified: 
clang/lib/Driver/ToolChains/AIX.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
index 369a5fc17c91..b548919526df 100644
--- a/clang/lib/Driver/ToolChains/AIX.cpp
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -16,6 +16,8 @@
 
 namespace aix = clang::driver::tools::aix;
 using AIX = clang::driver::toolchains::AIX;
+using namespace clang::driver;
+using namespace clang::driver::tools;
 
 using namespace llvm::opt;
 



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] bb6a27f - Add AIX toolchain and basic linker functionality

2019-10-24 Thread David Tenty via cfe-commits

Author: stevewan
Date: 2019-10-24T14:47:57-04:00
New Revision: bb6a27fc257faac1339e79c20ae807db70a31ebd

URL: 
https://github.com/llvm/llvm-project/commit/bb6a27fc257faac1339e79c20ae807db70a31ebd
DIFF: 
https://github.com/llvm/llvm-project/commit/bb6a27fc257faac1339e79c20ae807db70a31ebd.diff

LOG: Add AIX toolchain and basic linker functionality

Summary:
This patch adds AIX toolchain infrastructure into driver, and enables AIX
system linker invocation with some basic functionality support

Reviewers: daltenty, hubert.reinterpretcast, jasonliu, Xiangling_L

Reviewed By: jasonliu

Subscribers: Xiangling_L, jasonliu, ormris, wuzish, nemanjai, mgorny, kbarton, 
jfb, jsji, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D68340

Added: 
clang/lib/Driver/ToolChains/AIX.cpp
clang/lib/Driver/ToolChains/AIX.h
clang/test/Driver/Inputs/aix_ppc_tree/powerpc-ibm-aix7.1.0.0/dummy.a
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crt0_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/crti_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/gcrt0_64.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0.o
clang/test/Driver/Inputs/aix_ppc_tree/usr/lib/mcrt0_64.o
clang/test/Driver/aix-ld.c

Modified: 
clang/lib/Driver/CMakeLists.txt
clang/lib/Driver/Driver.cpp

Removed: 




diff  --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 64b5d70f42b6..84fd58cf6819 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -30,6 +30,7 @@ add_clang_library(clangDriver
   ToolChains/Arch/Sparc.cpp
   ToolChains/Arch/SystemZ.cpp
   ToolChains/Arch/X86.cpp
+  ToolChains/AIX.cpp
   ToolChains/Ananas.cpp
   ToolChains/AMDGPU.cpp
   ToolChains/AVR.cpp

diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index f6016b43b692..4c59bf0a5e20 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -8,6 +8,7 @@
 
 #include "clang/Driver/Driver.h"
 #include "InputInfo.h"
+#include "ToolChains/AIX.h"
 #include "ToolChains/AMDGPU.h"
 #include "ToolChains/AVR.h"
 #include "ToolChains/Ananas.h"
@@ -4699,6 +4700,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args,
   auto &TC = ToolChains[Target.str()];
   if (!TC) {
 switch (Target.getOS()) {
+case llvm::Triple::AIX:
+  TC = std::make_unique(*this, Target, Args);
+  break;
 case llvm::Triple::Haiku:
   TC = std::make_unique(*this, Target, Args);
   break;

diff  --git a/clang/lib/Driver/ToolChains/AIX.cpp 
b/clang/lib/Driver/ToolChains/AIX.cpp
new file mode 100644
index ..369a5fc17c91
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/AIX.cpp
@@ -0,0 +1,101 @@
+//===--- AIX.cpp - AIX ToolChain Implementations *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "AIX.h"
+#include "Arch/PPC.h"
+#include "CommonArgs.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+
+namespace aix = clang::driver::tools::aix;
+using AIX = clang::driver::toolchains::AIX;
+
+using namespace llvm::opt;
+
+void aix::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+   const InputInfo &Output,
+   const InputInfoList &Inputs, const ArgList 
&Args,
+   const char *LinkingOutput) const {
+  const AIX &ToolChain = static_cast(getToolChain());
+  ArgStringList CmdArgs;
+
+  const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
+  const bool IsArch64Bit = ToolChain.getTriple().isArch64Bit();
+  // Only support 32 and 64 bit.
+  if (!(IsArch32Bit || IsArch64Bit))
+llvm_unreachable("Unsupported bit width value.");
+
+  // Force static linking when "-static" is present.
+  if (Args.hasArg(options::OPT_static))
+CmdArgs.push_back("-bnso");
+
+  // Specify linker output file.
+  assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
+  if (Output.isFilename()) {
+CmdArgs.push_back("-o");
+CmdArgs.push_back(Output.getFilename());
+  } 
+
+  // Set linking mode (i.e., 32/64-bit) and the address of
+  // text and data sections based on arch bit width.
+  if (IsArch32Bit) {
+CmdArgs.push_back("-b32");
+CmdArgs.push_back("-bpT:0x1000");
+CmdArgs.push_back("-bpD:0x2000");
+  } else {
+// Must be 64-bit, otherwise asserted already.
+CmdA

r362808 - Build with _XOPEN_SOURCE defined on AIX

2019-06-08 Thread David Tenty via cfe-commits
Author: daltenty
Date: Fri Jun  7 08:45:25 2019
New Revision: 362808

URL: http://llvm.org/viewvc/llvm-project?rev=362808&view=rev
Log:
Build with _XOPEN_SOURCE defined on AIX

Summary:
It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined
on AIX with a few exceptions. Google Test internals require access to
platform specific thread info constructs on AIX so in that case we build
with _ALL_SOURCE defined instead. Libclang also uses header which needs
_ALL_SOURCE on AIX so we leave that as is as well.

We also add building on AIX with the large file API and doing CMake
header checks with X/OPEN definitions so the results are consistent with
the environment that will be present in the build.

Reviewers: hubert.reinterpretcast, xingxue, andusy

Reviewed By: hubert.reinterpretcast

Subscribers: mgorny, jsji, cfe-commits, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D62533

Modified:
cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=362808&r1=362807&r2=362808&view=diff
==
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Fri Jun  7 08:45:25 2019
@@ -89,6 +89,11 @@ else()
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits