On Windows link.exe requires that the alignment of any section is less than or equal to the /ALIGN value. Statics with an alignment of 8192 or greater cause the section to have an alignment of 8192 (but not greater, see #70022), but link.exe has a default /ALIGN of 4096 causing fatal error LNK1164: section 0x6 alignment (8192) greater than /ALIGN value. Specifying -Clink-arg="/ALIGN:8192" causes the error to go away.
Minimal example
#[repr(align(0x100000))]
struct Aligned(u8);
static X: Aligned = Aligned(0);
fn main() {
println!("{:#x}", &X as *const _ as usize);
}
On Windows
link.exerequires that the alignment of any section is less than or equal to the/ALIGNvalue. Statics with an alignment of 8192 or greater cause the section to have an alignment of 8192 (but not greater, see #70022), butlink.exehas a default/ALIGNof 4096 causingfatal error LNK1164: section 0x6 alignment (8192) greater than /ALIGN value. Specifying-Clink-arg="/ALIGN:8192"causes the error to go away.Minimal example