HomePhabricator

[Driver] Detect libstdc++ include paths for native gcc (-m32 and -m64) on…

Authored by MaskRay on Sun, Apr 4, 10:15 AM.

Description

[Driver] Detect libstdc++ include paths for native gcc (-m32 and -m64) on Debian i386

Take gcc-8 on Debian i386 as an example. The target-specific libstdc++ search
path (GPLUSPLUS_TOOL_INCLUDE_DIR) uses the multiarch name i386-linux-gnu,
instead of the triple of the GCC installation i686-linux-gnu (the directory
under usr/lib/gcc/):

/usr/include/c++/8
/usr/include/i386-linux-gnu/c++/8
/usr/include/c++/8/backward

Clang currently detects /usr/lib/gcc/i686-linux-gnu/8/../../../include/i686-linux-gnu/c++/8.
This patch changes the second i686-linux-gnu to i386-linux-gnu so that
/usr/include/i386-linux-gnu/c++/8 can be found.

Fix PR49827 - this was somehow regressed by my previous libstdc++ include path
cleanups and fixes for gcc-cross, but it seems that the paths were never properly tested before.

Differential Revision: https://reviews.llvm.org/D99852