Commit 0849a67
Fix AltiVec bool keyword conflict with wrapper header
GCC's AltiVec extension makes 'bool' a keyword meaning '__vector __bool
int' when compiling with -maltivec. This conflicts with C99/C11 stdbool.h
where bool means _Bool, breaking all scalar bool usage in HACL* BLAKE2
SIMD128 code.
Note: the simpler -Dbool=_Bool approach does not work because altivec.h
re-enables the keyword after the macro is defined.
The fix is a small wrapper header (ppc_altivec_fix.h) that:
1. Includes altivec.h (which activates the bool keyword)
2. Immediately #undefs bool/true/false
3. Redefines them as C99 _Bool/1/0
This header is force-included (-include) via LIBHACL_SIMD128_FLAGS
before HACL source files. The __ALTIVEC__ guard ensures it only
activates on PowerPC. Vector boolean types remain available via
the explicit __vector __bool syntax.
This is a known GCC/AltiVec interaction; the same approach is used
by FFmpeg and other projects that mix AltiVec intrinsics with C99.
Verified: Hacl_Hash_Blake2s_Simd128.c compiles cleanly on POWER8
(GCC 10.5, -maltivec -mvsx -std=c11) producing a valid ELF64 object.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 40e72eb commit 0849a67
3 files changed
+39
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8133 | 8133 | | |
8134 | 8134 | | |
8135 | 8135 | | |
8136 | | - | |
| 8136 | + | |
8137 | 8137 | | |
8138 | 8138 | | |
8139 | 8139 | | |
| |||
0 commit comments