Files
scx-upstream/meson-scripts/get_sys_incls
Eric Long 7e4f77fe76 Fix build on non-x86 architectures
- Use single dollar sign instead of double since it is already single-quoted, so no need to escape.
- Reorder include arguments so that scheds/include/vmlinux.h does not override arch/*/vmlinux.h.

Tested and built successfully on real RISC-V hardware after applying the patch.
2024-11-29 15:31:33 +08:00

22 lines
640 B
Bash
Executable File

#!/bin/bash
set -e
clang="$1"
#
# Get Clang's default includes on this system, as opposed to those seen by
# '-target bpf'. This fixes "missing" files on some architectures/distros,
# such as asm/byteorder.h, asm/socket.h, asm/sockios.h, sys/cdefs.h etc.
#
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
#
"$clang" -v -E - < /dev/null 2>&1 \
| sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }' \
"$clang" -dM -E - < /dev/null \
| grep '__riscv_xlen ' \
| awk '{printf("-D__riscv_xlen=%d -D__BITS_PER_LONG=%d", $3, $3)}'