[PATCH] D108286: [clang][Driver][Linux] fix regression issue when define LIBCXX_LIBDIR_SUFFIX=64

lin.sun via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 18 03:52:04 PDT 2021


sunlin created this revision.
Herald added a subscriber: mgorny.
sunlin requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Clang failed to compile c++ when LIBCXX_LIBDIR_SUFFIX=64 is defeined for the lib
path "../lib64" are not be included.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108286

Files:
  clang/lib/Driver/ToolChains/Linux.cpp
  clang/lib/Headers/CMakeLists.txt


Index: clang/lib/Headers/CMakeLists.txt
===================================================================
--- clang/lib/Headers/CMakeLists.txt
+++ clang/lib/Headers/CMakeLists.txt
@@ -3,10 +3,6 @@
   altivec.h
   ammintrin.h
   amxintrin.h
-  arm_acle.h
-  arm_cmse.h
-  armintr.h
-  arm64intr.h
   avx2intrin.h
   avx512bf16intrin.h
   avx512bwintrin.h
@@ -143,6 +139,15 @@
   xtestintrin.h
   )
 
+if ("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
+  set(files ${files}
+  arm_acle.h
+  arm_cmse.h
+  armintr.h
+  arm64intr.h
+  )
+endif()
+
 set(cuda_wrapper_files
   cuda_wrappers/algorithm
   cuda_wrappers/complex
@@ -201,19 +206,21 @@
   copy_header_to_output_dir(${CMAKE_CURRENT_SOURCE_DIR} ${f})
 endforeach( f )
 
-# Generate header files and copy them to the build directory
-# Generate arm_neon.h
-clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
-# Generate arm_fp16.h
-clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
-# Generate arm_sve.h
-clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
-# Generate arm_bf16.h
-clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
-# Generate arm_mve.h
-clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
-# Generate arm_cde.h
-clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
+if ("ARM" IN_LIST LLVM_TARGETS_TO_BUILD)
+  # Generate header files and copy them to the build directory
+  # Generate arm_neon.h
+  clang_generate_header(-gen-arm-neon arm_neon.td arm_neon.h)
+  # Generate arm_fp16.h
+  clang_generate_header(-gen-arm-fp16 arm_fp16.td arm_fp16.h)
+  # Generate arm_sve.h
+  clang_generate_header(-gen-arm-sve-header arm_sve.td arm_sve.h)
+  # Generate arm_bf16.h
+  clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h)
+  # Generate arm_mve.h
+  clang_generate_header(-gen-arm-mve-header arm_mve.td arm_mve.h)
+  # Generate arm_cde.h
+  clang_generate_header(-gen-arm-cde-header arm_cde.td arm_cde.h)
+endif()
 # Generate riscv_vector.h
 clang_generate_header(-gen-riscv-vector-header riscv_vector.td riscv_vector.h)
 
Index: clang/lib/Driver/ToolChains/Linux.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Linux.cpp
+++ clang/lib/Driver/ToolChains/Linux.cpp
@@ -303,8 +303,10 @@
   // searched.
   // FIXME: It's not clear whether we should use the driver's installed
   // directory ('Dir' below) or the ResourceDir.
-  if (StringRef(D.Dir).startswith(SysRoot))
+  if (StringRef(D.Dir).startswith(SysRoot)) {
     addPathIfExists(D, D.Dir + "/../lib", Paths);
+    addPathIfExists(D, D.Dir + "/../" + OSLibDir, Paths);
+  }
 
   addPathIfExists(D, SysRoot + "/lib", Paths);
   addPathIfExists(D, SysRoot + "/usr/lib", Paths);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108286.367165.patch
Type: text/x-patch
Size: 2719 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210818/810d76d4/attachment.bin>


More information about the cfe-commits mailing list