[PATCH] D97823: [AIX] Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0b274ed49960: [AIX] Update default arch on AIX (authored by 
stevewan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, unused_micro;
+  T.getOSVersion(major, minor, unused_micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, unused_micro;
+  T.getOSVersion(major, minor, unused_micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else 

[PATCH] D97823: Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 327825.
stevewan added a comment.

Reflect varible is unused in its name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, unused_micro;
+  T.getOSVersion(major, minor, unused_micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, unused_micro;
+  T.getOSVersion(major, minor, unused_micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";

[PATCH] D97823: Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:403
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);

jsji wrote:
> `micro` unsed.
Sorry I missed this comment. I agree that the unused `micro` is a bit ugly, do 
you have a preference on how you'd like it to be improved? We don't have an 
existing query for only `major` and `minor`, and creating one seems unnecessary 
IMHO. If you think renaming the variable to `unused_micro` mitigates the 
problem, I can do that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

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


[PATCH] D97823: Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 327803.
stevewan added a comment.

Improve handling different AIX versions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,14 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName =
+  (major < 7 || (major == 7 && minor < 2)) ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";
___
cfe-commits 

[PATCH] D97823: Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 327798.
stevewan added a comment.

Address comments with regard to handling older AIX versions.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,13 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName = major < 7 || minor < 2 ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,13 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  // The minimal arch level moved from pwr4 for AIX7.1 to
+  // pwr7 for AIX7.2.
+  TargetCPUName = major < 7 || minor < 2 ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[PATCH] D97823: Update default arch on AIX

2021-03-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:405
+  T.getOSVersion(major, minor, micro);
+  TargetCPUName = major == 7 && minor < 2 ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)

jsji wrote:
> jsji wrote:
> > Please add comments here about AIX 7.2's minimal arch is P7.
> `major == 7 ` should this be `major <= 7 `? Or else, we may get `pwr7` for 
> AIX 5.1.
That's a great idea. Although I think we'd need to change `major == 7 && minor 
< 2` to `major < 7 || minor < 2` to also handle 4.3 and 5.3 properly. Let me 
know if you have further comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97823

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


[PATCH] D97823: Update default arch on AIX

2021-03-02 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
stevewan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

On AIX, the default arch level should match the minimum supported arch level of 
the OS version


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97823

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,11 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  TargetCPUName = major == 7 && minor < 2 ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";


Index: clang/test/Driver/aix-mcpu-default.c
===
--- clang/test/Driver/aix-mcpu-default.c
+++ clang/test/Driver/aix-mcpu-default.c
@@ -1,10 +1,18 @@
-// Check that the target cpu defaults to power4 on AIX.
+// Check that the target cpu defaults to power7 on AIX7.2 and up.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
-// RUN:-target powerpc-ibm-aix \
-// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
-// CHECK-MCPU-DEFAULT-NOT: warning:
-// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
-// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+// RUN:-target powerpc-ibm-aix7.2 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX72 %s
+// CHECK-MCPU-DEFAULT-AIX72-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX72: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX72: "-target-cpu" "pwr7"
+
+// Check that the target cpu defaults to power4 on AIX7.1 and below.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix7.1 \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT-AIX71 %s
+// CHECK-MCPU-DEFAULT-AIX71-NOT: warning:
+// CHECK-MCPU-DEFAULT-AIX71: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT-AIX71: "-target-cpu" "pwr4"
 
 // Check that the user is able to overwrite the default with '-mcpu'.
 // RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -399,9 +399,11 @@
 if (!TargetCPUName.empty())
   return TargetCPUName;
 
-if (T.isOSAIX())
-  TargetCPUName = "pwr4";
-else if (T.getArch() == llvm::Triple::ppc64le)
+if (T.isOSAIX()) {
+  unsigned major, minor, micro;
+  T.getOSVersion(major, minor, micro);
+  TargetCPUName = major == 7 && minor < 2 ? "pwr4" : "pwr7";
+} else if (T.getArch() == llvm::Triple::ppc64le)
   TargetCPUName = "ppc64le";
 else if (T.getArch() == llvm::Triple::ppc64)
   TargetCPUName = "ppc64";
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D83055: [clang][Driver] Fix tool path priority test failures

2020-07-13 Thread Steven Wan via Phabricator via cfe-commits
stevewan accepted this revision.
stevewan added a comment.
This revision is now accepted and ready to land.

This LGTM, but since I'm not most familiar with the type 1 failure in 
description, let's see if other reviewers have further comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83055



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


[PATCH] D83055: [clang][Driver] Fix tool path priority test failures

2020-07-10 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/test/Driver/program-path-priority.c:117
+/// Check file exists first in case $DEFAULT_TRIPLE == %target_triple
+// RUN: file -E %t/$DEFAULT_TRIPLE-gcc 2>&1 > /dev/null && \
+// RUN:   mv %t/$DEFAULT_TRIPLE-gcc  %t/prefix || true

DavidSpickett wrote:
> stevewan wrote:
> > Maybe I'm not seeing something obvious here, but I'm not aware of the `file 
> > -E` usage, and on Linux I got `file: invalid option -- 'E'`.
> I was looking for a way to mimic [! -f ], which worked on the command 
> line but not in a test. From my system's file:
> -E  On filesystem errors (file not found etc), instead of handling 
> the error as regu‐
>  lar output as POSIX mandates and keep going, issue an error 
> message and exit.
> 
> I didn't realise it was non-standard, so I've switched to mv || true with the 
> error redirected so it won't confuse the verbose output.
I believe having just `mv || true` works, but I did like the idea of 
pre-checking for the existence of the file, and the test is more robust with 
the check. Is there a reason we wouldn't use `test -f` here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83055



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


[PATCH] D83055: [clang][Driver] Fix tool path priority test failures

2020-07-09 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/test/Driver/program-path-priority.c:117
+/// Check file exists first in case $DEFAULT_TRIPLE == %target_triple
+// RUN: file -E %t/$DEFAULT_TRIPLE-gcc 2>&1 > /dev/null && \
+// RUN:   mv %t/$DEFAULT_TRIPLE-gcc  %t/prefix || true

Maybe I'm not seeing something obvious here, but I'm not aware of the `file -E` 
usage, and on Linux I got `file: invalid option -- 'E'`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83055



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


[PATCH] D79842: [clang][Driver] Correct tool search path priority

2020-07-08 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

In D79842#2138857 , @DavidSpickett 
wrote:

> Right, I see the issue.
>
> The code that gets the default triple name 
> (https://reviews.llvm.org/D13340?id=36227#inline-108606) looks up the one you 
> have in cmake, not the actual default which you get in --version. We could 
> "fix" this by doing so when we make the tool name as well, but this breaks 
> whatever mips toolchain was using that. (their tools won't be 
> mips-unknown-elf-)
>
> So yes it looks up powerpc64le-linux-gnu but shows 
> powerpc64le-unknown-linux-gnu. Can't go back to using cmake's value because 
> on Mac OS, cmake has x86_64-darwin, clang has x86_64-darwin. Writing 
> to both is a short term option so I will try that and fold it into 
> https://reviews.llvm.org/D83055. (will add you on review once I update it)
>
> (this whole default triple lookup should probably go but I'd really like to 
> do that in its own commit)


Thanks. @DavidSpickett


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79842



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


[PATCH] D79842: [clang][Driver] Correct tool search path priority

2020-07-07 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

Yes, this issue was hit with the reland applied. When given a 
`--` format LLVM_DEFAULT_TARGET_TRIPLE, Clang would expand the 
target triple to `---`, and therefore causes the name 
mismatch between what the driver searches for and what the test case creates as 
the dummy tool.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79842



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


[PATCH] D79842: [clang][Driver] Correct tool search path priority

2020-07-06 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

The test was failing on Linux if I set LLVM_DEFAULT_TARGET_TRIPLE. For example 
if I set it to`powerpc64le-linux-gnu` clang actually uses 
"powerpc64le-unknown-linux-gnu".

Would you be able to provide a fix to this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79842



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


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-07-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan accepted this revision.
stevewan added a comment.

LGTM with minor nit.

I took a look at the failed tests in premerge checks, they didn't seem to be 
related, but please double check before you commit.




Comment at: clang/lib/Driver/ToolChains/AIX.cpp:195
+  // Return if -nostdlibinc is specified as a driver option.
+  if (DriverArgs.hasArg(options::OPT_nostdlibinc))
+return;

Can we rewrite this block of code so that it's in consistent with the previous 
one?
```
  if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) {
// Add /usr/include.
SmallString<128> UP(Sysroot);
path::append(UP, "/usr/include");
addSystemInclude(DriverArgs, CC1Args, UP.str());
  }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82677



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


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-06-26 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:167
 
+void AIX::AddClangSystemIncludeArgs(const ArgList ,
+ArgStringList ) const {

stevewan wrote:
> I don't think this is the revision you intended to post.
This is a stale comment, please ignore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82677



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


[PATCH] D82677: [Clang] Handle AIX Include management in the driver

2020-06-26 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:167
 
+void AIX::AddClangSystemIncludeArgs(const ArgList ,
+ArgStringList ) const {

I don't think this is the revision you intended to post.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82677



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


[PATCH] D81115: [PowerPC] Do not special case Darwin on PowerPC in target cpu handling

2020-06-05 Thread Steven Wan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG61cd264068ee: [PowerPC] Do not special case Darwin on 
PowerPC in target cpu handling (authored by stevewan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81115

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,19 +294,19 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
-if (TargetCPUName.empty()) {
-  if (T.isOSAIX())
-TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
-}
+// each architecture. (except on AIX)
+if (!TargetCPUName.empty())
+  return TargetCPUName;
+
+if (T.isOSAIX())
+  TargetCPUName = "pwr4";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else
+  TargetCPUName = "ppc";
+
 return TargetCPUName;
   }
 


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,19 +294,19 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
-if (TargetCPUName.empty()) {
-  if (T.isOSAIX())
-TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
-}
+// each architecture. (except on AIX)
+if (!TargetCPUName.empty())
+  return TargetCPUName;
+
+if (T.isOSAIX())
+  TargetCPUName = "pwr4";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else
+  TargetCPUName = "ppc";
+
 return TargetCPUName;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D81115: [PowerPC] Do not special case Darwin on PowerPC in target cpu handling

2020-06-05 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

The unit test failure (`instrprof-gcov-multithread_fork.test`) in pre merge 
checks is caused by another commit. See 
http://lab.llvm.org:8011/builders/llvm-avr-linux/builds/2205.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81115



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


[PATCH] D80966: [codeview] Put !heapallocsite on calls to operator new

2020-06-05 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

Looks like this has broken the build bot? (see 
http://lab.llvm.org:8011/builders/llvm-avr-linux/builds/2205)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80966



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


[PATCH] D81115: [PowerPC] Do not special case Darwin on PowerPC in target cpu handling

2020-06-04 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 268588.
stevewan added a comment.

Reduce the nested 'if' and reorder it to prefer the more likely case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81115

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,19 +294,19 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
-if (TargetCPUName.empty()) {
-  if (T.isOSAIX())
-TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
-}
+// each architecture. (except on AIX)
+if (!TargetCPUName.empty())
+  return TargetCPUName;
+
+if (T.isOSAIX())
+  TargetCPUName = "pwr4";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else
+  TargetCPUName = "ppc";
+
 return TargetCPUName;
   }
 


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,19 +294,19 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
-if (TargetCPUName.empty()) {
-  if (T.isOSAIX())
-TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
-}
+// each architecture. (except on AIX)
+if (!TargetCPUName.empty())
+  return TargetCPUName;
+
+if (T.isOSAIX())
+  TargetCPUName = "pwr4";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else
+  TargetCPUName = "ppc";
+
 return TargetCPUName;
   }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80835: [AIX] Change the default target CPU to power4 for AIX on Power

2020-06-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:301
+TargetCPUName = "pwr4";
+  else if (!T.isOSDarwin()) {
+if (T.getArch() == llvm::Triple::ppc64)

hubert.reinterpretcast wrote:
> A separate patch may be in order for changing this to take the non-Darwin 
> path without checking.
A separate patch created here, https://reviews.llvm.org/D81115.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80835



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


[PATCH] D81115: [PowerPC] Do not check for non-Darwin in PowerPC target cpu handling

2020-06-03 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
Herald added subscribers: cfe-commits, steven.zhang, shchenz, nemanjai.
Herald added a project: clang.
stevewan added reviewers: hubert.reinterpretcast, daltenty.
Herald added a subscriber: wuzish.

Since Darwin on PowerPC is no longer supported, we'll take the Darwin factor 
out from the code that determines the default target cpu on PowerPC.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81115

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,18 +294,16 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
+// each architecture. (except on AIX)
 if (TargetCPUName.empty()) {
   if (T.isOSAIX())
 TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
+  else if (T.getArch() == llvm::Triple::ppc64)
+TargetCPUName = "ppc64";
+  else if (T.getArch() == llvm::Triple::ppc64le)
+TargetCPUName = "ppc64le";
+  else
+TargetCPUName = "ppc";
 }
 return TargetCPUName;
   }


Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,18 +294,16 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 or Darwin)
+// each architecture. (except on AIX)
 if (TargetCPUName.empty()) {
   if (T.isOSAIX())
 TargetCPUName = "pwr4";
-  else if (!T.isOSDarwin()) {
-if (T.getArch() == llvm::Triple::ppc64)
-  TargetCPUName = "ppc64";
-else if (T.getArch() == llvm::Triple::ppc64le)
-  TargetCPUName = "ppc64le";
-else
-  TargetCPUName = "ppc";
-  }
+  else if (T.getArch() == llvm::Triple::ppc64)
+TargetCPUName = "ppc64";
+  else if (T.getArch() == llvm::Triple::ppc64le)
+TargetCPUName = "ppc64le";
+  else
+TargetCPUName = "ppc";
 }
 return TargetCPUName;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80835: [AIX] Change the default target CPU to power4 for AIX on Power

2020-06-03 Thread Steven Wan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGba4afe6f7a84: [AIX] Change the default target CPU to power4 
for AIX on Power (authored by stevewan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80835

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- /dev/null
+++ clang/test/Driver/aix-mcpu-default.c
@@ -0,0 +1,16 @@
+// Check that the target cpu defaults to power4 on AIX.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
+// CHECK-MCPU-DEFAULT-NOT: warning:
+// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+
+// Check that the user is able to overwrite the default with '-mcpu'.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-mcpu=pwr6 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-USER %s
+// CHECK-MCPU-USER-NOT: warning:
+// CHECK-MCPU-USER: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-USER: "-target-cpu" "pwr6"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,14 +294,18 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 Darwin)
-if (TargetCPUName.empty() && !T.isOSDarwin()) {
-  if (T.getArch() == llvm::Triple::ppc64)
-TargetCPUName = "ppc64";
-  else if (T.getArch() == llvm::Triple::ppc64le)
-TargetCPUName = "ppc64le";
-  else
-TargetCPUName = "ppc";
+// each architecture. (except on AIX or Darwin)
+if (TargetCPUName.empty()) {
+  if (T.isOSAIX())
+TargetCPUName = "pwr4";
+  else if (!T.isOSDarwin()) {
+if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else
+  TargetCPUName = "ppc";
+  }
 }
 return TargetCPUName;
   }


Index: clang/test/Driver/aix-mcpu-default.c
===
--- /dev/null
+++ clang/test/Driver/aix-mcpu-default.c
@@ -0,0 +1,16 @@
+// Check that the target cpu defaults to power4 on AIX.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
+// CHECK-MCPU-DEFAULT-NOT: warning:
+// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+
+// Check that the user is able to overwrite the default with '-mcpu'.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-mcpu=pwr6 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-USER %s
+// CHECK-MCPU-USER-NOT: warning:
+// CHECK-MCPU-USER: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-USER: "-target-cpu" "pwr6"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,14 +294,18 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 Darwin)
-if (TargetCPUName.empty() && !T.isOSDarwin()) {
-  if (T.getArch() == llvm::Triple::ppc64)
-TargetCPUName = "ppc64";
-  else if (T.getArch() == llvm::Triple::ppc64le)
-TargetCPUName = "ppc64le";
-  else
-TargetCPUName = "ppc";
+// each architecture. (except on AIX or Darwin)
+if (TargetCPUName.empty()) {
+  if (T.isOSAIX())
+TargetCPUName = "pwr4";
+  else if (!T.isOSDarwin()) {
+if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else
+  TargetCPUName = "ppc";
+  }
 }
 return TargetCPUName;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80835: [AIX] Change the default target CPU to power4 for AIX on Power

2020-05-29 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
stevewan added reviewers: hubert.reinterpretcast, cebowleratibm, daltenty.

This patch changes the AIX default target CPU to power4 since this is the the 
lowest arch for the lowest OS level supported.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80835

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/aix-mcpu-default.c


Index: clang/test/Driver/aix-mcpu-default.c
===
--- /dev/null
+++ clang/test/Driver/aix-mcpu-default.c
@@ -0,0 +1,16 @@
+// Check that the target cpu defaults to power4 on AIX.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
+// CHECK-MCPU-DEFAULT-NOT: warning:
+// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+
+// Check that the user is able to overwrite the default with '-mcpu'.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-mcpu=pwr6 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-USER %s
+// CHECK-MCPU-USER-NOT: warning:
+// CHECK-MCPU-USER: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-USER: "-target-cpu" "pwr6"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,14 +294,18 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 Darwin)
-if (TargetCPUName.empty() && !T.isOSDarwin()) {
-  if (T.getArch() == llvm::Triple::ppc64)
-TargetCPUName = "ppc64";
-  else if (T.getArch() == llvm::Triple::ppc64le)
-TargetCPUName = "ppc64le";
-  else
-TargetCPUName = "ppc";
+// each architecture. (except on AIX or Darwin)
+if (TargetCPUName.empty()) {
+  if (T.isOSAIX())
+TargetCPUName = "pwr4";
+  else if (!T.isOSDarwin()) {
+if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else
+  TargetCPUName = "ppc";
+  }
 }
 return TargetCPUName;
   }


Index: clang/test/Driver/aix-mcpu-default.c
===
--- /dev/null
+++ clang/test/Driver/aix-mcpu-default.c
@@ -0,0 +1,16 @@
+// Check that the target cpu defaults to power4 on AIX.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-DEFAULT %s
+// CHECK-MCPU-DEFAULT-NOT: warning:
+// CHECK-MCPU-DEFAULT: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-DEFAULT: "-target-cpu" "pwr4"
+
+// Check that the user is able to overwrite the default with '-mcpu'.
+// RUN: %clang -no-canonical-prefixes %s -### -c 2>&1 \
+// RUN:-mcpu=pwr6 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:   | FileCheck --check-prefix=CHECK-MCPU-USER %s
+// CHECK-MCPU-USER-NOT: warning:
+// CHECK-MCPU-USER: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-MCPU-USER: "-target-cpu" "pwr6"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -294,14 +294,18 @@
 std::string TargetCPUName = ppc::getPPCTargetCPU(Args);
 // 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 Darwin)
-if (TargetCPUName.empty() && !T.isOSDarwin()) {
-  if (T.getArch() == llvm::Triple::ppc64)
-TargetCPUName = "ppc64";
-  else if (T.getArch() == llvm::Triple::ppc64le)
-TargetCPUName = "ppc64le";
-  else
-TargetCPUName = "ppc";
+// each architecture. (except on AIX or Darwin)
+if (TargetCPUName.empty()) {
+  if (T.isOSAIX())
+TargetCPUName = "pwr4";
+  else if (!T.isOSDarwin()) {
+if (T.getArch() == llvm::Triple::ppc64)
+  TargetCPUName = "ppc64";
+else if (T.getArch() == llvm::Triple::ppc64le)
+  TargetCPUName = "ppc64le";
+else
+  TargetCPUName = "ppc";
+  }
 }
 return TargetCPUName;
   }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80532: [NFC] Fix formatting for the 'aix-ld.c' test case.

2020-05-26 Thread Steven Wan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa924dac44f31: [NFC] Fix formatting for the 
aix-ld.c test case. (authored by stevewan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80532

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -2,177 +2,177 @@
 // 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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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 \
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN: 

[PATCH] D80532: [NFC] Fix formatting for the 'aix-ld.c' test case.

2020-05-26 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 266263.
stevewan added a comment.

Add the two-space indent before continuations on a pipeine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80532

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -2,177 +2,177 @@
 // 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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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 \
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
+// RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-pthreads \
+// RUN:-target 

[PATCH] D80532: [NFC] Fix formatting for the 'aix-ld.c' test case.

2020-05-25 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 266081.
stevewan added a comment.

Pass 'clang-format' checking.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80532

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -2,177 +2,177 @@
 // 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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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 

[PATCH] D80532: [NFC] Fix formatting for the 'aix-ld.c' test case.

2020-05-25 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
stevewan added reviewers: ZarkoCA, hubert.reinterpretcast, daltenty.
stevewan edited the summary of this revision.

Based on comments received in D80415  
pertinent to test case format, the following fixes are provided to other tests 
in 'aix-ld.c' for the sake of consistency and readability,

- Align flags in RUN directives vertically.
- Align patterns in CHECK directives vertically.
- Remove the ‘-o %t.o’ as it’s unnecessary for tests with ‘-###’.
- Fix typos in comments.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80532

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -2,177 +2,177 @@
 // 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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-LD32-PTHREAD: "-b32" 
+// CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000" 
+// CHECK-LD32-PTHREAD: 

[PATCH] D80532: [NFC] Fix formatting for the 'aix-ld.c' test case.

2020-05-25 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 266070.
stevewan added a comment.

Fix misalignment caused by tab.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80532

Files:
  clang/test/Driver/aix-ld.c

Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -2,177 +2,177 @@
 // 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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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
+// RUN: %clang -no-canonical-prefixes %s -### 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: {{.*}}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-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 

[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-25 Thread Steven Wan via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5bf2409a4e4d: [AIX] Add -bcdtors:all:0:s to 
linker to gather static init functions (authored by stevewan).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 

[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265818.
stevewan added a comment.

Update check prefix based on comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-CXX-ARG-ORDER %s
+
+// CHECK-LD32-CXX-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-CXX-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-CXX-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-CXX-ARG-ORDER: "-b32"
+// CHECK-LD32-CXX-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-CXX-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-CXX-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-CXX-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list

[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

I'm planning to post an NFC patch after this to fix the formatting for existing 
cases in 'aix-ld.c' so that everything is consistent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265813.
stevewan added a comment.

Incorporate the test case into 'aix-ld.c'.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -175,3 +175,21 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib" 
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 3 inline comments as done.
stevewan added inline comments.



Comment at: clang/test/Driver/aix-ld.cpp:2
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \

hubert.reinterpretcast wrote:
> I am wondering if it makes sense to put this into `aix-ld.c`. It helps to 
> demonstrate that the link step behaviour is not determined by the source file 
> name.
> 
> For example, in `hexagon-toolchain-elf.c`:
> ```
> 182 // RUN: %clangxx -### -target hexagon-unknown-elf \
> 183 // RUN:   -ccc-install-dir %S/Inputs/hexagon_tree/Tools/bin \
> 184 // RUN:   -mcpu=hexagonv60 \
> 185 // RUN:   %s 2>&1 \
> 186 // RUN:   | FileCheck -check-prefix=CHECK031 %s
> ```
Yes, it makes sense to show that, and that was my original design. I moved this 
to a separate file to avoid getting a warning because of the inherited 
`CHECK-LD32-ARG-ORDER-NOT: warning:`. I'm now thinking of two ways to 
incorporate this into `aix-ld.c`,
1. Simply remove the warning check like what's done in the example you've 
showed.
2. Change the line `CHECK-LD32-ARG-ORDER-NOT: warning:` into something like,

```
// CHECK-LD32-ARG-ORDER-NOT: warning:
// CHECK-LD32-ARG-ORDER: warning: treating 'c' input as 'c++' when in C++ 
mode, this behavior is deprecated [-Wdeprecated]
// CHECK-LD32-ARG-ORDER-NOT: warning:
```
Do we have a preference for one way over another?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415



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


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265781.
stevewan added a comment.

Address furthur comments on the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{.*}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER-NOT: "-bcdtors:all:0:s"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-22 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 265765.
stevewan added a comment.

Address comments and fix windows compatibility issues with the test case.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,19 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,19 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and argument order.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:  -Wl,-bnocdtors \
+// RUN:  -target powerpc-ibm-aix7.1.0.0 \
+// RUN:  --sysroot %S/Inputs/aix_ppc_tree \
+// RUN: | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+
+// CHECK-LD32-ARG-ORDER-NOT: warning:
+// CHECK-LD32-ARG-ORDER: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-ARG-ORDER: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// CHECK-LD32-ARG-ORDER: "-b32"
+// CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D80415: [AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

2020-05-21 Thread Steven Wan via Phabricator via cfe-commits
stevewan created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
stevewan added reviewers: hubert.reinterpretcast, Xiangling_L, ZarkoCA, 
daltenty.

On AIX, add '-bcdtors:all:0:s' to linker implicitly through driver, so 
that we can collect all static constructor and destructor functions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80415

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


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and Arguemnt order.
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// // RUN: -Wl,-bnocdtors \
+// // RUN: -target powerpc-ibm-aix7.1.0.0 \
+// // RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// // RUN:   | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+// // CHECK-LD32-ARG-ORDER-NOT: warning:
+// // CHECK-LD32-ARG-ORDER: {{.*}}clang++" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// // CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// // CHECK-LD32-ARG-ORDER: "{{.*}}ld"
+// // CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// // CHECK-LD32-ARG-ORDER: "-b32"
+// // CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// // CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// // CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// // CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// // CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// // CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList 
,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 


Index: clang/test/Driver/aix-ld.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-ld.cpp
@@ -0,0 +1,18 @@
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. 'bcdtors' and Arguemnt order.
+// // RUN: %clang++ -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// // RUN: -Wl,-bnocdtors \
+// // RUN: -target powerpc-ibm-aix7.1.0.0 \
+// // RUN: --sysroot %S/Inputs/aix_ppc_tree \
+// // RUN:   | FileCheck --check-prefix=CHECK-LD32-ARG-ORDER %s
+// // CHECK-LD32-ARG-ORDER-NOT: warning:
+// // CHECK-LD32-ARG-ORDER: {{.*}}clang++" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// // CHECK-LD32-ARG-ORDER: "-isysroot" "[[SYSROOT:[^"]+]]"
+// // CHECK-LD32-ARG-ORDER: "{{.*}}ld"
+// // CHECK-LD32-ARG-ORDER-NOT: "-bnso"
+// // CHECK-LD32-ARG-ORDER: "-b32"
+// // CHECK-LD32-ARG-ORDER: "-bpT:0x1000" "-bpD:0x2000"
+// // CHECK-LD32-ARG-ORDER: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// // CHECK-LD32-ARG-ORDER: "-bcdtors:all:0:s"
+// // CHECK-LD32-ARG-ORDER: "-bnocdtors"
+// // CHECK-LD32-ARG-ORDER: "-L[[SYSROOT]]/usr/lib"
+// // CHECK-LD32-ARG-ORDER: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -81,6 +81,7 @@
const InputInfoList , const ArgList ,
const char *LinkingOutput) const {
   const AIX  = static_cast(getToolChain());
+  const Driver  = ToolChain.getDriver();
   ArgStringList CmdArgs;
 
   const bool IsArch32Bit = ToolChain.getTriple().isArch32Bit();
@@ -129,6 +130,12 @@
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }
 
+  // Collect all static constructor and destructor functions in CXX mode. This
+  // has to come before AddLinkerInputs as the implied option needs to precede
+  // any other '-bcdtors' settings or '-bnocdtors' that '-Wl' might forward.
+  if (D.CCCIsCXX())
+CmdArgs.push_back("-bcdtors:all:0:s");
+
   // Specify linker input file(s).
   AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA);
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D74015: [AIX][Frontend] C++ ABI customizations for AIX boilerplate

2020-02-11 Thread Steven Wan via Phabricator via cfe-commits
stevewan added inline comments.



Comment at: clang/lib/CodeGen/ItaniumCXXABI.cpp:520
+
+class XLClangCXXABI final : public ItaniumCXXABI {
+public:

The class name here is inconsistent with how our ABI kind was called 
previously, as David pointed out. Maybe rename the ABI kind `XLClang`? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74015



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


[PATCH] D72736: [AIX] Add improved interface for retrieving load module paths

2020-01-17 Thread Steven Wan via Phabricator via cfe-commits
stevewan added a comment.

Provided that you have squashed all changes into the latest commit in your 
branch, `git diff HEAD^ -U1` should emit the context you need. Adjust the 
number of lines of context accordingly to fit the size of your files.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72736



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


[PATCH] D69620: Add AIX assembler support

2019-12-02 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 231712.
stevewan added a comment.

State in the comment the expectation to driver in handling assembler source 
input when invoking as(1).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  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

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,73 @@
+// General tests that as(1) invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-Xassembler %s
+// CHECK-AS32-Xassembler-NOT: warning:
+// CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-Xassembler: "-a32" 
+// CHECK-AS32-Xassembler: "-u" 
+// CHECK-AS32-Xassembler: "-many"
+// CHECK-AS32-Xassembler: "-w"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-Wa %s
+// CHECK-AS64-Wa-NOT: warning:
+// CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-Wa: "-a64" 
+// CHECK-AS64-Wa: "-u" 
+// CHECK-AS64-Wa: "-many"
+// CHECK-AS64-Wa: "-v"
+// CHECK-AS64-Wa: "-w"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Multiple input files.
+// RUN: %clang -no-canonical-prefixes -### -c \
+// RUN: %S/Inputs/aix_ppc_tree/dummy0.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy1.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy2.s 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-MultiInput %s
+// CHECK-AS32-MultiInput-NOT: warning:
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp

[PATCH] D69620: Add AIX assembler support

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



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:68
+  if (Inputs.size() != 1)
+llvm_unreachable("Invalid number of input files.");
+  const InputInfo  = Inputs[0];

hubert.reinterpretcast wrote:
> `llvm_unreachable` is not the right solution if this can be reached by "user 
> error". We should produce a proper error message.
One risky condition I can think of is the user passes in multiple assembly 
sources to the driver, which may lead to multiple assembler inputs. To verify 
how the driver handles such a case, I added a new test into `aix-as.c` below, 
whose results suggested that this is okay because the driver would invoke `as` 
for each and every input files respectively. Looking into the code, the driver 
would construct an action list for each input files individually, which again 
matches the behaviour we observed in the testing results. That said, I believe 
the `llvm_unreachable` here is indeed not reachable by "user errors" like this, 
and if it triggers, it's likly an internal error. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

2019-11-29 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 231579.
stevewan added a comment.
Herald added subscribers: kbarton, nemanjai.

Add more input file handling

1. Check if the input file is of type Filename or Nothing, throw assertion 
otherwise.
2. Add a test case to verify the correct behaviour of assembler invocation when 
multiple input files are specified by the user.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  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

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,73 @@
+// General tests that as(1) invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-Xassembler %s
+// CHECK-AS32-Xassembler-NOT: warning:
+// CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-Xassembler: "-a32" 
+// CHECK-AS32-Xassembler: "-u" 
+// CHECK-AS32-Xassembler: "-many"
+// CHECK-AS32-Xassembler: "-w"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-Wa %s
+// CHECK-AS64-Wa-NOT: warning:
+// CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-Wa: "-a64" 
+// CHECK-AS64-Wa: "-u" 
+// CHECK-AS64-Wa: "-many"
+// CHECK-AS64-Wa: "-v"
+// CHECK-AS64-Wa: "-w"
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. Multiple input files.
+// RUN: %clang -no-canonical-prefixes -### -c \
+// RUN: %S/Inputs/aix_ppc_tree/dummy0.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy1.s \
+// RUN: %S/Inputs/aix_ppc_tree/dummy2.s 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-MultiInput %s
+// CHECK-AS32-MultiInput-NOT: warning:
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
+// CHECK-AS32-MultiInput: "{{.*}}as{{(.exe)?}}"
+// CHECK-AS32-MultiInput: "-a32"
+// CHECK-AS32-MultiInput: "-u"
+// CHECK-AS32-MultiInput: "-many"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool 

[PATCH] D69620: Add AIX assembler support

2019-11-29 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 231557.
stevewan added a comment.

Correct a typo in a comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-as.c

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,52 @@
+// General tests that as(1) invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-Xassembler %s
+// CHECK-AS32-Xassembler-NOT: warning:
+// CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-Xassembler: "-a32" 
+// CHECK-AS32-Xassembler: "-u" 
+// CHECK-AS32-Xassembler: "-many"
+// CHECK-AS32-Xassembler: "-w"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-Wa %s
+// CHECK-AS64-Wa-NOT: warning:
+// CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-Wa: "-a64" 
+// CHECK-AS64-Wa: "-u" 
+// CHECK-AS64-Wa: "-many"
+// CHECK-AS64-Wa: "-v"
+// CHECK-AS64-Wa: "-w"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -20,6 +20,60 @@
 
 using namespace llvm::opt;
 
+void aix::Assembler::ConstructJob(Compilation , const JobAction ,
+  const InputInfo ,
+  const InputInfoList ,
+  const ArgList ,
+  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. 

[PATCH] D69620: Add AIX assembler support

2019-11-25 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:28
+  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;

stevewan wrote:
> stevewan wrote:
> > Xiangling_L wrote:
> > > The definition of `claimNoWarnArgs` is to suppress warnings for some 
> > > options if they are unused, can you explain a little bit about how did 
> > > you figure out that we don't want warnings for those?
> > > 
> > > Some context of `claimNoWarnArgs`:
> > > 
> > > ```
> > > // Claim options we don't want to warn if they are unused. We do this for
> > > // options that build systems might add but are unused when assembling or 
> > > only
> > > // running the preprocessor for example.
> > > void tools::claimNoWarnArgs(const ArgList ) {
> > >   // Don't warn about unused -f(no-)?lto.  This can happen when we're
> > >   // preprocessing, precompiling or assembling.
> > >   Args.ClaimAllArgs(options::OPT_flto_EQ);
> > >   Args.ClaimAllArgs(options::OPT_flto);
> > >   Args.ClaimAllArgs(options::OPT_fno_lto);
> > > }
> > > ```
> > > 
> > The original reason was that, since we are doing assembling here, and as 
> > stated in `claimNoWarnArgs`, there might be an unused `-f(no-)?lto` when 
> > we're assembling, and we'd like to suppress the warning(s) for that. 
> > 
> > Looking into it, the three options [[ 
> > https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
> >  | `flto`, `fno_lto` ]] , and [[ 
> > https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-flto
> >  | `flto_EQ` ]] are used to enable/disable link time optimization, but LTO 
> > is not supported by the AIX system linker. Driver would just throw error if 
> > the user passes it `-flto` or `-flto=` on AIX, so claiming them or not 
> > currently makes no actual difference as far as I'm concerned. 
> > 
> > That being said, I don't have a strong opinion either way. Let's see how 
> > other people think.
> It's probably also worth mentioning that, adding `claimNoWarnArgs` does not 
> affect those LTO options being parsed and consumed by the driver in 
> `Driver::setLTOMode`.
Turned out `Driver::BuildCompilation` would always call `Driver::setLTOMode`, 
which inherently sets the three LTO options to "claimed". This happens before 
the driver gets to assembler invocation, hence no need to call 
`claimNoWarnArgs` here.

For future reference, I'm also documenting here that `claimNoWarnArgs` was 
added in [[ https://reviews.llvm.org/rL225100 | rL225100 ]], which was 
originally posted to fix build bots that failed due to warnings from unused LTO 
options. `setLTOMode` was introduced months later in [[ 
https://reviews.llvm.org/rL250455 | rL250455 ]], which claims the three LTO 
options during `BuildCompilation`.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:61
+
+  // Specify assembler input file(s).
+  for (const auto  : Inputs)

hubert.reinterpretcast wrote:
> The AIX assembler does not accept more than one input file. If the intent is 
> to let the assembler produce the error message, then I think we should at 
> least have a comment to acknowledge the situation.
Good point. I didn't intend to leave this to assembler. Looking into it, when 
presented multiple assembly sources, the driver would invoke `as` to assemble 
each of the input files individually. This behaviour also matches that of GCC 
and XL. In case something goes wrong and the driver attempts to pass multiple 
input files to `as`, adding a check to guard the number of inputs probably 
makes sense?



Comment at: clang/test/Driver/aix-as.c:31
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-PTHREAD %s
+// CHECK-AS32-PTHREAD-NOT: warning:

hubert.reinterpretcast wrote:
> I am not getting how this block is related to "pthread".
Looks like I copy-pasted the wrong thing while rebasing. Good catch, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

2019-11-25 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 231000.
stevewan marked 12 inline comments as done.
stevewan added a comment.

Remove claimNoWarnArgs, limit the number of input files, and add more comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-as.c

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,52 @@
+// General tests that as(1) invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-Xassembler %s
+// CHECK-AS32-Xassembler-NOT: warning:
+// CHECK-AS32-Xassembler: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-Xassembler: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-Xassembler: "-a32" 
+// CHECK-AS32-Xassembler: "-u" 
+// CHECK-AS32-Xassembler: "-many"
+// CHECK-AS32-Xassembler: "-w"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-Wa %s
+// CHECK-AS64-Wa-NOT: warning:
+// CHECK-AS64-Wa: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-Wa: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-Wa: "-a64" 
+// CHECK-AS64-Wa: "-u" 
+// CHECK-AS64-Wa: "-many"
+// CHECK-AS64-Wa: "-v"
+// CHECK-AS64-Wa: "-w"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -20,6 +20,60 @@
 
 using namespace llvm::opt;
 
+void aix::Assembler::ConstructJob(Compilation , const JobAction ,
+  const InputInfo ,
+  const InputInfoList ,
+  const ArgList ,
+  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");
+  }
+

[PATCH] D69620: Add AIX assembler support

2019-11-20 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:28
+  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;

stevewan wrote:
> Xiangling_L wrote:
> > The definition of `claimNoWarnArgs` is to suppress warnings for some 
> > options if they are unused, can you explain a little bit about how did you 
> > figure out that we don't want warnings for those?
> > 
> > Some context of `claimNoWarnArgs`:
> > 
> > ```
> > // Claim options we don't want to warn if they are unused. We do this for
> > // options that build systems might add but are unused when assembling or 
> > only
> > // running the preprocessor for example.
> > void tools::claimNoWarnArgs(const ArgList ) {
> >   // Don't warn about unused -f(no-)?lto.  This can happen when we're
> >   // preprocessing, precompiling or assembling.
> >   Args.ClaimAllArgs(options::OPT_flto_EQ);
> >   Args.ClaimAllArgs(options::OPT_flto);
> >   Args.ClaimAllArgs(options::OPT_fno_lto);
> > }
> > ```
> > 
> The original reason was that, since we are doing assembling here, and as 
> stated in `claimNoWarnArgs`, there might be an unused `-f(no-)?lto` when 
> we're assembling, and we'd like to suppress the warning(s) for that. 
> 
> Looking into it, the three options [[ 
> https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
>  | `flto`, `fno_lto` ]] , and [[ 
> https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-flto
>  | `flto_EQ` ]] are used to enable/disable link time optimization, but LTO is 
> not supported by the AIX system linker. Driver would just throw error if the 
> user passes it `-flto` or `-flto=` on AIX, so claiming them or not 
> currently makes no actual difference as far as I'm concerned. 
> 
> That being said, I don't have a strong opinion either way. Let's see how 
> other people think.
It's probably also worth mentioning that, adding `claimNoWarnArgs` does not 
affect those LTO options being parsed and consumed by the driver in 
`Driver::setLTOMode`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

2019-11-20 Thread Steven Wan via Phabricator via cfe-commits
stevewan updated this revision to Diff 230360.
stevewan marked an inline comment as done.
stevewan added a comment.

Add "-u" to accept undefined symbol as extern.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-as.c

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,52 @@
+// General tests that as invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-u" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-u" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-PTHREAD %s
+// CHECK-AS32-PTHREAD-NOT: warning:
+// CHECK-AS32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-PTHREAD: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-PTHREAD: "-a32" 
+// CHECK-AS32-PTHREAD: "-u" 
+// CHECK-AS32-PTHREAD: "-many"
+// CHECK-AS32-PTHREAD: "-w"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-PTHREAD %s
+// CHECK-AS64-PTHREAD-NOT: warning:
+// CHECK-AS64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-PTHREAD: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-PTHREAD: "-a64" 
+// CHECK-AS64-PTHREAD: "-u" 
+// CHECK-AS64-PTHREAD: "-many"
+// CHECK-AS64-PTHREAD: "-v"
+// CHECK-AS64-PTHREAD: "-w"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -20,6 +20,52 @@
 
 using namespace llvm::opt;
 
+void aix::Assembler::ConstructJob(Compilation , const JobAction ,
+  const InputInfo ,
+  const InputInfoList ,
+  const ArgList ,
+  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  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 command operates.
+  if (IsArch32Bit) {
+CmdArgs.push_back("-a32");
+  } else {
+// Must be 64-bit, otherwise asserted already.
+CmdArgs.push_back("-a64");
+ 

[PATCH] D69620: Add AIX assembler support

2019-11-20 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked 4 inline comments as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:28
+  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;

Xiangling_L wrote:
> The definition of `claimNoWarnArgs` is to suppress warnings for some options 
> if they are unused, can you explain a little bit about how did you figure out 
> that we don't want warnings for those?
> 
> Some context of `claimNoWarnArgs`:
> 
> ```
> // Claim options we don't want to warn if they are unused. We do this for
> // options that build systems might add but are unused when assembling or only
> // running the preprocessor for example.
> void tools::claimNoWarnArgs(const ArgList ) {
>   // Don't warn about unused -f(no-)?lto.  This can happen when we're
>   // preprocessing, precompiling or assembling.
>   Args.ClaimAllArgs(options::OPT_flto_EQ);
>   Args.ClaimAllArgs(options::OPT_flto);
>   Args.ClaimAllArgs(options::OPT_fno_lto);
> }
> ```
> 
The original reason was that, since we are doing assembling here, and as stated 
in `claimNoWarnArgs`, there might be an unused `-f(no-)?lto` when we're 
assembling, and we'd like to suppress the warning(s) for that. 

Looking into it, the three options [[ 
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto 
| `flto`, `fno_lto` ]] , and [[ 
https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-flto
 | `flto_EQ` ]] are used to enable/disable link time optimization, but LTO is 
not supported by the AIX system linker. Driver would just throw error if the 
user passes it `-flto` or `-flto=` on AIX, so claiming them or not 
currently makes no actual difference as far as I'm concerned. 

That being said, I don't have a strong opinion either way. Let's see how other 
people think.



Comment at: clang/lib/Driver/ToolChains/AIX.h:26
+
+  bool hasIntegratedCPP() const override { return false; }
+

daltenty wrote:
> stevewan wrote:
> > Xiangling_L wrote:
> > > I saw a lot of other target also set `hasIntegratedCPP()` as false, but I 
> > > didn't find any explanation in documentation, so I am curious that what 
> > > this is about?
> > I also failed to find useful resources that explains the purpose of this 
> > function. The main rationales of adding it were essentially that,
> > 1. It's a pure virtual function in the base `Tool` class,
> > 2. Most if not all of other targets had overridden this function such that 
> > it returns false.
> > 
> > I'll leave this comment open, and see if someone could enlighten us. 
> Only "Compiler" tools set hasIntegratedCPP() to true. Looking into it, it 
> seems combineWithPreprocessor() uses this to decide whether the tool supports 
> preprocessor actions so it may fold them in to one step.  I think we are safe 
> leaving this as is.
I checked this function on other targets. As David pointed out, only the 
compiler tools would set hasIntegratedCPP() to true, the assembler and linker 
tools set it to false because they do not support combining with preprocessor 
action.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

2019-11-19 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:45
+  // Acccept any mixture of instructions.
+  CmdArgs.push_back("-many");
+

Xiangling_L wrote:
> GCC invokes system assembler also with options `-mpwr4` and `-u`, I think you 
> need to verify that do we need those? And as far as I can recall, `-mpwr4` is 
> to pick up new version AIX instruction set, and `-u` is to suppress warning 
> for undefined symbols. 90% sure that we need `-mpwr4`(I could be wrong), but 
> not sure about `-u`.
For the `-u` option, I'll be adding it to this patch with a FIXME that we'd 
like to remove it in the future. The rationale is that, since currently we do 
not have the assembly writing ready that writes the extern(s), we'll pass in 
this `-u` to suppress any related warnings. Once the assembly writing is ready, 
we should remove this flag as it potentially covers up for undefined symbols 
that are actually problematic.

For the `-m` option, adding `-many` seemed to be more suitable at the moment. 
During code generation, the compiler should've already guaranteed that it used 
a correct and appropriate instruction set (i.e., conforms to the user specified 
driver option `-mcpu=`). The `-m` assembler option here double checks the same 
thing that's already been checked at codegen. That said, we can just pass in 
`-many` to accept all and rely on codegen to do the checking. On the other 
hand, potential problems might get away with it in one of the two scenarios I 
can think of right now,


  # User passes in a `.s` assembly file that uses instructions from the 
super-set of what's specified in `-mcpu=`. This is mostly on the user side 
because essentially they pass in contradictory inputs that are not going to fly.

  # User passes in a `.c` source file, but codegen hit some issue and falsely 
decides to use a super-set of what's specified in `-mcpu=`. Given that we don't 
have codegen ready yet, we don't know how reliable it might be. I would suggest 
that we keep `-many` as it is for now, and we may change it when needed once we 
are more clear on code generation. 


With regard to GCC's behaviour, GCC would append first `-mpwr4` then `-many` to 
the system assembler, which effectively means adding `-many` solely because the 
last `-m` flag would overwrite all its preceding one(s).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

2019-11-16 Thread Steven Wan via Phabricator via cfe-commits
stevewan marked an inline comment as done.
stevewan added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.h:26
+
+  bool hasIntegratedCPP() const override { return false; }
+

Xiangling_L wrote:
> I saw a lot of other target also set `hasIntegratedCPP()` as false, but I 
> didn't find any explanation in documentation, so I am curious that what this 
> is about?
I also failed to find useful resources that explains the purpose of this 
function. The main rationales of adding it were essentially that,
1. It's a pure virtual function in the base `Tool` class,
2. Most if not all of other targets had overridden this function such that it 
returns false.

I'll leave this comment open, and see if someone could enlighten us. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69620



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


[PATCH] D69620: Add AIX assembler support

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

This is a follow on patch to D68340 . Given 
the AIX toolchain skeleton and system linker support introduced in D68340 
, this patch adds suuport to system assembler 
invocation on AIX.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69620

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/test/Driver/aix-as.c

Index: clang/test/Driver/aix-as.c
===
--- /dev/null
+++ clang/test/Driver/aix-as.c
@@ -0,0 +1,48 @@
+// General tests that as invocations on AIX targets are sane. Note that we
+// only test assembler functionalities in this suite.
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32 %s
+// CHECK-AS32-NOT: warning:
+// CHECK-AS32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32: "-a32" 
+// CHECK-AS32: "-many" 
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64 %s
+// CHECK-AS64-NOT: warning:
+// CHECK-AS64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64: "-a64" 
+// CHECK-AS64: "-many"
+
+
+// Check powerpc-ibm-aix7.1.0.0, 32-bit. -Xassembler  option. 
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Xassembler -w \
+// RUN: -target powerpc-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS32-PTHREAD %s
+// CHECK-AS32-PTHREAD-NOT: warning:
+// CHECK-AS32-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-AS32-PTHREAD: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS32-PTHREAD: "-a32" 
+// CHECK-AS32-PTHREAD: "-many"
+// CHECK-AS32-PTHREAD: "-w"
+
+// Check powerpc-ibm-aix7.1.0.0, 64-bit. -Wa,, option.
+// RUN: %clang -no-canonical-prefixes %s -### -c -o %t.o 2>&1 \
+// RUN: -Wa,-v,-w \
+// RUN: -target powerpc64-ibm-aix7.1.0.0 \
+// RUN:   | FileCheck --check-prefix=CHECK-AS64-PTHREAD %s
+// CHECK-AS64-PTHREAD-NOT: warning:
+// CHECK-AS64-PTHREAD: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-AS64-PTHREAD: "{{.*}}as{{(.exe)?}}" 
+// CHECK-AS64-PTHREAD: "-a64" 
+// CHECK-AS64-PTHREAD: "-many"
+// CHECK-AS64-PTHREAD: "-v"
+// CHECK-AS64-PTHREAD: "-w"
Index: clang/lib/Driver/ToolChains/AIX.h
===
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -16,10 +16,21 @@
 namespace driver {
 namespace tools {
 
-/// aix -- Directly call system default linker.
-// TODO: Enable direct call to system default assembler.
+/// aix -- Directly call system default assembler and linker.
 namespace aix {
 
+class LLVM_LIBRARY_VISIBILITY Assembler : public Tool {
+public:
+  Assembler(const ToolChain ) : Tool("aix::Assembler", "assembler", TC) {}
+
+  bool hasIntegratedCPP() const override { return false; }
+
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
+
 class LLVM_LIBRARY_VISIBILITY Linker : public Tool {
 public:
   Linker(const ToolChain ) : Tool("aix::Linker", "linker", TC) {}
@@ -53,6 +64,7 @@
   bool isPICDefaultForced() const override { return true; }
 
 protected:
+  Tool *buildAssembler() const override;
   Tool *buildLinker() const override;
 };
 
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -20,6 +20,47 @@
 
 using namespace llvm::opt;
 
+void aix::Assembler::ConstructJob(Compilation , const JobAction ,
+  const InputInfo ,
+  const InputInfoList ,
+  const ArgList ,
+  const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  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 command operates.
+  if (IsArch32Bit) {
+CmdArgs.push_back("-a32");
+  } else {
+// Must be 64-bit, otherwise asserted already.
+

[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] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-24 Thread Steven Wan via Phabricator via cfe-commits
stevewan accepted this revision.
stevewan added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69356



___
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 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-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-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] D69271: Add AIX toolchain and basic linker functionality

2019-10-21 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.
stevewan abandoned this revision.
Herald added subscribers: wuzish, ormris.

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/D69271

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" 

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