Commit 456a4f5
committed
[libc][cmake][linux] require new LLVM_LIBC_USE_HOST_KERNEL_HEADERS or LIBC_KERNEL_HEADERS
When cross compiling, we DO NOT want to use the host's kernel headers. Adding
all of /usr/include via `-dirafter` also isn't very hermetic since it can pull
in more than just kernel headers. But peeking at /usr/include simplifies
setting up the libc, since then the kernel headers don't have to be built from
source. (Building kernel headers from source is quite trivial though).
We already support setting -DLIBC_KERNEL_HEADERS=/path/to/kernel/headers. Add a
new boolean cmake flag, LLVM_LIBC_USE_HOST_KERNEL_HEADERS, which indicates that
the user is opting into just using the hosts kernel headers. Existing host
builds may break and need to set this.
Setting LIBC_KERNEL_HEADERS currently produces a few unit test failures that I
still need to debug, but ideally users targeting linux will always pass
LIBC_KERNEL_HEADERS in the future.
Add some checks to ensure that at least one of these flags are set, that
they're mutually exclusive, that the headers are required when cross compiling,
and that the headers path is a directory.1 parent 953354c commit 456a4f5
File tree
3 files changed
+27
-1
lines changed- libc
- cmake/modules
- docs
3 files changed
+27
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
219 | 240 | | |
220 | 241 | | |
221 | 242 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
0 commit comments