Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP Added default flags to fix alignment.
There's an issue with compiling C(++) code on 64-bit CPUs running 32-bit OSes, which have 32-bit-aligned allocators. The resulting binary will use aligned accesses in release mode. See romanz/electrs#226 for an example of such issue. This change adds default flags setting alignment to whatever the pointer alignment is. I realize the limitations of this change such as: * Works in Cargo build scripts only (the major use case for `cc` crate) * Is unnecessary if allocator actually supports 64 bit alingment * Is incorrect if allocator supports smaller alignment than what's pointer width. However, resolving this issue requires either matching on all possible triples, which I don't have the time to implement or somehow fetching the configuration for given triple, which I don't know how to do. This is also an experiment to see if it even helps at all.
- Loading branch information