Tracking issue for all the ways in which -C compiler flags can alter the ABI #131837
Open
Description
opened on Oct 17, 2024
If a -C
flag alters the ABI, mixing crates built with different flags causes UB. This issue is gathering all the ways in which this can happen, so that we can figure out what to do with them. The general goal is to make it impossible to alter these flags without realizing that they are "special" and need to be set consistently across all crates. Ideally rustc can even check that they are set consistently, though that will not cover dynamic linking.
-Ctarget-features
can affect the ABI in a bunch of ways- The
extern "C"
ABI of SIMD vector types depends on target features (tracking issue forabi_unsupported_vector_types
future-incompatibility lint) #116558 - The ABI of float types can be changed by
-Ctarget-feature
#116344 - The (stable)
neon
aarch64 target feature is unsound: it changes the float ABI #131058 - x86-32 "f16" ABI needs SSE, incompatible with i586 targets #131819
- -C target-feature/-C target-cpu are unsound #64609
- Warn if feature settings may break compilation #89586
- The
-Crelocation-model=rwpi
(and possibly others) are unsound due to affecting the ABI #131300- -Csoft-float flag is unsound #129893
-Cllvm-args
can set all sorts of flags, some of which can change the ABI
Flags that are sus:
-Cno-redzone
could potentially be a problem- Probably
-Clink-arg(s)
can also do bad shenanigans... but it can't really affect ABI, can it? The ABI is already baked into the object files at this point.
This list might be incomplete!
Activity