[PATCH] D118700: Add support to --gcc-toolchain flag for GCC compiled with --enable-version-specific-runtime-libs.

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 1 16:35:20 PST 2022


MaskRay added a comment.

Can you dump the gcc search paths (include search paths and -L library search paths) with and without `--enable-version-specific-runtime-libs`, like the following?

  % gcc a.c -v -xc /dev/null |& sed -E 's/ "?-[iIL]/\n&/
  ...
  #include "..." search starts here:
  #include <...> search starts here:
   /usr/lib/gcc/x86_64-linux-gnu/11/include
   /usr/local/include
   /usr/include/x86_64-linux-gnu
   /usr/include
  ...
   -L/usr/lib/gcc/x86_64-linux-gnu/11
   -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu
   -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib
   -L/lib/x86_64-linux-gnu
   -L/lib/../lib
   -L/usr/lib/x86_64-linux-gnu
   -L/usr/lib/../lib
   -L/usr/lib/gcc/x86_64-linux-gnu/11/../../.. /tmp/cc7IN3uz.o ...

For driver tests, it is recommended to test `-DCLANG_DEFAULT_CXX_STDLIB=libc++ -DCLANG_DEFAULT_UNWINDLIB=libunwind -DCLANG_DEFAULT_RTLIB=compiler-rt` beside the default build to ensure --stdlib= and --rtlib are correctly set.



================
Comment at: clang/test/Driver/gcc-toolchain-rt-libs-multi.cpp:1
+// RUN: (%clangxx %s -v --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 || true) | FileCheck %s -check-prefix=X64
+// RUN: (%clangxx %s -m32 -v --gcc-toolchain=%S/Inputs/gcc_version_parsing_rt_libs_multilib --target=x86_64-redhat-linux 2>&1 || true) | FileCheck %s -check-prefix=X32
----------------
No need for `( ... ) | ...`. Just use plain `... 2>&1 | FileCheck ...`


================
Comment at: clang/test/Driver/gcc-toolchain-rt-libs-multi.cpp:6
+
+// X64: {{[^ ]*}}clang{{[^ ]*}}" -cc1
+// X64-SAME: -internal-isystem {{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../../../gcc/x86_64-redhat-linux/10.2.0/include/c++
----------------
Consider the form in `linux-cross.cpp`.

Avoid testing `clang`. The extra information is not needed and causes trouble to Windows and some build environments where `%clang` resolves to a file not named `clang`.


================
Comment at: clang/test/Driver/gcc-toolchain-rt-libs-multi.cpp:17
+// X32-SAME: -L{{[^ ]*}}gcc_version_parsing_rt_libs_multilib/lib/gcc/x86_64-redhat-linux/10.2.0/../lib32
+
----------------
no trailing blank line


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

https://reviews.llvm.org/D118700



More information about the cfe-commits mailing list