Description
Since nightly release 2023-03-25
, we've had build failures for agb
(https://github.com/agbrs/agb) with message Cannot represent a difference across sections
when lto is enabled.
If I disable LTO, the build succeeds and the test passes. There are many similar tests which do currently build and run successfully with this version, it is only one specific test we have which is causing the issue.
Code
You can reproduce the issue if you build the test_save_eeprom_512b
test in release mode:
$ cargo build --test=test_save_eeprom_512b --release
I haven't been able to work out what actually causes this, and it seems to require a reasonable amount of code before the issue gets triggered.
Version it worked on
It most recently worked on: Rust nightly 2023-03-23
Version with regression
rustc --version --verbose
:
rustc 1.70.0-nightly (0c61c7a97 2023-03-25)
binary: rustc
commit-hash: 0c61c7a978fe9f7b77a1d667c77d2202dadd1c10
commit-date: 2023-03-25
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 16.0.0
Compiler output
The error message isn't particularly helpful here, but here is the full output from our github action:
(cd "agb" && cargo build --release --examples --tests)
Compiling autocfg v1.1.0
Compiling proc-macro2 v1.0.53
Compiling unicode-ident v1.0.8
Compiling quote v1.0.26
Compiling cfg-if v1.0.0
Compiling syn v2.0.10
Compiling compiler_builtins v0.1.87
Compiling core v0.0.0 (/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
Compiling num-traits v0.2.15
Compiling serde_derive v1.0.158
Compiling num-integer v0.1.45
Compiling libc v0.2.140
Compiling crc32fast v1.3.2
Compiling rustc-std-workspace-core v1.99.0 (/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
Compiling serde v1.0.158
Compiling alloc v0.0.0 (/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
Compiling version_check v0.9.4
Compiling adler32 v1.2.0
Compiling ahash v0.7.6
Compiling indexmap v1.9.3
Compiling num-iter v0.1.43
Compiling num-rational v0.3.2
Compiling byteorder v1.4.3
Compiling deflate v0.8.6
Compiling getrandom v0.2.8
Compiling miniz_oxide v0.3.7
Compiling log v0.4.17
Compiling hashbrown v0.12.3
Compiling once_cell v1.17.1
Compiling adler v1.0.2
Compiling syn v1.0.109
Compiling bitflags v1.3.2
Compiling png v0.16.8
Compiling serde_spanned v0.6.1
Compiling toml_datetime v0.6.1
Compiling miniz_oxide v0.6.2
Compiling color_quant v1.1.0
Compiling bytemuck v1.13.1
Compiling winnow v0.4.1
Compiling image v0.23.14
Compiling toml_edit v0.19.8
Compiling flate2 v1.0.25
Compiling hashbrown v0.11.2
Compiling nohash v0.2.0
Compiling ttf-parser v0.15.2
Compiling fontdue v0.7.2
Compiling asefile v0.3.5
Compiling toml v0.7.3
Compiling static_assertions v1.1.0
Compiling agb_macros v0.13.0 (/home/runner/work/agb/agb/agb-macros)
Compiling modular-bitfield-impl v0.11.2
Compiling hound v3.5.0
Compiling agb v0.13.0 (/home/runner/work/agb/agb/agb)
Compiling agb_sound_converter v0.13.0 (/home/runner/work/agb/agb/agb-sound-converter)
Compiling modular-bitfield v0.11.2
Compiling agb_fixnum v0.13.0 (/home/runner/work/agb/agb/agb-fixnum)
Compiling agb_image_converter v0.13.0 (/home/runner/work/agb/agb/agb-image-converter)
Compiling bare-metal v1.0.0
Compiling rustc-hash v1.1.0
Compiling bitflags v2.0.2
error: Cannot represent a difference across sections
error: could not compile `agb` (test "test_save_eeprom_512b") due to previous error