[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-06-03 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 202822.
daltenty added a comment.

Fix grammar in comments. Fix up the way we define the macros for Google Test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62533

Files:
  clang/tools/libclang/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/utils/unittest/CMakeLists.txt


Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt

[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-06-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362808: Build with _XOPEN_SOURCE defined on AIX (authored by 
daltenty, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62533?vs=202822&id=203563#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D62533

Files:
  cfe/trunk/tools/libclang/CMakeLists.txt
  llvm/trunk/CMakeLists.txt
  llvm/trunk/cmake/config-ix.cmake
  llvm/trunk/utils/unittest/CMakeLists.txt


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  remove_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_ALL_SOURCE")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: cfe/trunk/tools/libclang/CMakeLists.txt
===
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/trunk/cmake/config-ix.cmake
===
--- llvm/trunk/cmake/config-ix.cmake
+++ llvm/trunk/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/trunk/CMakeLists.txt
===
--- llvm/trunk/CMakeLists.txt
+++ llvm/trunk/CMakeLists.txt
@@ -819,6 +819,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the large-file API as well.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: llvm/trunk/utils/unittest/CMakeLists.txt
===
--- llvm/trunk/utils/unittest/CMakeLists.txt
+++ llvm/trunk/utils/unittest/CMakeLists.txt
@@ -28,6 +28,12 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AI

[PATCH] D65688: [AIX][test/Index] Set/propagate AIXTHREAD_STK for AIX

2019-08-06 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rC Clang

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

https://reviews.llvm.org/D65688



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


[PATCH] D62533: Build with _XOPEN_SOURCE defined on AIX

2019-05-28 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, xingxue, andusy.
daltenty added projects: LLVM, clang.
Herald added subscribers: llvm-commits, cfe-commits, jsji, mgorny.

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

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

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62533

Files:
  clang/tools/libclang/CMakeLists.txt
  llvm/CMakeLists.txt
  llvm/cmake/config-ix.cmake
  llvm/utils/unittest/CMakeLists.txt
  llvm/utils/unittest/googletest/src/gtest-port.cc


Index: llvm/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===
--- llvm/cmake/config-ix.cmake
+++ llvm/cmake/config-ix.cmake
@@ -23,6 +23,13 @@
   list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
 endif()
 
+# Do checks with _XOPEN_SOURCE and LARGE FILE API on AIX, as we will build with
+# that too
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
+  list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: llvm/CMakeLists.txt
===
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -858,6 +858,13 @@
 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
 endif()
 
+# Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
+# break things. In this case we need to enable the LARGE FILE API as well
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+  add_definitions("-D_XOPEN_SOURCE=700")
+  add_definitions("-D_LARGE_FILE_API")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so
Index: clang/tools/libclang/CMakeLists.txt
===
--- clang/tools/libclang/CMakeLists.txt
+++ clang/tools/libclang/CMakeLists.txt
@@ -89,6 +89,11 @@
   set(output_name "clang")
 endif()
 
+# libclang requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 add_clang_library(libclang ${ENABLE_SHARED} ${ENABLE_STATIC}
   OUTPUT_NAME ${output_name}
   ${SOURCES}


Index: llvm/utils/unittest/googletest/src/gtest-port.cc
===
--- llvm/utils/unittest/googletest/src/gtest-port.cc
+++ llvm/utils/unittest/googletest/src/gtest-port.cc
@@ -59,6 +59,7 @@
 #endif  // GTEST_OS_QNX
 
 #if GTEST_OS_AIX
+#define _ALL_SOURCE
 # include 
 # include 
 #endif  // GTEST_OS_AIX
Index: llvm/utils/unittest/CMakeLists.txt
===
--- llvm/utils/unittest/CMakeLists.txt
+++ llvm/utils/unittest/CMakeLists.txt
@@ -28,6 +28,11 @@
   add_definitions(-DGTEST_OS_WINDOWS=1)
 endif()
 
+# Google Test requires headers which need _ALL_SOURCE to build on AIX
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
+remove_definitions("-D_XOPEN_SOURCE=700")
+endif()
+
 if(SUPPORTS_VARIADIC_MACROS_FLAG)
   add_definitions("-Wno-variadic-macros")
 endif()
Index: llvm/cmake/config-ix.cmake
===

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

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

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68340

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

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

[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 226319.
daltenty added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Address comments round 1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69356

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


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead 

[PATCH] D69356: [NFC] Rename LLVM_NO_DEAD_STRIP

2019-10-25 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG11c2a85db884: [NFC] Rename LLVM_NO_DEAD_STRIP (authored by 
daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69356

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


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM_NO_DEAD_STRIP is set.
+# flags instead if LLVM_SUPPORT_PLUGINS is set.
 if(NOT CYGWIN AND NOT WIN32)
   if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND
  NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
Index: llvm/cmake/modules/AddLLVM.cmake
===
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -228,7 +228,7 @@
   # to enable. See https://sourceware.org/bugzilla/show_bug.cgi?id=17704.
 endif()
 
-if(NOT LLVM_NO_DEAD_STRIP)
+if(NOT LLVM_SUPPORT_PLUGINS)
   if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
 # ld64's implementation of -dead_strip breaks tools that use plugins.
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
@@ -245,7 +245,7 @@
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,--gc-sections")
   endif()
-else() #LLVM_NO_DEAD_STRIP
+else() #LLVM_SUPPORT_PLUGINS
   if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
  LINK_FLAGS " -Wl,-bnogc")
Index: clang/tools/driver/CMakeLists.txt
===
--- clang/tools/driver/CMakeLists.txt
+++ clang/tools/driver/CMakeLists.txt
@@ -20,9 +20,9 @@
 option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
 
 # Support plugins. This must be before add_clang_executable as it reads
-# LLVM_NO_DEAD_STRIP.
+# LLVM_SUPPORT_PLUGINS.
 if(CLANG_PLUGIN_SUPPORT)
-  set(LLVM_NO_DEAD_STRIP 1)
+  set(LLVM_SUPPORT_PLUGINS 1)
 endif()
 
 if(NOT CLANG_BUILT_STANDALONE)


Index: llvm/tools/opt/CMakeLists.txt
===
--- llvm/tools/opt/CMakeLists.txt
+++ llvm/tools/opt/CMakeLists.txt
@@ -25,7 +25,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(opt
   AnalysisWrappers.cpp
Index: llvm/tools/llc/CMakeLists.txt
===
--- llvm/tools/llc/CMakeLists.txt
+++ llvm/tools/llc/CMakeLists.txt
@@ -20,7 +20,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(llc
   llc.cpp
Index: llvm/tools/bugpoint/CMakeLists.txt
===
--- llvm/tools/bugpoint/CMakeLists.txt
+++ llvm/tools/bugpoint/CMakeLists.txt
@@ -22,7 +22,7 @@
   )
 
 # Support plugins.
-set(LLVM_NO_DEAD_STRIP 1)
+set(LLVM_SUPPORT_PLUGINS 1)
 
 add_llvm_tool(bugpoint
   BugDriver.cpp
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -772,7 +772,7 @@
 # Add flags for add_dead_strip().
 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
 # But MinSizeRel seems to add that automatically, so maybe disable these
-# flags instead if LLVM

[PATCH] D84880: [AIX] Temporarily disable IncrementalProcessingTest partially

2020-07-29 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84880

___
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-02 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM other than minor nit




Comment at: clang/test/Driver/aix-toolchain-include.cpp:13
+
+// Check powerpc-ibm-aix, 64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \

nit: we usually put the 32-bit / 64-bit run lines together before the CHECK 
block for readabliity


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-07-02 Thread David Tenty via Phabricator via cfe-commits
daltenty requested changes to this revision.
daltenty added inline comments.
This revision now requires changes to proceed.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:172
+return;
+
+  const Driver &D = getDriver();

hubert.reinterpretcast wrote:
> Please investigate the handling of `OPT_nostdlibinc`.
If we are looking at this, should we also consider adding `/usr/local/include`?


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-07-03 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM




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;

hubert.reinterpretcast wrote:
> stevewan wrote:
> > 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());
> >   }
> > ```
> I think the current expression with the early exit is friendlier for future 
> expansion. @daltenty, do you have an opinion on this?
I tend to agree, everything below this point should be standard system includes 
that all should get ignored with `nostdlibinc` so I think the early exit makes 
sense.


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-07-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a2f4824cb2d: [Clang] Handle AIX Include management in the 
driver (authored by ShuhongL, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82677

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/test/Driver/aix-toolchain-include.cpp

Index: clang/test/Driver/aix-toolchain-include.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-toolchain-include.cpp
@@ -0,0 +1,136 @@
+// Tests that the AIX toolchain adds system includes to its search path.
+
+// Check powerpc-ibm-aix, 32-bit/64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// CHECK-INTERNAL-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// CHECK-NOSTDINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE-NOT:	"-internal-isystem"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdlibinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// CHECK-NOSTDLIBINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK

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

2020-07-07 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a2f4824cb2d: [Clang] Handle AIX Include management in the 
driver (authored by ShuhongL, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82677

Files:
  clang/lib/Driver/ToolChains/AIX.cpp
  clang/lib/Driver/ToolChains/AIX.h
  clang/lib/Frontend/InitHeaderSearch.cpp
  clang/test/Driver/aix-toolchain-include.cpp

Index: clang/test/Driver/aix-toolchain-include.cpp
===
--- /dev/null
+++ clang/test/Driver/aix-toolchain-include.cpp
@@ -0,0 +1,136 @@
+// Tests that the AIX toolchain adds system includes to its search path.
+
+// Check powerpc-ibm-aix, 32-bit/64-bit.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL-INCLUDE %s
+
+// CHECK-INTERNAL-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[RESOURCE_DIR]]{{(/|)}}include"
+// CHECK-INTERNAL-INCLUDE:	"-internal-isystem" "[[SYSROOT]]/usr/include"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDINC-INCLUDE %s
+
+// CHECK-NOSTDINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-NOSTDINC-INCLUDE-NOT:	"-internal-isystem"
+
+// Check powerpc-ibm-aix, 32-bit/64-bit. -nostdlibinc option.
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// RUN: %clang -### -xc -no-canonical-prefixes %s 2>&1 \
+// RUN:		-target powerpc64-ibm-aix \
+// RUN:		-resource-dir=%S/Inputs/resource_dir \
+// RUN:		--sysroot=%S/Inputs/basic_aix_tree \
+// RUN:		-nostdlibinc \
+// RUN:   | FileCheck -check-prefix=CHECK-NOSTDLIBINC-INCLUDE %s
+
+// CHECK-NOSTDLIBINC-INCLUDE:	{{.*}}clang{{.*}}" "-cc1"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
+// CHECK-NOSTDLIBINC-INCLUDE:	"-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK

[PATCH] D82476: [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting

2020-07-09 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG25ec96d91a3a: [Clang][Driver] Recognize the AIX OBJECT_MODE 
environment setting (authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D82476?vs=273071&id=276803#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82476

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/aix-object-mode.c


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check that setting an OBJECT_MODE converts the AIX triple to the right 
variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck 
-check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck 
-check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG 
%s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid 
setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -475,6 +475,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
+
+  if (ObjectMode.equals("64")) {
+AT = Target.get64BitArchVariant().getArch();
+  } else if (ObjectMode.equals("32")) {
+AT = Target.get32BitArchVariant().getArch();
+  } else {
+D.Diag(diag::err_drv_invalid_object_mode) << ObjectMode;
+  }
+
+  if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
+Target.setArch(AT);
+}
+  }
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
options::OPT_m32, options::OPT_m16);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -509,4 +509,6 @@
   InGroup>;
 
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
+
+def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 }


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check that setting an OBJECT_MODE converts the AIX triple to the right variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck -check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck -check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG %s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -475,6 +475,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::Arc

[PATCH] D81958: [clangd] Add library to semantically strip flags by name.

2020-07-14 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang-tools-extra/clangd/CompileCommands.cpp:15
 #include "clang/Tooling/ArgumentsAdjusters.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Support/Allocator.h"

This breaks the powerpc64le bots. Looks like we aren't linking against Option:

```
CompileCommands.cpp:(.text._ZZN5clang6clangd11ArgStripper8rulesForEN4llvm9StringRefEENK3$_3clEv+0x514c):
 undefined reference to 
`llvm::opt::OptTable::getOption(llvm::opt::OptSpecifier) const'
```

http://lab.llvm.org:8011/builders/clang-ppc64le-rhel/builds/5697/


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81958



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


[PATCH] D82476: [Clang][Driver] Recognize the AIX OBJECT_MODE environment setting

2020-06-24 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, hubert.reinterpretcast, ShuhongL.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

AIX uses an environment variable called OBJECT_MODE to indicate to
utilities in the toolchain whether they should be operating in 32-bit or
64-bit mode. This patch makes the clang driver recognize the current
OBJECT_MODE setting when we are operating with an AIX target and adds a
custom diagnostic for invalid settings.

For more details about OBJECT_MODE on AIX see:

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82476

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/aix-object-mode.c


Index: clang/test/Driver/aix-object-mode.c
===
--- /dev/null
+++ clang/test/Driver/aix-object-mode.c
@@ -0,0 +1,22 @@
+// Check setting an OBJECT_MODE converts the AIX triple to the right variant.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK64 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple | FileCheck 
-check-prefix=CHECK32 %s
+
+// Command-line options win.
+// RUN: env OBJECT_MODE=64 \
+// RUN: %clang -target powerpc64-ibm-aix -print-target-triple -m32 | FileCheck 
-check-prefix=CHECK32 %s
+
+// RUN: env OBJECT_MODE=32 \
+// RUN: %clang -target powerpc-ibm-aix -print-target-triple -m64 | FileCheck 
-check-prefix=CHECK64 %s
+
+// CHECK32: powerpc-ibm-aix
+// CHECK64: powerpc64-ibm-aix
+
+// Emit a diagnostic if there is an invalid mode.
+// RUN: env OBJECT_MODE=31 \
+// RUN: not %clang -target powerpc-ibm-aix 2>&1 | FileCheck -check-prefix=DIAG 
%s
+
+// DIAG: error: OBJECT_MODE setting 31 is not recognized and is not a valid 
setting.
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -474,6 +474,26 @@
   Target.getOS() == llvm::Triple::Minix)
 return Target;
 
+  // On AIX, the env OBJECT_MODE may affect the resulting arch variant.
+  if (Target.isOSAIX()) {
+if (Optional ObjectModeValue =
+llvm::sys::Process::GetEnv("OBJECT_MODE")) {
+  StringRef ObjectMode = *ObjectModeValue;
+  llvm::Triple::ArchType AT = llvm::Triple::UnknownArch;
+
+  if (ObjectMode.equals("64")) {
+AT = Target.get64BitArchVariant().getArch();
+  } else if (ObjectMode.equals("32")) {
+AT = Target.get32BitArchVariant().getArch();
+  } else {
+D.Diag(diag::err_drv_invalid_object_mode) << ObjectMode;
+  }
+
+  if (AT != llvm::Triple::UnknownArch && AT != Target.getArch())
+Target.setArch(AT);
+}
+  }
+
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
   Arg *A = Args.getLastArg(options::OPT_m64, options::OPT_mx32,
options::OPT_m32, options::OPT_m16);
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -509,4 +509,6 @@
   InGroup>;
 
 def err_drv_cannot_mix_options : Error<"cannot specify '%1' along with '%0'">;
+
+def err_drv_invalid_object_mode : Error<"OBJECT_MODE setting %0 is not 
recognized and is not a valid setting.">;
 }


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

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

2020-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:1
+// Tests that aix toolchain adds system includes to the search path
+

nit: aix->AIX
nit: period at end of comment.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:5
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:-resource-dir=%S/Inputs/resource_dir \

I think we should test the 64-bit target as well.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:15
+// RUN: %clangxx -### -no-canonical-prefixes %s 2>&1 \
+// RUN:-target powerpc-ibm-aix \
+// RUN:-resource-dir=%S/Inputs/resource_dir \

Same comment as above


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-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/Driver/aix-toolchain-include.cpp:8
+// RUN:   | FileCheck -check-prefix=CHECK-INTERNAL32-INCLUDE %s
+// CHECK-INTERNAL32-INCLUDE: {{.*}}clang{{.*}}" "-cc1"
+// CHECK-INTERNAL32-INCLUDE: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"

I don't think we need a separate check prefix for 32/64-bit cases, just the RUN 
statements. Since the expected output is the same they can share the same 
prefix.


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] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

2020-04-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:583
+  if (UseSinitAndSterm)
+GlobalUniqueModuleId = getUniqueModuleId(&getModule()).substr(1);
+

if `getUniqueModuleId()` returns an empy string, which it does for modules 
which don't export any symbols, the `substr()` will throw an `OutOfRange` 
exception.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74166



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


[PATCH] D121709: [NFC][AIX] Disable precompiled module file test on AIX

2022-03-15 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121709

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


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

2022-04-19 Thread David Tenty 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 rG2512a875ccac: [clang] Adding Platform/Architecture Specific 
Resource Header Installation… (authored by qiongsiwu1, committed by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123498

Files:
  clang/lib/Headers/CMakeLists.txt

Index: clang/lib/Headers/CMakeLists.txt
===
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -1,19 +1,107 @@
-set(files
-  adxintrin.h
-  altivec.h
-  ammintrin.h
-  amxintrin.h
+# core_files list contains the headers shared by all platforms.
+# Please consider adding new platform specific headers
+# to platform specific lists below.
+set(core_files
+  builtins.h
+  float.h
+  inttypes.h
+  iso646.h
+  limits.h
+  module.modulemap
+  stdalign.h
+  stdarg.h
+  stdatomic.h
+  stdbool.h
+  stddef.h
+  __stddef_max_align_t.h
+  stdint.h
+  stdnoreturn.h
+  tgmath.h
+  unwind.h
+  varargs.h
+  )
+
+set(arm_common_files
+  # Headers shared by Arm and AArch64
   arm_acle.h
+  )
+
+set(arm_only_files
   arm_cmse.h
   armintr.h
+  )
+
+set(aarch64_only_files
   arm64intr.h
+  )
+
+set(cuda_files
+  __clang_cuda_builtin_vars.h
+  __clang_cuda_math.h
+  __clang_cuda_cmath.h
+  __clang_cuda_complex_builtins.h
+  __clang_cuda_device_functions.h
+  __clang_cuda_intrinsics.h
+  __clang_cuda_texture_intrinsics.h
+  __clang_cuda_libdevice_declares.h
+  __clang_cuda_math_forward_declares.h
+  __clang_cuda_runtime_wrapper.h
+  )
+
+set(hexagon_files
+  hexagon_circ_brev_intrinsics.h
+  hexagon_protos.h
+  hexagon_types.h
+  hvx_hexagon_protos.h
+  )
+
+set(hip_files
+  __clang_hip_libdevice_declares.h
+  __clang_hip_cmath.h
+  __clang_hip_math.h
+  __clang_hip_runtime_wrapper.h
+  )
+
+set(mips_msa_files
+  msa.h
+  )
+
+set(opencl_files
+  opencl-c.h
+  opencl-c-base.h
+  )
+
+set(ppc_files
+  altivec.h
+  htmintrin.h
+  htmxlintrin.h
+  )
+
+set(systemz_files
+  s390intrin.h
+  vecintrin.h
+  )
+
+set(ve_files
+  velintrin.h
+  velintrin_gen.h
+  velintrin_approx.h
+  )
+
+set(webassembly_files
+  wasm_simd128.h
+  )
+
+set(x86_files
+# Intrinsics
+  adxintrin.h
+  ammintrin.h
+  amxintrin.h
   avx2intrin.h
   avx512bf16intrin.h
-  avx512bwintrin.h
   avx512bitalgintrin.h
-  avx512vlbitalgintrin.h
+  avx512bwintrin.h
   avx512cdintrin.h
-  avx512vpopcntdqintrin.h
   avx512dqintrin.h
   avx512erintrin.h
   avx512fintrin.h
@@ -21,86 +109,55 @@
   avx512ifmaintrin.h
   avx512ifmavlintrin.h
   avx512pfintrin.h
+  avx512vbmi2intrin.h
   avx512vbmiintrin.h
   avx512vbmivlintrin.h
-  avx512vbmi2intrin.h
-  avx512vlvbmi2intrin.h
   avx512vlbf16intrin.h
+  avx512vlbitalgintrin.h
   avx512vlbwintrin.h
   avx512vlcdintrin.h
   avx512vldqintrin.h
   avx512vlfp16intrin.h
   avx512vlintrin.h
-  avx512vp2intersectintrin.h
+  avx512vlvbmi2intrin.h
+  avx512vlvnniintrin.h
   avx512vlvp2intersectintrin.h
-  avx512vpopcntdqvlintrin.h
   avx512vnniintrin.h
-  avx512vlvnniintrin.h
+  avx512vp2intersectintrin.h
+  avx512vpopcntdqintrin.h
+  avx512vpopcntdqvlintrin.h
   avxintrin.h
   avxvnniintrin.h
   bmi2intrin.h
   bmiintrin.h
-  builtins.h
-  __clang_cuda_builtin_vars.h
-  __clang_cuda_math.h
-  __clang_cuda_cmath.h
-  __clang_cuda_complex_builtins.h
-  __clang_cuda_device_functions.h
-  __clang_cuda_intrinsics.h
-  __clang_cuda_texture_intrinsics.h
-  __clang_cuda_libdevice_declares.h
-  __clang_cuda_math_forward_declares.h
-  __clang_cuda_runtime_wrapper.h
-  __clang_hip_libdevice_declares.h
-  __clang_hip_cmath.h
-  __clang_hip_math.h
-  __clang_hip_runtime_wrapper.h
   cetintrin.h
-  cet.h
   cldemoteintrin.h
-  clzerointrin.h
-  crc32intrin.h
-  cpuid.h
   clflushoptintrin.h
   clwbintrin.h
+  clzerointrin.h
+  crc32intrin.h
   emmintrin.h
   enqcmdintrin.h
   f16cintrin.h
-  float.h
   fma4intrin.h
   fmaintrin.h
   fxsrintrin.h
   gfniintrin.h
-  hexagon_circ_brev_intrinsics.h
-  hexagon_protos.h
-  hexagon_types.h
-  hvx_hexagon_protos.h
   hresetintrin.h
-  htmintrin.h
-  htmxlintrin.h
   ia32intrin.h
   immintrin.h
-  intrin.h
-  inttypes.h
   invpcidintrin.h
-  iso646.h
   keylockerintrin.h
-  limits.h
   lwpintrin.h
   lzcntintrin.h
   mm3dnow.h
   mmintrin.h
-  mm_malloc.h
-  module.modulemap
   movdirintrin.h
-  msa.h
   mwaitxintrin.h
   nmmintrin.h
-  opencl-c.h
-  opencl-c-base.h
+  pconfigintrin.h
   pkuintrin.h
   pmmintrin.h
-  pconfigintrin.h
   popcntintrin.h
   prfchwintrin.h
   ptwriteintrin.h
@@ -108,33 +165,18 @@
   rtmintrin.h
   serializeintrin.h
   sgxintrin.h
-  s390intrin.h
   shaintrin.h
   smmintrin.h
-  stdalign.h
-  stdarg.h
-  stdatomic.h
-  stdbool.h
-  stddef.h
-  __stddef_max_align_t.h
-  stdint.h
-  stdnoreturn.h
   tbmintrin.h
-  tgmath.h
   tmmintrin.h
   tsxldtrkintrin.h
   uintrintrin.h
-  unwind.h
-  vadefs.h
   vaesintrin.h
-  varargs.h
-  v

[PATCH] D123345: Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.

2022-04-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D123345#3460639 , @Jake-Egan wrote:

> Hi, unfortunately there's a build failure on AIX: 
> https://lab.llvm.org/buildbot/#/builders/214/builds/779/steps/9/logs/stdio. 
> Could you take a look?

Hi, any feedback on the AIX break? Seems like this might be non-trivial to 
address (were on an older libc++ level), so perhaps this needs a revert till 
can be worked out.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123345

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


[PATCH] D123345: Treat `std::move`, `forward`, and `move_if_noexcept` as builtins.

2022-04-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Thanks for getting this fixed this so quickly and sorry for the messy revert.

> What you're seeing is a symptom of a libc++ issue (PR12704) that was fixed 
> >10 years ago (rGbff1bfc6be0615ba3036a861fd27b75c96e3297c 
> ). I 
> don't think we have explicit rules on how old a version of libc++ we aim to 
> support, but trying to use version 3.1 or earlier with trunk Clang seems at 
> least a little unreasonable.  That said, it's probably not too hard to work 
> around this, so I will :) but I would encourage whoever is responsible for 
> libc++ in AIX to look into an upgrade!

Yeah, I'd tend to agree with you :) Thanks for accommodating us and identifying 
the libc++ issue as well, we'll definitely be looking into this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123345

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


[PATCH] D122983: [C11/C2x] Change the behavior of the implicit function declaration warning

2022-04-21 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D122983#3464759 , @aaron.ballman 
wrote:

> In D122983#3464724 , @Jake-Egan 
> wrote:
>
>> Hi, we also have a failure on AIX with test-suite `call to undeclared 
>> library function '%0' with type %1; ISO C99 and later`  
>> https://lab.llvm.org/buildbot/#/builders/214/builds/825/steps/9/logs/stdio
>
> Thanks for letting me know, this should now be fixed.

Looks like there are more test-suite case breaking beyond the one you fixed:

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

I suspect there will be more with the scope of this change unfortunately.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122983

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


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

2022-05-11 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd9c1d3cbcb97: [clang][AIX] Don't ignore XCOFF 
visibility by default (authored by daltenty).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D125141?vs=427784&id=428708#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125141

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

Index: clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp
===
--- clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp
+++ clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp
@@ -1,13 +1,13 @@
 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -emit-llvm -o - -x c++ %s  | \
-// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
+// RUN: FileCheck -check-prefix=VISIBILITY-IR %s
 
 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large \
 // RUN:-fvisibility-inlines-hidden -emit-llvm -o - -x c++ %s  | \
-// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
+// RUN: FileCheck -check-prefixes=VISIBILITY-IR,HIDDENINLINE-IR %s
 
 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -fvisibility-inlines-hidden \
 // RUN:-fvisibility default -emit-llvm -o - -x c++ %s  | \
-// RUN: FileCheck -check-prefix=VISIBILITY-IR %s
+// RUN: FileCheck -check-prefixes=VISIBILITY-IR,HIDDENINLINE-IR %s
 
 // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -mignore-xcoff-visibility -emit-llvm \
 // RUN:-fvisibility-inlines-hidden -fvisibility default -o - -x c++ %s  | \
@@ -30,7 +30,7 @@
   return x;
 }
 
-// VISIBILITY-IR: define linkonce_odr hidden void @_Z1fv()
+// HIDDENINLINE-IR: define linkonce_odr hidden void @_Z1fv()
 // NOVISIBILITY-IR:   define linkonce_odr void @_Z1fv()
 
 // VISIBILITY-IR: define linkonce_odr hidden void @_Z3foov()
Index: clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp
===
--- clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp
+++ clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp
@@ -1,8 +1,8 @@
 // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -emit-llvm -o - -x c++ %s  | \
-// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
+// RUN: FileCheck -check-prefix=VISIBILITY-IR %s
 
 // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -emit-llvm -round-trip-args -o - -x c++ %s  | \
-// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
+// RUN: FileCheck -check-prefix=VISIBILITY-IR %s
 
 // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility default -emit-llvm -o - -x c++ %s  | \
 // RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s
Index: clang/lib/Frontend/CompilerInvocation.cpp
===
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3739,28 +3739,7 @@
 Opts.GNUCVersion = Major * 100 * 100 + Minor * 100 + Patch;
   }
 
-  // In AIX OS, the -mignore-xcoff-visibility is enable by default if there is
-  // no -fvisibility=* option.
-  // This is the reason why '-fvisibility' needs to be always generated:
-  // its absence implies '-mignore-xcoff-visibility'.
-  //
-  // Suppose the original cc1 command line does contain '-fvisibility default':
-  // '-mignore-xcoff-visibility' should not be implied.
-  // * If '-fvisibility' is not generated (as most options with default values
-  //   don't), its absence would imply '-mignore-xcoff-visibility'. This changes
-  //   the command line semantics.
-  // * If '-fvisibility' is generated regardless of its presence and value,
-  //   '-mignore-xcoff-visibility' won't be implied and the command line
-  //   semantics are kept intact.
-  //
-  // When the original cc1 command line does **not** contain '-fvisibility',
-  // '-mignore-xcoff-visibility' is implied. The generated command line will
-  // contain both '-fvisibility default' and '-mignore-xcoff-visibility' and
-  // subsequent calls to `CreateFromArgs`/`generateCC1CommandLine` will always
-  // produce the same arguments.
-
-  if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) ||
-  !Args.hasArg(OPT_fvisibility)))
+  if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility)))
 Opts.IgnoreXCOFFVisibility = 1;
 
   if (Args.hasArg(OPT_ftrapv)) {
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/i

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

2022-05-11 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Resolved by https://reviews.llvm.org/D125141


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125141

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


[PATCH] D122519: [NFC][tests][AIX] XFAIL test for lack of visibility support

2022-05-11 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Resolved by https://reviews.llvm.org/D125141


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122519

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


[PATCH] D87904: [AIX][Clang][Driver] Add handling of nostartfiles option

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87904

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
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


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

[PATCH] D87914: [AIX][Clang][Driver] Add handling of shared option

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87914

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
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED: "-bnoentry"
+// CHECK-LD64-SHARED: "-b64"
+// CHECK-LD64-SHARED: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-SHARED: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -92,6 +92,12 @@
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-bnso");
 
+  // Add options for shared libraries.
+  if (Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-bM:SRE");
+CmdArgs.push_back("-bnoentry");
+  }
+
   // Specify linker output file.
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
@@ -123,7 +129,8 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+   options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


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

[PATCH] D87927: [AIX][clang][driver] Make sure ctri.o is linked in C++ mode

2020-09-18 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

since crti is required for functional static initialization.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87927

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
@@ -199,6 +199,7 @@
 // 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: "[[SYSROOT]]/usr/lib{{/|}}crti.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"
@@ -216,6 +217,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD32-CXX-ARG-LCXX: "-lc"
@@ -231,6 +233,7 @@
 // CHECK-LD64-CXX-ARG-LCXX: "-b64"
 // CHECK-LD64-CXX-ARG-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc++"
 // CHECK-LD64-CXX-ARG-LCXX: "-lc"
@@ -247,6 +250,7 @@
 // CHECK-LD32-NODEFLIB-LCXX: "-b32"
 // CHECK-LD32-NODEFLIB-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc++"
 // CHECK-LD32-NODEFLIB-LCXX-NOT: "-lc"
@@ -263,6 +267,7 @@
 // CHECK-LD64-NODEFLIB-LCXX: "-b64"
 // CHECK-LD64-NODEFLIB-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NODEFLIB-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NODEFLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc++"
 // CHECK-LD64-NODEFLIB-LCXX-NOT: "-lc"
@@ -279,6 +284,7 @@
 // CHECK-LD32-NOSTDLIB-LCXX: "-b32"
 // CHECK-LD32-NOSTDLIB-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIB-LCXX-NOT: "-lc"
@@ -295,6 +301,7 @@
 // CHECK-LD64-NOSTDLIB-LCXX: "-b64"
 // CHECK-LD64-NOSTDLIB-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTDLIB-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NOSTDLIB-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIB-LCXX-NOT: "-lc"
@@ -311,6 +318,7 @@
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-b32"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD32-NOSTDLIBXX-LCXX: "-lc"
@@ -327,6 +335,7 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-b64"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTDLIBXX-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
@@ -343,6 +352,7 @@
 // CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
 // CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
@@ -359,6 +369,7 @@
 // CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
 // CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTA

[PATCH] D87904: [AIX][Clang][Driver] Add handling of nostartfiles option

2020-09-21 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG699089f2a970: [AIX][Clang][Driver] Add handling of 
nostartfiles option (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87904

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
@@ -331,6 +331,38 @@
 // CHECK-LD64-NOSTDLIBXX-LCXX-NOT: "-lc++"
 // CHECK-LD64-NOSTDLIBXX-LCXX: "-lc"
 
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD32-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-b32"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-NOSTARTFILES-LCXX  "-lc++"
+// CHECK-LD32-NOSTARTFILES-LCXX: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -nostartfiles.
+// RUN: %clangxx -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-nostartfiles \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-NOSTARTFILES-LCXX %s
+// CHECK-LD64-NOSTARTFILES-LCXX: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-NOSTARTFILES-LCXX: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-b64"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-NOSTARTFILES-LCXX-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc++"
+// CHECK-LD64-NOSTARTFILES-LCXX: "-lc"
+
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. -stdlib=libstdc++ invokes fatal error.
 // RUN: not --crash %clangxx -no-canonical-prefixes %s 2>&1 -### \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -123,7 +123,7 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


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

[PATCH] D87914: [AIX][Clang][Driver] Add handling of shared option

2020-09-21 Thread David Tenty 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 rGd8540427419e: [AIX][Clang][Driver] Add handling of shared 
option (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87914

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
@@ -377,3 +377,37 @@
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD-LIBSTDCXX %s
 // CHECK-LD-LIBSTDCXX: LLVM ERROR: linking libstdc++ unimplemented on AIX
+
+// Check powerpc64-ibm-aix7.1.0.0, 32-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD32-SHARED %s
+// CHECK-LD32-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD32-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD32-SHARED: "-bM:SRE"
+// CHECK-LD32-SHARED: "-bnoentry"
+// CHECK-LD32-SHARED: "-b32"
+// CHECK-LD32-SHARED: "-bpT:0x1000" "-bpD:0x2000"
+// CHECK-LD32-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD32-SHARED: "-lc"
+
+// Check powerpc64-ibm-aix7.1.0.0, 64-bit. -shared.
+// RUN: %clang -no-canonical-prefixes %s 2>&1 -### \
+// RUN:-shared \
+// RUN:-target powerpc64-ibm-aix7.1.0.0 \
+// RUN:--sysroot %S/Inputs/aix_ppc_tree \
+// RUN:   | FileCheck --check-prefix=CHECK-LD64-SHARED %s
+// CHECK-LD64-SHARED: {{.*}}clang{{.*}}" "-cc1" "-triple" 
"powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+// CHECK-LD64-SHARED: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD64-SHARED: "-bM:SRE"
+// CHECK-LD64-SHARED: "-bnoentry"
+// CHECK-LD64-SHARED: "-b64"
+// CHECK-LD64-SHARED: "-bpT:0x1" "-bpD:0x11000"
+// CHECK-LD64-SHARED-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-SHARED: "-L[[SYSROOT]]/usr/lib"
+// CHECK-LD64-SHARED: "-lc"
Index: clang/lib/Driver/ToolChains/AIX.cpp
===
--- clang/lib/Driver/ToolChains/AIX.cpp
+++ clang/lib/Driver/ToolChains/AIX.cpp
@@ -92,6 +92,12 @@
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-bnso");
 
+  // Add options for shared libraries.
+  if (Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-bM:SRE");
+CmdArgs.push_back("-bnoentry");
+  }
+
   // Specify linker output file.
   assert((Output.isFilename() || Output.isNothing()) && "Invalid output.");
   if (Output.isFilename()) {
@@ -123,7 +129,8 @@
   return IsArch32Bit ? "crt0.o" : "crt0_64.o";
   };
 
-  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles)) {
+  if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles,
+   options::OPT_shared)) {
 CmdArgs.push_back(
 Args.MakeArgString(ToolChain.GetFilePath(getCrt0Basename(;
   }


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

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

2020-09-21 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 293262.
daltenty added a comment.

- Check absence in C cases
- Add a note about crti in the nostdlib++ case


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87927

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
@@ -14,6 +14,7 @@
 // CHECK-LD32: "-b32"
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "-lc"
@@ -31,6 +32,7 @@
 // CHECK-LD64: "-b64"
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "-lc"
@@ -49,6 +51,7 @@
 // CHECK-LD32-PTHREAD: "-b32"
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -68,6 +71,7 @@
 // CHECK-LD64-PTHREAD: "-b64"
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -87,6 +91,7 @@
 // CHECK-LD32-PROF: "-b32"
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
+// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "-lc"
@@ -105,6 +110,7 @@
 // CHECK-LD64-GPROF: "-b64"
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
+// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "-lc"
@@ -123,6 +129,7 @@
 // CHECK-LD32-STATIC: "-b32"
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "-lc"
@@ -141,6 +148,7 @@
 // CHECK-LD32-LIBP: "-b32"
 // CHECK-LD32-LIBP: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-LIBP-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
@@ -161,6 +169,7 @@
 // CHECK-LD32-NO-STD-LIB: "-b32"
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -181,6 +190,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-b64"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
@@ -199,6 +209,7 @@
 // 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: "[[SYSROOT]]/usr/lib{{/|}}crti.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"
@@ -216,6 +227,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-CXX-ARG-LCXX: "-L[[SYSROOT]]/usr/lib"

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

2020-09-22 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe8fb4eba4fb6: [AIX][clang][driver] Make sure crti[_64].o is 
linked in C++ mode (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87927

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
@@ -14,6 +14,7 @@
 // CHECK-LD32: "-b32"
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "-lc"
@@ -31,6 +32,7 @@
 // CHECK-LD64: "-b64"
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "-lc"
@@ -49,6 +51,7 @@
 // CHECK-LD32-PTHREAD: "-b32"
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -68,6 +71,7 @@
 // CHECK-LD64-PTHREAD: "-b64"
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -87,6 +91,7 @@
 // CHECK-LD32-PROF: "-b32"
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
+// CHECK-LD32-PROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "-lc"
@@ -105,6 +110,7 @@
 // CHECK-LD64-GPROF: "-b64"
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
+// CHECK-LD64-GPROF-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "-lc"
@@ -123,6 +129,7 @@
 // CHECK-LD32-STATIC: "-b32"
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-STATIC-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "-lc"
@@ -141,6 +148,7 @@
 // CHECK-LD32-LIBP: "-b32"
 // CHECK-LD32-LIBP: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-LIBP-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
@@ -161,6 +169,7 @@
 // CHECK-LD32-NO-STD-LIB: "-b32"
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -181,6 +190,7 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-b64"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
+// CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lpthreads"
@@ -199,6 +209,7 @@
 // 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: "[[SYSROOT]]/usr/lib{{/|}}crti.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"
@@ -216,6 +227,7 @@
 // CHECK-LD32-CXX-ARG-LCXX: "-b32"
 // CHECK-LD32-CXX-ARG-LCXX: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
+// CHECK-LD32-CXX-ARG-LCXX: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHEC

[PATCH] D87451: add new clang option -mno-xcoff-visibility

2020-09-22 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/include/llvm/Target/TargetMachine.h:265
+  /// corresponding to -mno-xcoff-visibility.
+  bool getNoXCOFFVisibility() const { return Options.NoXCOFFVisibility; }
+

This seems like it needs the corresponding comand-line option for llc added and 
an llc test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D88105: [NFC] [PPC] Add PowerPC expected IR tests for C99 complex

2020-09-23 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks.


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

https://reviews.llvm.org/D88105

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


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

2020-09-23 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, hubert.reinterpretcast, jasonliu, 
Xiangling_L.
Herald added subscribers: cfe-commits, dberris.
Herald added a project: clang.
daltenty requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88182

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

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,8 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:		-resource-dir=%S/Inputs/resource_dir | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:		-resource-dir=%S/Inputs/resource_dir   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir/lib/aix/libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir/lib/aix/libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]/lib/aix/libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // 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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // CHECK-LD64-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-

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

2020-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 294053.
daltenty added a comment.

- Fix formating
- Fix typos
- Replace pattern with windows-friendly directory seperators


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88182

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

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir/lib/aix/libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir/lib/aix/libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // 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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // CHECK-LD64-PTHREAD

[PATCH] D87451: add new clang option -mno-xcoff-visibility

2020-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/include/llvm/Target/TargetMachine.h:265
+  /// corresponding to -mno-xcoff-visibility.
+  bool getNoXCOFFVisibility() const { return Options.NoXCOFFVisibility; }
+

DiggerLin wrote:
> jasonliu wrote:
> > DiggerLin wrote:
> > > daltenty wrote:
> > > > This seems like it needs the corresponding comand-line option for llc 
> > > > added and an llc test.
> > > I think it will be in another separate  patch.
> > I would actually prefer to have that in the same patch, as that would give 
> > us a full picture. It's not a huge patch even if we combine them. 
> yes, it is not huge patch, one patch for the clang with option 
> -mno-xcoff-visibility, another patch for llc option -no-xcoff-visibility , I 
> think it is different functionality. and I have post the 
> https://reviews.llvm.org/D88234 "add new option -no-xcoff-visibility for llc"
But the problem is this patch actually introduces the backend functionality 
with no test in the LLVM component itself, because the test here is Clang only. 
Either the patches should be merged so both components get tests in one patch 
or both refactored so we have one llc/LLVM patch and one clang patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-12 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:137
 
-if (D.CCCIsCXX())
+if (D.CCCIsCXX() || D.CCCIsCC())
   CmdArgs.push_back(Args.MakeArgString(

I think that rather that adding CC, we should just pull the if and 
unconditionally link crti.o. This is consistent with what is done on other 
platforms and since the `llvm.global_c/dtors` are generally allowable in the 
IR, we might see them in more than just the two driver scenarios suggested here.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:146
+  // forward.
+  if (D.CCCIsCXX() || D.CCCIsCC())
 CmdArgs.push_back("-bcdtors:all:0:s");

Ditto the previous comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91361

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


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-12 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:137
 
-if (D.CCCIsCXX())
+if (D.CCCIsCXX() || D.CCCIsCC())
   CmdArgs.push_back(Args.MakeArgString(

Xiangling_L wrote:
> daltenty wrote:
> > I think that rather that adding CC, we should just pull the if and 
> > unconditionally link crti.o. This is consistent with what is done on other 
> > platforms and since the `llvm.global_c/dtors` are generally allowable in 
> > the IR, we might see them in more than just the two driver scenarios 
> > suggested here.
> > we should just pull the if and unconditionally link crti.o. ...we might see 
> > them in more than just the two driver scenarios suggested here.
> 
> I was thinking to use the code to document what exactly  happen is under c++ 
> and c mode we link crti.o. But I think it makes sense to just remove `if` as 
> you said. But we can indicate it's something for C and CXX mode only? Cuz as 
> far as I know, there are c++, c, preprocessor, cl and flang driver mode. I 
> think it only make sense for us to see static init functions generated in IR 
> in c++ and c mode on AIX?  
> 
> 
These mode flags don't exactly correspond to input languages though, so it's 
not quite right to say this is "something for C and CXX mode only"  (i.e. CXX 
isn't defined as "C++" mode, it's "behave similar to g++"). 

For example, it seems like if someone tired to link a mixed C and Fortran 
program using --driver-mode=flang, the static init in the C portion would stop 
working because we'd omit crit.o. I don't know if there is an advantage to 
being more specific in this case,  and it definitely seems like it could run us 
into problems.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91361

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


[PATCH] D91361: [AIX][driver] Include crti[_64].o and -bcdtors also for C language link invocations by default

2020-11-13 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


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

https://reviews.llvm.org/D91361

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


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

2020-09-28 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 294822.
daltenty added a comment.

- Remove blankline
- Fix path seperators in second test as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88182

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

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // 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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-PTHREAD-NOT: "-bnso"
@@ -74,17 +85,20 @@
 // C

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

2020-09-28 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGee80615b5c1c: [clang][driver][AIX] Set compiler-rt as 
default rtlib (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88182

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

Index: clang/test/Driver/aix-rtlib.c
===
--- /dev/null
+++ clang/test/Driver/aix-rtlib.c
@@ -0,0 +1,10 @@
+// Check the default rtlib for AIX.
+// RUN: %clang -target powerpc-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK32 %s
+// RUN: %clang -target powerpc64-ibm-aix -print-libgcc-file-name -no-canonical-prefixes \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck -check-prefix=CHECK64 %s
+
+// CHECK32: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc.a
+// CHECK64: resource_dir{{/|\\}}lib{{/|\\}}aix{{/|\\}}libclang_rt.builtins-powerpc64.a
Index: clang/test/Driver/aix-ld.c
===
--- clang/test/Driver/aix-ld.c
+++ clang/test/Driver/aix-ld.c
@@ -3,11 +3,13 @@
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD32 %s
 // CHECK-LD32-NOT: warning:
 // CHECK-LD32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc-ibm-aix7.1.0.0"
+// CHECK-LD32: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-NOT: "-bnso"
@@ -17,15 +19,18 @@
 // CHECK-LD32-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
+// CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-target powerpc64-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_tree \
 // RUN:   | FileCheck --check-prefix=CHECK-LD64 %s
 // CHECK-LD64-NOT: warning:
 // CHECK-LD64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "powerpc64-ibm-aix7.1.0.0"
+// CHECK-LD64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64-NOT: "-bnso"
@@ -35,16 +40,19 @@
 // CHECK-LD64-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
 // CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
+// CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64: "-lc"
 
 // Check powerpc-ibm-aix7.1.0.0, 32-bit. Enable POSIX thread support.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // RUN:-pthread \
 // RUN:-target powerpc-ibm-aix7.1.0.0 \
 // RUN:--sysroot %S/Inputs/aix_ppc_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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD32-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD32-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD32-PTHREAD-NOT: "-bnso"
@@ -54,17 +62,20 @@
 // CHECK-LD32-PTHREAD-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
+// CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
 // CHECK-LD32-PTHREAD: "-lc"
 
 // Check powerpc64-ibm-aix7.1.0.0, 64-bit. POSIX thread alias.
 // RUN: %clang -no-canonical-prefixes %s -### 2>&1 \
+// RUN:-resource-dir=%S/Inputs/resource_dir \
 // 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: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-PTHREAD: "-isysroot" "[[SYSROOT:[^"]+]]"
 // CHECK-LD64-PTHREAD: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD64

[PATCH] D88500: [AIX][Clang][Driver] Link libm along with libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, DiggerLin.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
daltenty requested review of this revision.

since libc++ has dependencies on libm.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88500

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

[PATCH] D88500: [AIX][Clang][Driver] Link libm when we would libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295105.
daltenty added a comment.

- Remove deps comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88500

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

[PATCH] D88500: [AIX][Clang][Driver] Link libm when we would libc++

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295107.
daltenty added a comment.

- Add blank line


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88500

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

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

2020-09-29 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 295111.
daltenty marked an inline comment as done.
daltenty added a comment.

- Make dependant on just c++ mode
- Add missing colons


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88500

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

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

2020-09-30 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGafc277b0ed0d: [AIX][Clang][Driver] Link libm in c++ mode 
(authored by daltenty).

Changed prior to commit:
  https://reviews.llvm.org/D88500?vs=295111&id=295355#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88500

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

[PATCH] D87451: add new option ignore-xcoff-visibility

2020-10-02 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file(XCOFF only)
+

nit: add a space before parens



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file(XCOFF only)
+

daltenty wrote:
> nit: add a space before parens
I don't think the object file writing case was handled yet? This makes it sound 
like it is.



Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5242
 
+  if (const Arg *A = Args.getLastArg(options::OPT_mignore_xcoff_visibility)) {
+if (Triple.isOSAIX())

Use `Args.hasFlag` instead, since this option doesn't have a value we need to 
check.



Comment at: clang/test/CodeGen/aix-ignore-xcoff-visibility.cpp:72
+
+// ERROR: unsupported option '-mignore-xcoff-visibility' for target 
'powerpc-unknown-linux'
+

This isn't being checked anymore, also probably belongs in the other file



Comment at: clang/test/Driver/ignore-xcoff-visibility.cpp:2
+// RUN: %clang -### -target powerpc-unknown-aix  -mignore-xcoff-visibility -S 
%s 2> %t.log
+// RUN: FileCheck -check-prefix=CHECK %s < %t.log
+// CHECK: "-mignore-xcoff-visibility"

We should check the diagnostic here



Comment at: clang/test/Driver/ignore-xcoff-visibility.cpp:3
+// RUN: FileCheck -check-prefix=CHECK %s < %t.log
+// CHECK: "-mignore-xcoff-visibility"

nit: We should constrain this to be following the cc1 invocation


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/CommandFlags.cpp:339
+  "ignore-xcoff-visibility",
+  cl::desc("Not emit the visibility attribute for asm in AIX OS or give "
+   "all symbols 'unspecified' visibility in xcoff object file"),

nit: match description above


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/docs/ClangCommandLineReference.rst:2622
+
+Do not emit any visibility attribute for asm on AIX or give all symbols 
'unspecified' visibility in xcoff object file (XCOFF only)
+

nit: plural. capitalization.



Comment at: clang/include/clang/Driver/Options.td:2566
+def mignore_xcoff_visibility : Flag<["-"], "mignore-xcoff-visibility">, 
Group,
+HelpText<"Not emit the visibility attribute for asm in AIX OS or give all 
symbols 'unspecified' visibility in xcoff object file">,
+  Flags<[CC1Option]>;





Comment at: llvm/lib/CodeGen/CommandFlags.cpp:340
+  cl::desc("Not emit the visibility attribute for asm in AIX OS or give "
+   "all symbols 'unspecified' visibility in xcoff object file"),
+  cl::init(false));

nit: capitalize XCOFF


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D87451: add new option -mignore-xcoff-visibility

2020-10-06 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, other minor nit


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87451

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


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:48
+  const DataLayout &DL = MMI->getModule()->getDataLayout();
+  const unsigned PointerSize = DL.getPointerSizeInBits() == 64 ? 8 : 4;
+

nit: Why not just call `getPointerSize()` instead? (`getPointerSizeInBits()` 
does `getPointerSize()*8` under the hood anyway)


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

https://reviews.llvm.org/D91455

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


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:889
+  CompactUnwindSection =
+  Ctx->getXCOFFSection(".eh_info_table", 
XCOFF::StorageMappingClass::XMC_RW,
+   XCOFF::XTY_SD, SectionKind::getData());

I think this may have been discussed elsewhere, but why do we want to emit this 
as a RW section?


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

https://reviews.llvm.org/D91455

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


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-11-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:889
+  CompactUnwindSection =
+  Ctx->getXCOFFSection(".eh_info_table", 
XCOFF::StorageMappingClass::XMC_RW,
+   XCOFF::XTY_SD, SectionKind::getData());

jasonliu wrote:
> daltenty wrote:
> > I think this may have been discussed elsewhere, but why do we want to emit 
> > this as a RW section?
> Yes, this has been discussed before. And it's a good question.
> If we emit this as an RO section, then we could not put 
> ```
> .vbyte4, GCC_except_table1
> .vbyte4, __xlcxx_personality_v1[DS]
> ```
> into this csect directly. 
> If we do that, we would hit linker error during link time. It seems that for 
> read only csects (RO, PR mapping classes), we could not have relocation types 
> like `R_POS` or `R_NEG` because the result coming out of it is not link-time 
> constant. And the relocation types in read only csects needs to be link time 
> constant.
> 
> Extra work (both compiler and runtime) will be needed if we want to make this 
> RO.
Thanks for clarifying. I guess we'd presumably need to add the TOC indirections 
to get to the LSDA and personality routine's function descriptor,  similar  to 
elsewhere. 

Since this structure is version'd, seems like we have the flexibility to defer 
that work, so I guess that's OK.


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

https://reviews.llvm.org/D91455

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


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-12-01 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:68
+Per = dyn_cast(F.getPersonalityFn()->stripPointerCasts());
+  bool EmitEHBlock =
+  HasLandingPads || (F.hasPersonalityFn() &&

This logic seems very similar to the base class. 

The pattern there and in other instance of EHStreamer seems to be to make these 
queries in beginFunction, store the results in a member and just early exit if 
we have nothing to emit in endFunction, etc. Is that something we should be 
doing here? (e.g. presumably the traceback emission will want to know if we 
plan to emit anything so it can emit the appropriate info)


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

https://reviews.llvm.org/D91455

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


[PATCH] D91455: [XCOFF][AIX] Generate LSDA data and compact unwind section on AIX

2020-12-01 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: llvm/lib/CodeGen/AsmPrinter/AIXException.cpp:68
+Per = dyn_cast(F.getPersonalityFn()->stripPointerCasts());
+  bool EmitEHBlock =
+  HasLandingPads || (F.hasPersonalityFn() &&

jasonliu wrote:
> daltenty wrote:
> > This logic seems very similar to the base class. 
> > 
> > The pattern there and in other instance of EHStreamer seems to be to make 
> > these queries in beginFunction, store the results in a member and just 
> > early exit if we have nothing to emit in endFunction, etc. Is that 
> > something we should be doing here? (e.g. presumably the traceback emission 
> > will want to know if we plan to emit anything so it can emit the 
> > appropriate info)
> I agree that this is a query that we want to share with the traceback table 
> emission. 
> Presumably, we need to do the traceback table emission somewhere in 
> PPCAIXAsmPrinter.
> So that means we would need to have a query that could accessible from 
> PPCAIXAsmPrinter and here. 
> And there are other EHStreamer that have similar queries (but not all of 
> them), so this makes it trickier to get it right if we want to do it for all 
> platforms. 
> I was hoping to address this issue when we actually do the traceback table 
> emission for EH info so that we could keep the scope of the patch reasonable.
Thanks, I think that helps explain the structure here. This should be amenable 
to later refactoring, so that sounds good for now.


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

https://reviews.llvm.org/D91455

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


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/OpenMP/driver-openmp-target.c:2
+// REQUIRES: x86-registered-target
+// REQUIRES: clang-64-bits
+// RUN: %clang %s -c -E -dM -fopenmp=libomp -fopenmp-version=45 
-fopenmp-targets=x86_64-unknown-unknown -o - | FileCheck 
--check-prefix=CHECK-45-VERSION --check-prefix=CHECK-45-VERSION2 %s

This tests still fails on AIX, presumably because we have a 64-bit host but the 
compiler is targeting 32-bit by default:

```
error: OpenMP target architecture 'x86_64-unknown-unknown' pointer size is 
incompatible with host 'powerpc-ibm-aix7.2.0.0'
```

Maybe adjust the test to check the default target instead of just the host?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89696

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


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D89696#2344508 , @jhuber6 wrote:

> @daltenty Do you think this will fix the problem on AIX?

It's not just AIX that will have this problem I suspect. If you configure any 
cross-compiling build with a 64-bit host, targeting a 32-bit arch, your going 
to run into the problem. I think checking against a list of known 64-bit arches 
is good enough for the purposes here, but the check still needs to be against 
the target, not the host.

Also, the frontend diagnostic looks like it is off for the same reason:

  else if (getArchPtrSize(T) != getArchPtrSize(TT))
Diags.Report(diag::err_drv_incompatible_omp_arch)

T seems to be the target triple, not the host, but the diagnostic reads: 
`pointer size is incompatible with host`.




Comment at: clang/test/lit.cfg.py:172
+known_arches = ["x86_64", "mips64", "ppc64", "aarch64"]
+if (config.host_ldflags.find("-m32") < 0
+and any(config.host_triple.startswith(x) for x in known_arches)):

I don't think this check is meaningful. This just checks how llvm was built, it 
doesn't tell you anything about what clang driver is going to target out of the 
box, which is what we care about here.



Comment at: clang/test/lit.cfg.py:174
+and any(config.host_triple.startswith(x) for x in known_arches)):
   config.available_features.add("clang-64-bits")
 

Maybe this should be something like `clang-64-bit-default-target` instead to 
clarify what we mean.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89696

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


[PATCH] D89696: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D89696#2344797 , @jhuber6 wrote:

> In D89696#2344753 , @daltenty wrote:
>
>> In D89696#2344508 , @jhuber6 wrote:
>>
>>> @daltenty Do you think this will fix the problem on AIX?
>>
>> It's not just AIX that will have this problem I suspect. If you configure 
>> any cross-compiling build with a 64-bit host, targeting a 32-bit arch, your 
>> going to run into the problem. I think checking against a list of known 
>> 64-bit arches is good enough for the purposes here, but the check still 
>> needs to be against the target, not the host.
>>
>> Also, the frontend diagnostic looks like it is off for the same reason:
>>
>>   else if (getArchPtrSize(T) != getArchPtrSize(TT))
>> Diags.Report(diag::err_drv_incompatible_omp_arch)
>>
>> T seems to be the target triple, not the host, but the diagnostic reads: 
>> `pointer size is incompatible with host`.
>
> TT is the target triple, otherwise the error message would be backwards, x86 
> is the OpenMP target architecture and PPC is the host architecture. I'm not 
> sure what you mean by checking the target rather than the host. The target is 
> set explicitly by `-fopenmp-targets=`, since it's being set in the 
> test file we try to make sure that the host matches it. If this was just a 
> frontend test we could just specify the host Triple and be done with it. 
> Maybe we could add some CMake options for which offloading libraries were 
> built?

Sorry I think I understand what's maybe happening here. I guess the OpenMP 
terminology here doesn't mesh with really well with the LLVM usages. The term 
"host" seems to be overloaded to mean two different things, either the OpenMP 
host target arch ("OpenMP host") or the arch LLVM was compiled for ("LLVM host 
triple").

So in this case, with AIX we have:

The OpenMP target from commandine is x86
The architecture clang/llvm is compiled for is PPC64 ("LLVM host triple")
The architecture the frontend is set to emit for/target is PPC32 ("OpenMP host 
architecture", "LLVM target triple")

(This is also what makes the diagnostic confusing, is it talking about the 
OpenMP host or the compiler host?)

The lit infrastructure uses the LLVM meaning, so config.host_triple is the 
compiler host, not the LLVM target / OpenMP host architecture. That is what I 
mean when I say "check the target instead", I mean check the LLVM target 
instead of the LLVM host triple.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89696

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


[PATCH] D89904: [OpenMP] Fixing OpenMP/driver.c failing on 32-bit hosts

2020-10-21 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

Thanks! I've verified this fixes the test on AIX.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89904

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


[PATCH] D110431: Explicitly specify -fintegrated-as to clang/test/Driver/compilation_database.c test case.

2021-09-24 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM (without the integrated assembler there will be an assembler invocation in 
the compilation database that actually produces the `.o` instead of the clang 
invocation we are looking for)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110431

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


[PATCH] D110428: [AIX] Define WCHAR_T_TYPE as unsigned short on AIX for wchar.c test case.

2021-10-01 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

This doesn't appear to be true for 64-bit AIX:

  extern "C" int printf(const char *, ...);
  int main() {
  printf("wchar_t: %ld\nunsigned short: 
%ld\n",sizeof(wchar_t),sizeof(unsigned short));
  return 0;
  }
  $ clang++ -m64 foo.cc
  $ ./a.out
  wchar_t: 4
  unsigned short: 2


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110428

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


[PATCH] D111078: [AIX] Enable int128 in 64 bit mode

2021-10-05 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

> Making a change to whether a platform has __int128 affects the ABI of 
> libc++'s std::chrono::file_clock. We should make sure the mitigation patch is 
> posted and accepted.

Good point, but the std::chrono::file_clock interface hasn't shipped yet on the 
platform libc++, since it's currently still at a bit of a backlevel, so I don't 
think that should be blocking to enabling the type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111078

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


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

2021-06-17 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
Herald added subscribers: dexonsmith, dang.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D104484

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/Decl.cpp
  clang/test/Layout/dump-complete.cpp


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | 
FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,11 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx=getASTContext();
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete) {
+const ASTRecordLayout &RL = Ctx.getASTRecordLayout(this);
+  }
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5371,10 +5371,13 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
+  HelpText<"Dump record layout information for all complete types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -266,6 +266,7 @@
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,11 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx=getASTContext();
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete) {
+const ASTRecordLayout &RL = Ctx.getASTRecordLayout(this);
+  }
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Option

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

2021-06-22 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 353636.
daltenty added a comment.

- clang-format
- Address comments


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104484

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/Decl.cpp
  clang/test/Layout/dump-complete.cpp


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | 
FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,13 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx = getASTContext();
+
+  // Layouts are dumped when computed, so if we are dumping for all complete
+  // types, we need to force usage to get types that wouldn't be used 
elsewhere.
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+(void)Ctx.getASTRecordLayout(this);
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5371,10 +5371,13 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
+  HelpText<"Dump record layout information for all complete types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -266,6 +266,7 @@
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,13 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx = getASTContext();
+
+  // Layouts are dumped when computed, so if we are dumping for all complete
+  // types, we need to force usage to get types that wouldn't be used elsewhere.
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+(void)Ctx.getASTRecordLayout(this);
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5371,10 +5371,13 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple f

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

2021-06-22 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7942ebdf01b3: [clang] Add cc1 option for dumping layout for 
all complete types (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104484

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/Decl.cpp
  clang/test/Layout/dump-complete.cpp


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | 
FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,13 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx = getASTContext();
+
+  // Layouts are dumped when computed, so if we are dumping for all complete
+  // types, we need to force usage to get types that wouldn't be used 
elsewhere.
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+(void)Ctx.getASTRecordLayout(this);
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5381,10 +5381,13 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
+  HelpText<"Dump record layout information for all complete types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -265,6 +265,7 @@
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")
 BENIGN_LANGOPT(InlineVisibilityHidden , 1, 0, "hidden visibility for inline 
C++ methods")


Index: clang/test/Layout/dump-complete.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-complete.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-complete %s | FileCheck %s
+
+struct a {
+  int x;
+};
+
+struct b {
+  char y;
+} foo;
+
+class c {};
+
+class d;
+
+// CHECK:  0 | struct a
+// CHECK:  0 | struct b
+// CHECK:  0 | class c
+// CHECK-NOT:  0 | class d
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4581,6 +4581,13 @@
 void RecordDecl::completeDefinition() {
   assert(!isCompleteDefinition() && "Cannot redefine record!");
   TagDecl::completeDefinition();
+
+  ASTContext &Ctx = getASTContext();
+
+  // Layouts are dumped when computed, so if we are dumping for all complete
+  // types, we need to force usage to get types that wouldn't be used elsewhere.
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+(void)Ctx.getASTRecordLayout(this);
 }
 
 /// isMsStruct - Get whether or not this record uses ms_struct layout.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5381,10 +5381,13 @@
 def fdump_record_layouts_simple : Flag<["-"], "

[PATCH] D105112: [clang] Add -fdump-record-layouts-canonical option

2021-06-29 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: stevewan, dexonsmith.
Herald added a subscriber: dang.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This option implies -fdump-record-layouts but dumps record layout information 
with canonical field types, which can be more useful in certain cases when 
comparing structure layouts.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105112

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/test/Layout/dump-canonical.cpp


Index: clang/test/Layout/dump-canonical.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-canonical.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-canonical %s | 
FileCheck %s -check-prefix CANONICAL
+
+typedef long foo_t;
+
+struct a {
+  foo_t x;
+} b;
+
+// CHECK:  0 | foo_t
+// CANONICAL:  0 | long
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3577,7 +3577,10 @@
 } else {
   PrintOffset(OS, FieldOffset, IndentLevel);
 }
-OS << Field.getType().getAsString() << ' ' << Field << '\n';
+const QualType &FieldType = C.getLangOpts().DumpRecordLayoutsCanonical
+? Field.getType().getCanonicalType()
+: Field.getType();
+OS << FieldType.getAsString() << ' ' << Field << '\n';
   }
 
   // Dump virtual bases.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5381,13 +5381,16 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_canonical : Flag<["-"], 
"fdump-record-layouts-canonical">,
+  HelpText<"Dump record layout information with canonical field types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
   HelpText<"Dump record layout information for all complete types">,
   MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath, fdump_record_layouts_canonical.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -265,6 +265,7 @@
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsCanonical , 1, 0, "dumping the AST layout of 
records using canonical field types")
 BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")


Index: clang/test/Layout/dump-canonical.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-canonical.cpp
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-canonical %s | FileCheck %s -check-prefix CANONICAL
+
+typedef long foo_t;
+
+struct a {
+  foo_t x;
+} b;
+
+// CHECK:  0 | foo_t
+// CANONICAL:  0 | long
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3577,7 +3577,10 @@
 } else {
   PrintOffset(OS, FieldOffset, IndentLevel);
 }
-OS << Field.getType().getAsString() << ' ' << Field << '\n';
+const QualType &FieldType = C.getLangOpts().DumpRecordLayoutsCanonical
+? Field.getType().getCanonicalType()
+  

[PATCH] D105242: [clang] Don't emit uninstantiated templates with -fdump-record-layouts-complete

2021-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added a reviewer: stevewan.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

A follow on to D104484 , this blocks the 
emitting of some template cases
where we would hit an assert because though the type was complete,
the class template wasn't fully specialized and adds a test case for the
corresponding test case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D105242

Files:
  clang/lib/AST/Decl.cpp
  clang/test/Layout/dump-complete.cpp


Index: clang/test/Layout/dump-complete.cpp
===
--- clang/test/Layout/dump-complete.cpp
+++ clang/test/Layout/dump-complete.cpp
@@ -12,7 +12,23 @@
 
 class d;
 
+template 
+struct B : public A {};
+
+template 
+struct D : public C {};
+
+template<> struct D;
+
+template 
+struct F : public E {};
+
+F bar;
+
 // CHECK:  0 | struct a
 // CHECK:  0 | struct b
 // CHECK:  0 | class c
 // CHECK-NOT:  0 | class d
+// CHECK-NOT:  0 | struct B
+// CHECK-NOT:  0 | struct D
+// CHECK : 0 | struct F
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4585,7 +4585,9 @@
 
   // Layouts are dumped when computed, so if we are dumping for all complete
   // types, we need to force usage to get types that wouldn't be used 
elsewhere.
-  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete &&
+  (!isa(this) ||
+   !cast(this)->getDescribedClassTemplate()))
 (void)Ctx.getASTRecordLayout(this);
 }
 


Index: clang/test/Layout/dump-complete.cpp
===
--- clang/test/Layout/dump-complete.cpp
+++ clang/test/Layout/dump-complete.cpp
@@ -12,7 +12,23 @@
 
 class d;
 
+template 
+struct B : public A {};
+
+template 
+struct D : public C {};
+
+template<> struct D;
+
+template 
+struct F : public E {};
+
+F bar;
+
 // CHECK:  0 | struct a
 // CHECK:  0 | struct b
 // CHECK:  0 | class c
 // CHECK-NOT:  0 | class d
+// CHECK-NOT:  0 | struct B
+// CHECK-NOT:  0 | struct D
+// CHECK : 0 | struct F
Index: clang/lib/AST/Decl.cpp
===
--- clang/lib/AST/Decl.cpp
+++ clang/lib/AST/Decl.cpp
@@ -4585,7 +4585,9 @@
 
   // Layouts are dumped when computed, so if we are dumping for all complete
   // types, we need to force usage to get types that wouldn't be used elsewhere.
-  if (Ctx.getLangOpts().DumpRecordLayoutsComplete)
+  if (Ctx.getLangOpts().DumpRecordLayoutsComplete &&
+  (!isa(this) ||
+   !cast(this)->getDescribedClassTemplate()))
 (void)Ctx.getASTRecordLayout(this);
 }
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D105112: [clang] Add -fdump-record-layouts-canonical option

2021-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 355741.
daltenty added a comment.

- Update test case with nested typedef


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105112

Files:
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/test/Layout/dump-canonical.cpp


Index: clang/test/Layout/dump-canonical.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-canonical.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-canonical %s | 
FileCheck %s -check-prefix CANONICAL
+
+typedef long foo_t;
+
+
+struct a {
+  foo_t x;
+} b;
+
+struct c {
+  typedef foo_t bar_t;
+  bar_t x;
+} d;
+
+// CHECK:  0 | foo_t
+// CHECK:  0 | c::bar_t
+// CANONICAL-NOT:  0 | foo_t
+// CANONICAL-NOT:  0 | c::bar_t
+// CANONICAL:  0 | long
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3577,7 +3577,10 @@
 } else {
   PrintOffset(OS, FieldOffset, IndentLevel);
 }
-OS << Field.getType().getAsString() << ' ' << Field << '\n';
+const QualType &FieldType = C.getLangOpts().DumpRecordLayoutsCanonical
+? Field.getType().getCanonicalType()
+: Field.getType();
+OS << FieldType.getAsString() << ' ' << Field << '\n';
   }
 
   // Dump virtual bases.
Index: clang/include/clang/Driver/Options.td
===
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5381,13 +5381,16 @@
 def fdump_record_layouts_simple : Flag<["-"], "fdump-record-layouts-simple">,
   HelpText<"Dump record layout information in a simple form used for testing">,
   MarshallingInfoFlag>;
+def fdump_record_layouts_canonical : Flag<["-"], 
"fdump-record-layouts-canonical">,
+  HelpText<"Dump record layout information with canonical field types">,
+  MarshallingInfoFlag>;
 def fdump_record_layouts_complete : Flag<["-"], 
"fdump-record-layouts-complete">,
   HelpText<"Dump record layout information for all complete types">,
   MarshallingInfoFlag>;
 def fdump_record_layouts : Flag<["-"], "fdump-record-layouts">,
   HelpText<"Dump record layout information">,
   MarshallingInfoFlag>,
-  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath]>;
+  ImpliedByAnyOf<[fdump_record_layouts_simple.KeyPath, 
fdump_record_layouts_complete.KeyPath, fdump_record_layouts_canonical.KeyPath]>;
 def fix_what_you_can : Flag<["-"], "fix-what-you-can">,
   HelpText<"Apply fix-it advice even in the presence of unfixable errors">,
   MarshallingInfoFlag>;
Index: clang/include/clang/Basic/LangOptions.def
===
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -265,6 +265,7 @@
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
 BENIGN_LANGOPT(DumpRecordLayouts , 1, 0, "dumping the layout of IRgen'd 
records")
 BENIGN_LANGOPT(DumpRecordLayoutsSimple , 1, 0, "dumping the layout of IRgen'd 
records in a simple form")
+BENIGN_LANGOPT(DumpRecordLayoutsCanonical , 1, 0, "dumping the AST layout of 
records using canonical field types")
 BENIGN_LANGOPT(DumpRecordLayoutsComplete , 1, 0, "dumping the AST layout of 
all complete records")
 BENIGN_LANGOPT(DumpVTableLayouts , 1, 0, "dumping the layouts of emitted 
vtables")
 LANGOPT(NoConstantCFStrings , 1, 0, "no constant CoreFoundation strings")


Index: clang/test/Layout/dump-canonical.cpp
===
--- /dev/null
+++ clang/test/Layout/dump-canonical.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -fdump-record-layouts-canonical %s | FileCheck %s -check-prefix CANONICAL
+
+typedef long foo_t;
+
+
+struct a {
+  foo_t x;
+} b;
+
+struct c {
+  typedef foo_t bar_t;
+  bar_t x;
+} d;
+
+// CHECK:  0 | foo_t
+// CHECK:  0 | c::bar_t
+// CANONICAL-NOT:  0 | foo_t
+// CANONICAL-NOT:  0 | c::bar_t
+// CANONICAL:  0 | long
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -3577,7 +3577,10 @@
 } else {
   PrintOffset(OS, FieldOffset, IndentLevel);
 }
-OS << Field.getType().getAsString() << ' ' << Field << '\n';
+const QualType &FieldType = C.getLangOpts().DumpRecordLayoutsCanonical
+ 

[PATCH] D105112: [clang] Add -fdump-record-layouts-canonical option

2021-06-30 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D105112#2850990 , @stevewan wrote:

> I'm not familiar with `getCanonicalType()`, can you confirm whether it sees 
> through nested typedef's?

Add a test case that hopefully will cover the case you intend


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105112

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


[PATCH] D113428: [AIX] Define WCHAR_T_TYPE as unsigned int on 64-bit AIX for wchar.c test

2021-11-09 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113428

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


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

2021-02-26 Thread David Tenty via Phabricator via cfe-commits
daltenty created this revision.
daltenty added reviewers: hubert.reinterpretcast, stevewan, jasonliu.
daltenty requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97574

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
@@ -17,7 +17,6 @@
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NOT: "-lm"
@@ -39,7 +38,6 @@
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NOT: "-lm"
@@ -62,7 +60,6 @@
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -86,7 +83,6 @@
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -110,7 +106,6 @@
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PROF-NOT: "-lm"
@@ -133,7 +128,6 @@
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-GPROF-NOT: "-lm"
@@ -156,7 +150,6 @@
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-STATIC-NOT: "-lm"
@@ -180,7 +173,6 @@
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
-// CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-LIBP-NOT: "-lm"
@@ -204,7 +196,6 @@
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -229,7 +220,6 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|\\

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

2021-03-03 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG66799bf0e281: [AIX][clang][driver] Restrict /usr/lib to 
internal library search paths (authored by daltenty).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97574

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
@@ -17,7 +17,6 @@
 // CHECK-LD32: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NOT: "-lc++"
 // CHECK-LD32: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NOT: "-lm"
@@ -39,7 +38,6 @@
 // CHECK-LD64: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NOT: "-lc++"
 // CHECK-LD64: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-NOT: "-lm"
@@ -62,7 +60,6 @@
 // CHECK-LD32-PTHREAD: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PTHREAD-NOT: "-lc++"
 // CHECK-LD32-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PTHREAD: "-lpthreads"
@@ -86,7 +83,6 @@
 // CHECK-LD64-PTHREAD: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-PTHREAD: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-PTHREAD: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-PTHREAD-NOT: "-lc++"
 // CHECK-LD64-PTHREAD: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-PTHREAD: "-lpthreads"
@@ -110,7 +106,6 @@
 // CHECK-LD32-PROF: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}mcrt0.o"
 // CHECK-LD32-PROF: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-PROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-PROF-NOT: "-lc++"
 // CHECK-LD32-PROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-PROF-NOT: "-lm"
@@ -133,7 +128,6 @@
 // CHECK-LD64-GPROF: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}gcrt0_64.o"
 // CHECK-LD64-GPROF: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-GPROF: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-GPROF-NOT: "-lc++"
 // CHECK-LD64-GPROF: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc64.a"
 // CHECK-LD64-GPROF-NOT: "-lm"
@@ -156,7 +150,6 @@
 // CHECK-LD32-STATIC: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-STATIC: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-STATIC: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-STATIC-NOT: "-lc++"
 // CHECK-LD32-STATIC: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-STATIC-NOT: "-lm"
@@ -180,7 +173,6 @@
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-LIBP: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
 // CHECK-LD32-LIBP: "-L[[SYSROOT]]/powerpc-ibm-aix7.1.0.0"
-// CHECK-LD32-LIBP: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-LIBP-NOT: "-lc++"
 // CHECK-LD32-LIBP: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-LIBP-NOT: "-lm"
@@ -204,7 +196,6 @@
 // CHECK-LD32-NO-STD-LIB: "-bpT:0x1000" "-bpD:0x2000"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crt0.o"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[SYSROOT]]/usr/lib{{/|}}crti.o"
-// CHECK-LD32-NO-STD-LIB: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lc++"
 // CHECK-LD32-NO-STD-LIB-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-powerpc.a"
 // CHECK-LD32-NO-STD-LIB-NOT: "-lpthreads"
@@ -229,7 +220,6 @@
 // CHECK-LD64-NO-DEFAULT-LIBS: "-bpT:0x1" "-bpD:0x11000"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crt0_64.o"
 // CHECK-LD64-NO-DEFAULT-LIBS: "[[SYSROOT]]/usr/lib{{/|}}crti_64.o"
-// CHECK-LD64-NO-DEFAULT-LIBS: "-L[[SYSROOT]]/usr/lib"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "-lc++"
 // CHECK-LD64-NO-DEFAULT-LIBS-NOT: "[[RESOURCE_DIR]]{{/|}}lib{{/|}}aix{{/|}}libclang_rt.builtins-po

[PATCH] D89986: [AIX] do not emit visibility attribute into IR when there is -mignore-xcoff-visibility

2021-03-05 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/Frontend/CompilerInvocation.cpp:3630
+  // no -fvisibility=* option.
+  if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) ||
+  !Args.hasArg(OPT_fvisibility)))

No sure if we intended to move this block? Regardless, we should probably 
preserve the extra comments that got added.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89986

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


[PATCH] D98660: [AIX][XCOFF] Fixed the test case which failed at aix OS because enable -mignore-xcoff-visibility by default.

2021-03-15 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/CodeGen/hidden-visibility.c:1
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fvisibility default -emit-llvm -o - | FileCheck %s
 

dunno if this is also accepted, but I think we prefer an equal sign here: 



Comment at: clang/test/CodeGen/private-extern.c:1
-// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1  -fvisibility default -emit-llvm -o - %s | FileCheck %s
 

ditto the earlier comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98660

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


[PATCH] D98660: [AIX][XCOFF] Fixed the test case which failed at aix OS because enable -mignore-xcoff-visibility by default.

2021-03-15 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added inline comments.



Comment at: clang/test/CodeGen/hidden-visibility.c:1
-// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -fvisibility default -emit-llvm -o - | FileCheck %s
 

DiggerLin wrote:
> daltenty wrote:
> > dunno if this is also accepted, but I think we prefer an equal sign here: 
> I do not think clang -cc1 support  -fvisibility=default
I guess the cc1 argument form maybe different for some reason, so feel free to 
disregard.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98660

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


[PATCH] D114481: [NFC][AIX]Disable precompiled module file tests on AIX

2021-11-24 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, with minor nit.




Comment at: clang/test/ClangScanDeps/modules-pch-common-submodule.c:1
+// UNSUPPORTED: aix
+

Let's add a comment, to let folks know what's going on with these. Something 
like:

// Unsupported on AIX because we don't support the requisite __clangast section 
in XCOFF yet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114481

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


[PATCH] D128223: [clang] Linkage computation of static locals may require forcing visibility computation

2022-10-28 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM. Doing the inner computation while observing visibility seems like the 
right thing to do in this case.




Comment at: clang/lib/AST/Decl.cpp:1355
+!Context.getLangOpts().VisibilityInlinesHiddenStaticLocalVar;
+LVComputationKind nestedComputation =
+mayBeVisible

Just adding my own note  of explanation, since this stuff can be a little hard 
to follow.

This inner linkage query needs to observe visibility in order to get a 
consistent result, even if the calling query (i.e. `getLinkageInternal` in this 
case) has passed in a LVComputationKind indicating we don't need to for the 
LocalDecl. If we don't, we may get results inconsistent with the cached value 
for the enclosing FunctionDecl, hence the assert.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128223

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


[PATCH] D119147: [AIX][clang][driver] Check the command string to the linker for exportlist opts

2022-08-25 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Suggest adding the following text to `clang/docs/ReleaseNotes.rst` under the 
AIX section with this change:

  * When using `-shared`, the clang driver now invokes llvm-nm to create an 
export list if the user doesn't specify one via linker flag or pass an 
alternative export control option.




Comment at: clang/test/Driver/aix-ld.c:695-696
 // CHECK-LD64-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
 // CHECK-LD64-SHARED: "-isysroot" "[[SYSROOT:[^"]+]]"
+/ /CHECK-LD64-SHARED: "{{.*}}llvm-nm"
+// CHECK-LD64-SHARED: "--export-symbols"

The comment line is strange here, probably a typo:



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119147

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


[PATCH] D119147: [AIX][clang][driver] Check the command string to the linker for exportlist opts

2022-08-26 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.

LGTM, thanks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D119147

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


[PATCH] D134284: [AIX] change the clang tests with llvm-nm -Xany

2022-09-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

> If OBJECT_MODE isn't an environment variable that clang uses, surely it 
> should ignore it?

The clang driver does in fact respect OBJECT_MODE on AIX, but I'm guessing it 
doesn't accept the `any` setting (since it doesn't really make sense in that 
context).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134284

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


[PATCH] D134284: [AIX] change the clang tests with llvm-nm -Xany

2022-09-20 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

> It looks to me like 
> https://github.com/llvm/llvm-project/blob/b982ba2a6e0f11340b4e75d1d4eba9ff62a81df7/clang/lib/Driver/Driver.cpp#L554
>  should be modified to accept the OBJECT_MODE values you've implemented for 
> llvm-nm and llvm-ar. Otherwise, you'll never be able to use the any and 32_64 
> values supported by those tools as full environment variables (as opposed to 
> variables set for a single or limited set of commands) on a system where 
> clang is also used.

Those settings don't really make sense for clang since you need to pick a 
single target and aren't typically supported for a compiler driver on AIX. For 
example the XL compiler would give you:

  error: 1501-255 OBJECT_MODE setting is not recognized and is not a valid 
setting for the compiler.

if you try `OBJECT_MODE=any`, so I don't think most folks are using such an 
environment setting on AIX currently (i.e. typically they select either 32 or 
64).

I prefect the solution of adding something to the lit config rather than 
modifying individual tests, since I doubt most LLVM developers are not going to 
know to add -X any to their tests just for AIX. Ideally we’d find a way to get 
those tools to act in the AIX fashion, without placing the burden on developers 
to add options in their tests.

Maybe we can distinguish OBJECT_MODE settings for LLVM tools (which generally 
accept `any`) from a setting for the driver (which can't)? Something like a 
`TOOL_OBJECT_MODE` env which is preferred for the tools.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134284

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


[PATCH] D134284: [AIX] change "llvm-nm" to "env OBJECT_MODE=any llvm-nm" in clang/test for AIX OS

2022-09-20 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM to unblock the AIX buildbots. We can follow up on a separate env later if 
desired.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134284

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


[PATCH] D137986: [Clang][CodeGen][AIX] Map __builtin_frexpl, __builtin_ldexpl, and __builtin_modfl to 'double' version lib calls in 64-bit 'long double' mode

2022-11-16 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/CodeGen/CGBuiltin.cpp:110
+  // The AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+  // 'long double'. Map to the 'double' versions if it is 64-bit 'long
+  // double' mode.

I feel like we should be clear about which 128-bit double format we are talking 
about, since it may not be immediately clear for folks who aren't intimately 
familiar with AIX. Maybe we can reference __ibm128 or ibm 128-bit, so it's 
clear what we mean.



Comment at: clang/test/CodeGen/aix-builtin-mapping.c:2
+// AIX library functions frexpl, ldexpl, and modfl are for 128-bit
+// 'long double'. Check that the compiler generates calls to the 'double'
+// versions for correspoding builtin functions in 64-bit 'long double' mode.





Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137986

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


[PATCH] D137753: [Clang][AIX][p]Enable -p Functionality

2023-01-24 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/include/clang/Driver/Options.td:4141
   HelpText<"Warn on language extensions">, 
MarshallingInfoFlag>;
+def p : Flag<["-"], "p">, HelpText<"Enable mcount instrumentation with prof">, 
Flags<[CC1Option]>;
 def pg : Flag<["-"], "pg">, HelpText<"Enable mcount instrumentation">, 
Flags<[CC1Option]>,

Why is this a cc1 option if it's not used in CC1?



Comment at: clang/lib/Driver/ToolChains/AIX.cpp:274
 
-if (Args.hasArg(options::OPT_pg)) {
+if (Args.hasArg(options::OPT_p, options::OPT_pg)) {
   CmdArgs.push_back(Args.MakeArgString((llvm::Twine("-L") + D.SysRoot) +

Maybe I'm a bit confused, I though these options had different handling with 
respect to the paths? Otherwise, it's simply an alias.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137753

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


[PATCH] D137753: [Clang][AIX][p]Enable -p Functionality

2023-01-25 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM, with small nit to address before commit




Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6287-6292
 if (!TC.getTriple().isOSAIX() && !TC.getTriple().isOSOpenBSD()) {
   D.Diag(diag::err_drv_unsupported_opt_for_target)
   << A->getAsString(Args) << TripleStr;
 }
+if (TC.getTriple().isOSAIX())
+  CmdArgs.push_back("-pg");

nit: we can save our selves a query and clarify by writing this as if-elseif


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137753

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


[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-16 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

Needs a test, I think we should add a couple of `-fopenmp=foo` run lines to 
`clang/test/Driver/aix-ld.c` to verify that the correct linker options are 
produced for each.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141862

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


[PATCH] D141862: [clang][driver][AIX] Add OpenMP runtime if -fopenmp specified

2023-01-19 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

Some minor nits about how we can shorten the test, but otherwise LGTM




Comment at: clang/test/Driver/aix-ld.c:1027
+// RUN:-fopenmp \
+// RUN:   | FileCheck --check-prefix=CHECK-FOPENMP-OMP %s
+// CHECK-FOPENMP-OMP-NOT: warning:

nit: since the output for these tests are really the same, apart from one line 
with the library name, we could use two prefixes, a common one and a specific 
one to avoid repetition:
```
// RUN:   | FileCheck --check-prefixes=CHECK-FOPENMP,CHECK-FOPENMP-OMP %s
```

and then the CHECK block can go something like this:
```
...
// CHECK-FOPENMP-NOT: "-lm"
// CHECK-FOPENMP-OMP: "-lomp"
// CHECK-FOPENMP-IOMP5:  "-liomp5"
// CHECK-FOPENMP-GOMP:   "-lgomp
// CHECK-FOPENMP: "-lc"
...
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141862

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


[PATCH] D142358: Opting out of Clang 15 ABI Changes for AIX and z/OS

2023-01-23 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/test/SemaCXX/class-layout.cpp:616-617
 
+// This ends the #if !defined(__MVS__) && !defined(__AIX__) block from line 12 
+#endif
+

nit: line numbers may shift on you as other commits touch this file. Prefer  a 
same line comment that keeps the comment together with the actual directive.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142358

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


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

2022-06-01 Thread David Tenty via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8c8a2679a20f: [clang][AIX] add option 
mdefault-visibility-export-mapping (authored by daltenty).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126340

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/mdefault-visibility-export-mapping.c
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping-alias.cpp
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping-rtti.cpp
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp

Index: clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=none -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=explicit -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-EXP %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=all -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-EXP,EXPLICIT-EXP %s
+
+struct A {};
+
+template 
+class B {
+public:
+  T x;
+  B(T _x) : x(_x) {}
+  ~B() {}
+  void func(T x) {}
+};
+
+template 
+class __attribute__((visibility("default"))) C {
+public:
+  T x;
+  C(T _x) : x(_x) {}
+  ~C() {}
+  void func(T x) {}
+};
+
+class D {
+public:
+  ~D();
+};
+
+D::~D() {}
+
+extern template class B;
+extern template class C;
+
+void func() {
+  B x({});
+  C y({});
+  x.func({});
+  y.func({});
+  B xi(0);
+  C yi(0);
+  xi.func(0);
+  yi.func(0);
+  D z;
+}
+
+// D::~D() (base object destructor)
+// UNSPECIFIED-DEF:  define void @_ZN1DD2Ev(
+// UNSPECIFIED-EXP:  define dllexport void @_ZN1DD2Ev(
+
+// D::~D() (complete object destructor)
+// UNSPECIFIED-DEF:  define void @_ZN1DD1Ev(
+// UNSPECIFIED-EXP:  define dllexport void @_ZN1DD1Ev(
+
+// UNSPECIFIED-DEF: define void @_Z4funcv(
+// UNSPECIFIED-EXP: define dllexport void @_Z4funcv(
+
+// B::B(A) (complete object constructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC1ES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC1ES0_(
+
+// C::C(A) (complete object constructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AEC1ES0_(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AEC1ES0_(
+
+// B::func(A)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AE4funcES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AE4funcES0_(
+
+// C::func(A)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AE4funcES0_(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AE4funcES0_(
+
+// B::B(int) (complete object constructor)
+// CHECK: declare void @_ZN1BIiEC1Ei
+
+// C::C(int) (complete object constructor)
+// CHECK: declare void @_ZN1CIiEC1Ei
+
+// B::func(int)
+// CHECK: declare void @_ZN1BIiE4funcEi
+
+// C::func(int)
+// CHECK: declare void @_ZN1CIiE4funcEi
+
+// C::~C() (complete object destructor)
+// CHECK: declare void @_ZN1CIiED1Ev
+
+// B::~B() (complete object destructor)
+// CHECK: declare void @_ZN1BIiED1Ev
+
+// C::~c() (complete object destructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AED1Ev(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AED1Ev(
+
+// B::~B() (complete object destructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED1Ev(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED1Ev(
+
+// B::B(A) (base object constructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC2ES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC2ES0_(
+
+// B::~B() (base object destructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED2Ev(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED2Ev(
+
+// C::C(A) (base object constructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AEC2ES0_(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AEC2ES0_(
+
+// C::~C() (base object destructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AED2Ev(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AED2Ev(
Inde

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

2022-06-02 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D126340#3552645 , @nikic wrote:

> It looks like this causes a major compile-time regression in the clang 
> frontend: 
> http://llvm-compile-time-tracker.com/compare.php?from=6232a8f3d61e5856c17e7b314385e9ea8068cdc1&to=8c8a2679a20f621994fa904bcfc68775e7345edc&stat=instructions
>  For example, tramp3d-v4 is up 5% in `-O0` builds.
>
> Not familiar with this area, but my first guess would be that 
> getLinkageAndVisibility() is actually expensive and you're introducing a ton 
> of calls to it?

@nikic thanks for catching this! Looking into it now, I'll put in a revert if I 
can't get things sorted shortly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126340

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


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

2022-06-09 Thread David Tenty via Phabricator via cfe-commits
daltenty updated this revision to Diff 435609.
daltenty added a comment.

- Don't try to export internal linkage RTTI types
- Make shouldMapVisibilityToDLLExport inline and provide a short-circuit 
evaluation in the case where no mapping is in effect. This should hopefully 
solve the compile time issues and asserts we are seeing on other platforms, as 
if the option isn't in effect we don't try to do any additional linkage 
computations over what we would normally do. Tested via profiling building 
tramp3d-v4 and our calls to the linkage computer fall back to what we were 
getting before this patch.


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

https://reviews.llvm.org/D126340

Files:
  clang/docs/UsersManual.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Basic/LangOptions.h
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/lib/CodeGen/CodeGenModule.h
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/CodeGen/mdefault-visibility-export-mapping.c
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping-alias.cpp
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping-rtti.cpp
  clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp

Index: clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp
===
--- /dev/null
+++ clang/test/CodeGenCXX/mdefault-visibility-export-mapping.cpp
@@ -0,0 +1,119 @@
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=none -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-DEF %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=explicit -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-DEF,EXPLICIT-EXP %s
+// RUN: %clang_cc1 -triple powerpc-ibm-aix %s -mdefault-visibility-export-mapping=all -S -emit-llvm -o - | \
+// RUN:   FileCheck -check-prefixes=CHECK,UNSPECIFIED-EXP,EXPLICIT-EXP %s
+
+struct A {};
+
+template 
+class B {
+public:
+  T x;
+  B(T _x) : x(_x) {}
+  ~B() {}
+  void func(T x) {}
+};
+
+template 
+class __attribute__((visibility("default"))) C {
+public:
+  T x;
+  C(T _x) : x(_x) {}
+  ~C() {}
+  void func(T x) {}
+};
+
+class D {
+public:
+  ~D();
+};
+
+D::~D() {}
+
+extern template class B;
+extern template class C;
+
+void func() {
+  B x({});
+  C y({});
+  x.func({});
+  y.func({});
+  B xi(0);
+  C yi(0);
+  xi.func(0);
+  yi.func(0);
+  D z;
+}
+
+// D::~D() (base object destructor)
+// UNSPECIFIED-DEF:  define void @_ZN1DD2Ev(
+// UNSPECIFIED-EXP:  define dllexport void @_ZN1DD2Ev(
+
+// D::~D() (complete object destructor)
+// UNSPECIFIED-DEF:  define void @_ZN1DD1Ev(
+// UNSPECIFIED-EXP:  define dllexport void @_ZN1DD1Ev(
+
+// UNSPECIFIED-DEF: define void @_Z4funcv(
+// UNSPECIFIED-EXP: define dllexport void @_Z4funcv(
+
+// B::B(A) (complete object constructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC1ES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC1ES0_(
+
+// C::C(A) (complete object constructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AEC1ES0_(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AEC1ES0_(
+
+// B::func(A)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AE4funcES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AE4funcES0_(
+
+// C::func(A)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AE4funcES0_(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AE4funcES0_(
+
+// B::B(int) (complete object constructor)
+// CHECK: declare void @_ZN1BIiEC1Ei
+
+// C::C(int) (complete object constructor)
+// CHECK: declare void @_ZN1CIiEC1Ei
+
+// B::func(int)
+// CHECK: declare void @_ZN1BIiE4funcEi
+
+// C::func(int)
+// CHECK: declare void @_ZN1CIiE4funcEi
+
+// C::~C() (complete object destructor)
+// CHECK: declare void @_ZN1CIiED1Ev
+
+// B::~B() (complete object destructor)
+// CHECK: declare void @_ZN1BIiED1Ev
+
+// C::~c() (complete object destructor)
+// EXPLICIT-DEF: define linkonce_odr void @_ZN1CI1AED1Ev(
+// EXPLICIT-EXP: define linkonce_odr dllexport void @_ZN1CI1AED1Ev(
+
+// B::~B() (complete object destructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED1Ev(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED1Ev(
+
+// B::B(A) (base object constructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AEC2ES0_(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AEC2ES0_(
+
+// B::~B() (base object destructor)
+// UNSPECIFIED-DEF: define linkonce_odr void @_ZN1BI1AED2Ev(
+// UNSPECIFIED-EXP: define linkonce_odr dllexport void @_ZN1BI1AED2Ev(
+
+// C::C(A) (base object construct

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

2022-06-09 Thread David Tenty via Phabricator via cfe-commits
daltenty marked an inline comment as done.
daltenty added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:1228
   GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass);
-else if (D->hasAttr() && !GV->isDeclarationForLinker())
+else if ((D->hasAttr() ||
+  shouldMapVisibilityToDLLExport(D)) &&

MaskRay wrote:
> Restrict this to AIX/XCOFF.
> 
> Really other binary format users will not need this.
I believe this is now done, via us now doing an early check on the setting of 
the LangOpt (which will always be `None` on non-AIX). No need for an extra 
check on the binary format.


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

https://reviews.llvm.org/D126340

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


[PATCH] D159339: [urgent][CodeGen] First check the kind and then the llvm::Function properties.

2023-09-08 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

FYI: I tried to reproduce this on `powerpc64le-linux-gnu` at `-02` and didn't 
see it at this point, though I get a whole lot of other uninitialized reads, so 
there's definitely some general problems in this space in the LLVM codebase


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159339

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


[PATCH] D159339: [urgent][CodeGen] First check the kind and then the llvm::Function properties.

2023-09-08 Thread David Tenty via Phabricator via cfe-commits
daltenty added a comment.

In D159339#4642210 , @v.g.vassilev 
wrote:

> In D159339#4642147 , @daltenty 
> wrote:
>
>> FYI: I tried to reproduce this on `powerpc64le-linux-gnu` at `-02` and 
>> didn't see it at this point, though I get a whole lot of other uninitialized 
>> reads, so there's definitely some general problems in this space in the LLVM 
>> codebase
>
> Are these also present in llvm16?

I do see a similar case in llvm16 yes:

  algrind --tool=memcheck --leak-check=full ./bin/clang-repl
  ==3583806== Memcheck, a memory error detector
  ==3583806== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
  ==3583806== Using Valgrind-3.17.0 and LibVEX; rerun with -h for copyright info
  ==3583806== Command: ./bin/clang-repl
  ==3583806==
  clang-repl> #include 
  ==3583806== Conditional jump or move depends on uninitialised value(s)
  ==3583806==at 0x28D08F4: operator== 
(llvm-project/llvm/include/llvm/Support/Alignment.h:301)
  ==3583806==by 0x28D08F4: llvm::DataLayout::operator==(llvm::DataLayout 
const&) const (llvm-project/llvm/lib/IR/DataLayout.cpp:549)
  ==3583806==by 0x2AA31BB: operator!= 
(llvm-project/llvm/include/llvm/IR/DataLayout.h:233)
  ==3583806==by 0x2AA31BB: llvm::orc::LLJIT::applyDataLayout(llvm::Module&) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:927)
  ==3583806==by 0x2AA009F: operator() 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:754)
  ==3583806==by 0x2AA009F: withModuleDo<(lambda at 
/home/daltenty/llvm/dev/llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:754:28)>
 (llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:136)
  ==3583806==by 0x2AA009F: 
llvm::orc::LLJIT::addIRModule(llvm::IntrusiveRefCntPtr,
 llvm::orc::ThreadSafeModule) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:754)
  ==3583806==by 0x2AA0693: 
llvm::orc::LLJIT::addIRModule(llvm::orc::JITDylib&, 
llvm::orc::ThreadSafeModule) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:761)
  ==3583806==by 0x2AAB563: (anonymous 
namespace)::GenericLLVMIRPlatformSupport::setupJITDylib(llvm::orc::JITDylib&) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:253)
  ==3583806==by 0x2AA2B2F: GenericLLVMIRPlatformSupport 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:200)
  ==3583806==by 0x2AA2B2F: make_unique<(anonymous 
namespace)::GenericLLVMIRPlatformSupport, llvm::orc::LLJIT &> 
(unique_ptr.h:1065)
  ==3583806==by 0x2AA2B2F: 
llvm::orc::setUpGenericLLVMIRPlatform(llvm::orc::LLJIT&) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:947)
  ==3583806==by 0x2AA2273: 
llvm::orc::LLJIT::LLJIT(llvm::orc::LLJITBuilderState&, llvm::Error&) 
(llvm-project/llvm/lib/ExecutionEngine/Orc/LLJIT.cpp:911)
  ==3583806==by 0x26AE233: llvm::orc::LLJITBuilderSetters::create() 
(llvm-project/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h:381)
  ==3583806==by 0x2F39D7F: 
clang::IncrementalExecutor::IncrementalExecutor(llvm::orc::ThreadSafeContext&, 
llvm::Error&, clang::TargetInfo const&) 
(llvm-project/clang/lib/Interpreter/IncrementalExecutor.cpp:40)
  ==3583806==by 0x2F33A47: make_unique 
(unique_ptr.h:1065)
  ==3583806==by 0x2F33A47: 
clang::Interpreter::Execute(clang::PartialTranslationUnit&) 
(llvm-project/clang/lib/Interpreter/Interpreter.cpp:223)
  ==3583806==by 0x26AE71B: 
clang::Interpreter::ParseAndExecute(llvm::StringRef) 
(llvm-project/clang/include/clang/Interpreter/Interpreter.h:68)
  ==3583806==by 0x26ADD6B: main 
(llvm-project/clang/tools/clang-repl/ClangRepl.cpp:127)
  ==3583806==

This definitely seems to be point to `DataLayout.FunctionPtrAlign`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D159339

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


[PATCH] D147184: [clang][CodeGenCXX] Improve handling of itanium ABI member function alignment requirements

2023-07-06 Thread David Tenty 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 rG196c144d0bc1: [clang][CodeGenCXX] Improve handling of 
itanium ABI member function alignment… (authored by daltenty).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D147184?vs=537486&id=537718#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147184

Files:
  clang/lib/CodeGen/CodeGenModule.cpp
  clang/test/CodeGenCXX/member-alignment.cpp
  clang/test/Modules/cxx-irgen.cpp
  clang/test/OpenMP/distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_parallel_for_simd_private_codegen.cpp
  clang/test/OpenMP/distribute_private_codegen.cpp
  clang/test/OpenMP/distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/distribute_simd_private_codegen.cpp
  clang/test/OpenMP/nvptx_lambda_capturing.cpp
  clang/test/OpenMP/reduction_implicit_map.cpp
  clang/test/OpenMP/target_data_use_device_ptr_inheritance_codegen.cpp
  clang/test/OpenMP/target_firstprivate_codegen.cpp
  clang/test/OpenMP/target_has_device_addr_codegen.cpp
  clang/test/OpenMP/target_has_device_addr_codegen_01.cpp
  clang/test/OpenMP/target_is_device_ptr_codegen.cpp
  clang/test/OpenMP/target_map_codegen_hold.cpp
  clang/test/OpenMP/target_ompx_dyn_cgroup_mem_codegen.cpp
  clang/test/OpenMP/target_parallel_codegen.cpp
  clang/test/OpenMP/target_parallel_for_codegen.cpp
  clang/test/OpenMP/target_parallel_for_simd_codegen.cpp
  clang/test/OpenMP/target_parallel_generic_loop_codegen-1.cpp
  clang/test/OpenMP/target_parallel_if_codegen.cpp
  clang/test/OpenMP/target_parallel_num_threads_codegen.cpp
  clang/test/OpenMP/target_teams_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_parallel_for_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_dist_schedule_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_private_codegen.cpp
  
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_private_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_dist_schedule_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_lastprivate_codegen.cpp
  clang/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp
  clang/test/OpenMP/target_teams_generic_loop_collapse_codegen.cpp
  clang/test/OpenMP/target_teams_generic_loop_private_codegen.cpp
  clang/test/OpenMP/target_teams_num_teams_codegen.cpp
  clang/test/OpenMP/target_teams_thread_limit_codegen.cpp
  clang/test/OpenMP/teams_codegen.cpp
  clang/test/OpenMP/teams_distribute_codegen.cpp
  clang/test/OpenMP/teams_distribute_collapse_codegen.cpp
  clang/test/OpenMP/teams_distribute_dist_schedule_codegen.cpp
  clang/test/OpenMP/teams_distribute_firstprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_lastprivate_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_collapse_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_dist_schedule_codegen.cpp
  clang/test/OpenMP/teams_distribute_parallel_for_firstprivate_codegen.cpp
  clang/test/Open

[PATCH] D159339: [urgent][CodeGen] First check the kind and then the llvm::Function properties.

2023-09-01 Thread David Tenty via Phabricator via cfe-commits
daltenty added inline comments.



Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2389
   if (getTarget().getCXXABI().areMemberFunctionsAligned()) {
-if (F->getPointerAlignment(getDataLayout()) < 2 && isa(D))
+if (isa(D) && F->getPointerAlignment(getDataLayout()) < 2)
   F->setAlignment(std::max(llvm::Align(2), F->getAlign().valueOrOne()));

Thanks for looking into this. 

It's not clear to me how this re-ordering ends up fixing things. Can you 
clarify what the uninitialized value was in this expression?




Repository:
  rC Clang

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

https://reviews.llvm.org/D159339

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


[PATCH] D159339: [urgent][CodeGen] First check the kind and then the llvm::Function properties.

2023-09-01 Thread David Tenty via Phabricator via cfe-commits
daltenty accepted this revision.
daltenty added a comment.
This revision is now accepted and ready to land.

LGTM as a workaround.




Comment at: clang/lib/CodeGen/CodeGenModule.cpp:2389
   if (getTarget().getCXXABI().areMemberFunctionsAligned()) {
-if (F->getPointerAlignment(getDataLayout()) < 2 && isa(D))
+if (isa(D) && F->getPointerAlignment(getDataLayout()) < 2)
   F->setAlignment(std::max(llvm::Align(2), F->getAlign().valueOrOne()));

v.g.vassilev wrote:
> daltenty wrote:
> > Thanks for looking into this. 
> > 
> > It's not clear to me how this re-ordering ends up fixing things. Can you 
> > clarify what the uninitialized value was in this expression?
> > 
> > 
> The issue happens only in Release builds (RelWithDebInfo, too). From what I 
> was able to see it is somewhere in `F->getPointerAlignment`. My assumption 
> was that we cannot rely on the full properties of `F` to be set unless it is 
> the declaration kind we expected (similar to checking if a something is a 
> nullptr and then probing its members). Secondly the `isa` check is likely to 
> be the less expensive check anyway.
> 
> I saw the issue yesterday and dug into it for a while. However, I decided to 
> insert a "fix" before the release which is in few days since the `isa` seems 
> to the faster check anyway.
Thanks, yeah thats kind of what I expected.  `F->getPointerAlignment()` is 
likely getting inlined into in to this callsite and we are inspecting 
uninitialized properties of the DataLayout. The weird part is I don't see why 
those properties of the DataLayout ever should be uninitialized, so I think 
there might be something more broken underneath this.

That said, this is definitely better than before as you say, so let's go ahead 
with this for the release and maybe I'll do some more digging in 
`getPointerAlignment`.


Repository:
  rC Clang

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

https://reviews.llvm.org/D159339

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


  1   2   >