mirror of https://github.com/lukechilds/cc-rs.git
Browse Source
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 https://github.com/romanz/electrs/issues/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.fix-alignment
Martin Habovstiak
5 years ago
1 changed files with 18 additions and 0 deletions
Loading…
Reference in new issue