Feature: Disable hardcoded 32-bit ARM builtins & remove linux asm/types.h kernel header dependency
- Dominant language
- C++
- Stars
- 3k
- Forks
- 352
- PR merge metrics
- No merged PRs in 30d
Description
### Environment Info
- Platform: Android Termux AArch64 (pure 64-bit environment, no 32-bit ARM sysroot/kernel headers)
- Build Command:
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PREFIX -G Ninja -DISPC_TARGETS="aarch64-linux"
ninja
### Core Problems
1. Hardcoded 32-bit armv8a builtin generation, independent of `-DISPC_TARGETS`
Even if I only declare aarch64-linux as target architecture, the build script unconditionally generates 32-bit armv8a bitcode via hardcoded `ALL_ARCHS` list in GenerateBuiltins.cmake.
Pure 64-bit Termux does not carry any 32-bit system headers, causing fatal compile errors. There is zero official cache switch to skip all 32-bit ARM tasks.
2. Unreasonable forced dependency on Linux internal kernel header ``
The builtin source code directly references private Linux kernel header `asm/types.h`, which is not part of standard POSIX / libc public headers.
- Mobile environments like Termux only provide minimal user-space libc headers, no kernel asm headers by default.
- This header is Linux platform-specific, breaks cross-platform portability for Android/embedded AArch64 devices.
- Standard C/C++ user-space code should never rely on internal kernel asm headers for basic type definitions.
3. Manual script modification is error-prone
To bypass the above errors, users have to manually edit CMake scripts to delete armv8a entries and drop 32-bit runtime loops. Editing nested if/else blocks easily triggers CMake syntax configure failures.
### Full Compile Error Log
Expand fatal missing header error output
Expected Improvements
1. Add a CMake cache option BUILD_32BIT_ARM=OFF to exclude armv8a from ALL_ARCHS and skip 32-bit runtime build loops.
2. Refactor builtin source code: Replace dependency on non-portable with standard C fixed-width integer types (stdint.h, uint64_t, int32_t etc.) to eliminate Linux kernel header reliance.
3. Decouple builtin architecture generation logic from hardcoded lists, respect the -DISPC_TARGETS filter to only build required architectures.
Temporary Working Workaround
Edit cmake/GenerateBuiltins.cmake before compilation:
1. Change set(ALL_ARCHS armv8a aarch64 x86 x86_64) → set(ALL_ARCHS aarch64 x86_64)
2. Replace foreach(RUNTIME 32 64) → foreach(RUNTIME 64)
After these two changes, all 32-bit ARM build tasks are removed, compilation proceeds normally (still requires separate fix for the asm/types.h header dependency).
Contributor guide
Assessment
This issue has not been assessed yet.