llvm-project/clang/lib/Driver
Fangrui Song c37022b22a [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl
On a musl-based Linux distribution, stdalign.h stdarg.h stdbool.h stddef.h stdint.h stdnoreturn.h are expected to be provided by musl (/usr/include), instead of RESOURCE_DIR/include.
Reorder RESOURCE_DIR/include to fix the search order problem.
(Currently musl doesn't provide stdatomic.h. stdatomic.h is still found in RESOURCE_DIR/include.)

gcc on musl has a similar search order:

```
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/x86_64-alpine-linux-musl
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/../../../../include/c++/8.3.0/backward
 /usr/local/include
 /usr/include/fortify
 /usr/include
 /usr/lib/gcc/x86_64-alpine-linux-musl/8.3.0/include
```

This is different from a glibc-based distribution where RESOURCE_DIR/include is placed before SYSROOT/usr/include.

According to the maintainer of musl:

> musl does not support use/mixing of compiler-provided std headers with its headers, and intentionally has no mechanism for communicating with such headers as to which types have already been defined or still need to be defined. If the current include order, with clang's headers before the libc ones, works in some situations, it's only by accident.

Reviewed by: phosek

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

llvm-svn: 367981
2019-08-06 06:25:32 +00:00
..
ToolChains [Driver] Prioritize SYSROOT/usr/include over RESOURCE_DIR/include on linux-musl 2019-08-06 06:25:32 +00:00
Action.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CMakeLists.txt [PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power 2019-04-23 05:50:24 +00:00
Compilation.cpp Rename F_{None,Text,Append} to OF_{None,Text,Append}. NFC 2019-08-05 05:43:48 +00:00
DarwinSDKInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Distro.cpp Debian: Add two missing version code in sid 2019-04-19 13:48:52 +00:00
Driver.cpp [NFC][clang] Refactor getCompilationPhases()+Types.def step 1. 2019-07-22 23:10:10 +00:00
DriverOptions.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
InputInfo.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Job.cpp Fix unquoted spaces in args in clang --verbose output 2019-04-24 09:06:03 +00:00
Multilib.cpp [Driver] Support priority for multilibs 2019-04-27 00:25:11 +00:00
Phases.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
SanitizerArgs.cpp [Driver] Don't disable -fsanitizer-coverage for safe-stack or shadow-call-stack 2019-08-05 04:48:56 +00:00
Tool.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ToolChain.cpp [Driver] -noprofilelib flag 2019-07-11 19:06:38 +00:00
Types.cpp [NFC][clang] Refactor getCompilationPhases()+Types.def step 3. 2019-07-31 20:40:08 +00:00
XRayArgs.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00