[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

In D68340#1720362 , @Yi-Hong.Lyu wrote:

> Seems this commit broke the buildbot 
> http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6806


@daltenty's patch rG201ed14aea8c 
 should 
fix the problem. In the latest build 
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6813, 
`AIX.cpp.o` has been successfully generated. Thanks for letting us know.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Yi-Hong Lyu via Phabricator via cfe-commits
Yi-Hong.Lyu added a comment.

Seems this commit broke the buildbot 
http://lab.llvm.org:8011/builders/ppc64le-lld-multistage-test/builds/6806


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbb6a27fc257f: Add AIX toolchain and basic linker 
functionality (authored by stevewan, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 2 inline comments as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:59
+
+  auto getCrt0Basename = [, ] {
+// Enable gprofiling when "-pg" is specified.

jasonliu wrote:
> nit: There is no need to capture IsArch32Bit by reference. 
Agreed. It's safer to capture IsArch32Bit by value here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 226304.
stevewan added a comment.

Capture local variable IsArch32Bit by value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-bnso"
+// CHECK-LD32-PROF: "-b32" 
+// CHECK-LD32-PROF: "-bpT:0x1000" 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-24 Thread Jason Liu via Phabricator via cfe-commits
jasonliu accepted this revision.
jasonliu added a comment.
This revision is now accepted and ready to land.

Aside from the nit comment that can be addressed when checkin. 
LGTM.




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:59
+
+  auto getCrt0Basename = [, ] {
+// Enable gprofiling when "-pg" is specified.

nit: There is no need to capture IsArch32Bit by reference. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-23 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 226170.
stevewan added a comment.

Avoid blank else block when assertion is off


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-bnso"
+// CHECK-LD32-PROF: "-b32" 
+// CHECK-LD32-PROF: "-bpT:0x1000" 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-23 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 3 inline comments as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/CMakeLists.txt:33
   ToolChains/Arch/X86.cpp
+  ToolChains/AIX.cpp
   ToolChains/Ananas.cpp

jasonliu wrote:
> Looks like this list is following alphabetical order here, which means we 
> should probably put "ToolChains/AIX.cpp" right after "ToolChain.cpp".
I had the same doubt when I added it. There is definitely an alphabetical 
order, yet I found the distinction between Arch and OS took precedence. As we 
could see that the "n" in "Ananas" and "M" in "AMDGPU" would have both came 
before the "r" in "Arch" if they only followed alphabetical order. That said, 
we could still consider moving all three but that might be an unnecessary 
hassle, and having OS followed by Arch and back to OS seems a bit 
counter-intuitive after all.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-23 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/Driver/CMakeLists.txt:33
   ToolChains/Arch/X86.cpp
+  ToolChains/AIX.cpp
   ToolChains/Ananas.cpp

Looks like this list is following alphabetical order here, which means we 
should probably put "ToolChains/AIX.cpp" right after "ToolChain.cpp".


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-22 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

stevewan wrote:
> jasonliu wrote:
> > Xiangling_L wrote:
> > > Is there any reason to use llvm_unreachable here? I think we should use  
> > > 'assertion' instead here:
> > > 
> > > ```
> > > assert((IsArch32Bit || IsArch64Bit) && "...");
> > > ```
> > IsArch64Bit used only in the assertion could cause warning when the 
> > assertion is turned off. 
> Jason has provided a good point why `llvm_unreachable` was preferred here. 
> Other than that, I believe the two are fairly interchangeable in this 
> particular case. That said, I'm leaning towards keeping `llvm_unreachable`, 
> but definitely add more comment if you have good reasons for using `assert`. 
> Thanks!
Jason is right, I am fine with keeping `llvm_unreachable`.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:44
+  } else {
+assert(Output.isNothing() && "Invalid output.");
+  }

Glad to know the build without assertion on would not be affected by this. I 
just have slight preference that we don't have this blank block in our product 
code when the assertion is off. Is that better we put this assertion before 
`if` block, and do something like this;

```
assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");

if (Output.isFilename()) {
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());
  } 
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-21 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

jasonliu wrote:
> Xiangling_L wrote:
> > Is there any reason to use llvm_unreachable here? I think we should use  
> > 'assertion' instead here:
> > 
> > ```
> > assert((IsArch32Bit || IsArch64Bit) && "...");
> > ```
> IsArch64Bit used only in the assertion could cause warning when the assertion 
> is turned off. 
Jason has provided a good point why `llvm_unreachable` was preferred here. 
Other than that, I believe the two are fairly interchangeable in this 
particular case. That said, I'm leaning towards keeping `llvm_unreachable`, but 
definitely add more comment if you have good reasons for using `assert`. Thanks!



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:54
+  } else {
+assert(Output.isNothing() && "Invalid output.");
+  }

Xiangling_L wrote:
> I am not sure, if we compile with assertion off, does this extra 'else' {} 
> have any side effect?
As per my tests with assertion-off build, I found no side effect and/or 
unexpected behaviour caused by this. There was no warning or anything 
unexpected that would've not appeared when assertion is on.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:74
+if (Args.hasArg(options::OPT_pg))
+  crt0 = IsArch32Bit ? "gcrt0.o" : "gcrt0_64.o";
+// Enable profiling when "-p" is specified

hubert.reinterpretcast wrote:
> For 32-bit mode, there is a "reentrant" variant for when `-pthread` or 
> `-pthreads` is specified.
The `crt0_r.o` has become a symlink to `crt0.o`, we don't need to add extra 
handling for it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-21 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 225925.
stevewan marked 8 inline comments as done.
stevewan added a comment.

Tidy code with lambda expression


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-bnso"
+// CHECK-LD32-PROF: "-b32" 
+// 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-18 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 225631.
stevewan marked 25 inline comments as done.
stevewan added reviewers: jasonliu, Xiangling_L.
stevewan added a comment.

Fix periods at the end of comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-18 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.h:19
+
+/// aix -- Directly call system default and linker.
+// TODO: Enable direct call to system default assembler.

remove "and".



Comment at: clang/lib/Driver/ToolChains/AIX.h:36
+
+} // end namespace aix.
+

Sorry, I don't think we need '.' for any of the "end namespace ..." comment. 



Comment at: clang/lib/Driver/ToolChains/AIX.h:63
+
+#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_AIX_H.

We don't need '.' here as well. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-17 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 225521.
stevewan added a comment.

Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,177 @@
+// General tests that ld invocations on AIX targets are sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-NOT: "-bnso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-NOT: "-bnso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD-NOT: "-bnso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD-NOT: "-bnso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PROF: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PROF: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PROF-NOT: "-bnso"
+// CHECK-LD32-PROF: "-b32" 
+// CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000" 
+// 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-12 Thread Hubert Tong via Phabricator via cfe-commits
hubert.reinterpretcast added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:1
+//===--- AIX.cpp - AIX ToolChain Implementations *- C++ -*-===//
+//

See Jason's comment about the line length.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:21
+using namespace clang;
+using namespace llvm::opt;
+

The name lookup rules should be sufficient to avoid needing so many using 
directives.

Try:
```
namespace aix = clang::driver::tools::aix;
using AIX = clang::driver::toolchains::AIX;

using namespace llvm::opt;
```




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:24
+void aix::Linker::ConstructJob(Compilation , const JobAction ,
+   const InputInfo ,
+   const InputInfoList ,

See the comment regarding `clang-format`.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:34
+  const bool IsArch64Bit = ToolChain.getTriple().isArch64Bit();
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)

Periods at the end of sentences in comments please. Please update the comments 
in this patch.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:36
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");
+

Add a period to the end of the sentence.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:38
+
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+CmdArgs.push_back("-e");

Xiangling_L wrote:
> Test with Clangtana on terran, when no '-nostdlib' specified, since '-e' & 
> '__start' are the default behavior for AIX system linker, so there are no 
> explicitly '-e' & '__start' found on linker input commanline, so I am 
> wondering do we need to explicitly add them to 'CmdArgs'?
Agreed. It does not seem that the compiler (GCC or XL) passes `-e __start` 
explicitly. This block should be removed.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:57
+
+  // Set linking mode (i.e. 32/64-bit) and the address of
+  // text and data sections based on arch bit width

Add a comma after "i.e.".



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:74
+if (Args.hasArg(options::OPT_pg))
+  crt0 = IsArch32Bit ? "gcrt0.o" : "gcrt0_64.o";
+// Enable profiling when "-p" is specified

For 32-bit mode, there is a "reentrant" variant for when `-pthread` or 
`-pthreads` is specified.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:81
+
+if (crt0)
+  CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath(crt0)));

This is always true. Maybe use a `getCrt0Basename` lambda?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:105
+
+/// AIX - AIX tool chain which can call as(1) and ld(1) directly.
+AIX::AIX(const Driver , const llvm::Triple ,

See comment regarding a TODO.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:107
+AIX::AIX(const Driver , const llvm::Triple ,
+ const ArgList )
+: ToolChain(D, Triple, Args) {

See comment regarding `clang-format`.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:114
+
+Tool *AIX::buildLinker() const { 
+  return new tools::aix::Linker(*this); 

Use a trailing return type to make use of name lookup rules to find `Tool`:
```
auto AIX::buildLinker() const -> Tool * {
```



Comment at: clang/lib/Driver/ToolChains/AIX.h:19
+
+/// aix -- Directly call system default assembler and linker
+namespace aix {

This patch does not cover the assembler as the comment claims. Please add a 
TODO.



Comment at: clang/lib/Driver/ToolChains/AIX.h:35
+} // end namespace aix
+} // end namespace tools
+

I would suggest adding a blank line before closing `tools` and also closing the 
`driver` and `clang` namespaces here. Reopen the latter two in a block with the 
opening of `toolchains` below.



Comment at: clang/lib/Driver/ToolChains/AIX.h:42
+  AIX(const Driver , const llvm::Triple ,
+  const llvm::opt::ArgList );
+  ~AIX() override;

I believe `clang-format` would indent this so that the first character comes 
right after the position of the left parenthesis that opened the parameter list.



Comment at: clang/test/Driver/aix-ld.c:1
+// General tests that ld invocations on AIX targets sane. Note that we use
+// sysroot to make these tests independent of the host system.

Add "are" before "sane".



Comment at: clang/test/Driver/aix-ld.c:3
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.

There seem to be no tests about `nostdlib` 

[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

Xiangling_L wrote:
> Is there any reason to use llvm_unreachable here? I think we should use  
> 'assertion' instead here:
> 
> ```
> assert((IsArch32Bit || IsArch64Bit) && "...");
> ```
IsArch64Bit used only in the assertion could cause warning when the assertion 
is turned off. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:38
+
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+CmdArgs.push_back("-e");

Test with Clangtana on terran, when no '-nostdlib' specified, since '-e' & 
'__start' are the default behavior for AIX system linker, so there are no 
explicitly '-e' & '__start' found on linker input commanline, so I am wondering 
do we need to explicitly add them to 'CmdArgs'?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:47
+  else
+CmdArgs.push_back("-bso");
+

Ditto. Since by default, AIX linker is dynamically linked, '-bso' is implicitly 
set on AIX system linker when testing with Clangtana, so do we need to 
explicitly set '-bso' in LLVM?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-08 Thread Xiangling Liao via Phabricator via cfe-commits
Xiangling_L added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:35
+  // Only support 32 and 64 bit
+  if (!IsArch32Bit && !IsArch64Bit)
+llvm_unreachable("Unsupported bit width value");

Is there any reason to use llvm_unreachable here? I think we should use  
'assertion' instead here:

```
assert((IsArch32Bit || IsArch64Bit) && "...");
```



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:54
+  } else {
+assert(Output.isNothing() && "Invalid output.");
+  }

I am not sure, if we compile with assertion off, does this extra 'else' {} have 
any side effect?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:70
+
+  if (!Args.hasArg(options::OPT_nostdlib)) {
+const char *crt0 = nullptr;

line 38 and line 70 use the same query, should they be put together? Or is 
there any exact order we should follow to push args into 'CmdArgs'?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:93
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs)) {
+// Support POSIX threads if "-pthreads" or 
+// "-pthread" is present

One line of comment can be <= 80 characters.



Comment at: clang/lib/Driver/ToolChains/AIX.h:33
+const char *LinkingOutput) const override;
+};
+} // end namespace aix

An extra blank line preferred below.



Comment at: clang/lib/Driver/ToolChains/AIX.h:43
+  const llvm::opt::ArgList );
+  ~AIX() override;
+

Since we are not doing anything special in AIX toolchain destructor, seems like 
we don't need to override it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-06 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added a comment.

nit: We might want to add period consistently for all the comments in the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-06 Thread Jason Liu via Phabricator via cfe-commits
jasonliu added a comment.

Any reason we are testing library search path using libgcc.a? We could use any 
dummy path there, and upload a dummy archive library for the testing purpose.




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:112
+
+AIX::~AIX() {}
+

We are not doing anything with the destructor. Do we need to declare and define 
it?



Comment at: clang/lib/Driver/ToolChains/AIX.h:1
+//===--- AIX.h - AIX ToolChain Implementations --*- C++ -*-===//
+//

The length of this line should match with line 7. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340



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


[PATCH] D68340: Add AIX toolchain and basic linker functionality

2019-10-02 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
Herald added subscribers: cfe-commits, jsji, jfb, kbarton, mgorny, nemanjai.
Herald added a project: clang.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68340

Files:
  clang/lib/Driver/CMakeLists.txt
  clang/lib/Driver/Driver.cpp
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  
clang/test/Driver/Inputs/aix_ppc_tree/gcc/powerpc-ibm-aix7.1.0.0/6.3.0/libgcc.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

Index: clang/test/Driver/aix-ld.c
===
--- /dev/null
+++ clang/test/Driver/aix-ld.c
@@ -0,0 +1,148 @@
+// General tests that ld invocations on AIX targets sane. Note that we use
+// sysroot to make these tests independent of the host system.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32: "-e" "__start" 
+// CHECK-LD32: "-bso"
+// CHECK-LD32: "-b32" 
+// CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD32: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// 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: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64: "-e" "__start" 
+// CHECK-LD64: "-bso"
+// CHECK-LD64: "-b64" 
+// CHECK-LD64: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64: "-L[[SYSROOT]]/usr/lib" 
+// CHECK-LD64: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthread \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PTHREAD %s
+// CHECK-LD32-PTHREAD-NOT: warning:
+// CHECK-LD32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD32-PTHREAD: "-e" "__start" 
+// CHECK-LD32-PTHREAD: "-bso"
+// CHECK-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-PTHREAD: "-lpthreads"
+// CHECK-LD32-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. Enable POSIX thread support with aliased pthreads option
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -pthreads \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-PTHREAD %s
+// CHECK-LD64-PTHREAD-NOT: warning:
+// CHECK-LD64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}" 
+// CHECK-LD64-PTHREAD: "-e" "__start" 
+// CHECK-LD64-PTHREAD: "-bso"
+// CHECK-LD64-PTHREAD: "-b64" 
+// CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000" 
+// CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-PTHREAD: "-lpthreads"
+// CHECK-LD64-PTHREAD: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable profiling
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: -p \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-PROF %s
+// CHECK-LD32-PROF-NOT: warning:
+// CHECK-LD32-PROF: