Add tests for -Zdwarf-version lto behavior
This commit is contained in:
parent
30865107cb
commit
cd3dd5bd23
5 changed files with 48 additions and 0 deletions
5
tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs
Normal file
5
tests/assembly/auxiliary/dwarf-mixed-versions-lto-aux.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
//@ compile-flags: -g --crate-type=rlib -Zdwarf-version=4
|
||||
|
||||
pub fn check_is_even(number: &u64) -> bool {
|
||||
number % 2 == 0
|
||||
}
|
19
tests/assembly/dwarf-mixed-versions-lto.rs
Normal file
19
tests/assembly/dwarf-mixed-versions-lto.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// This test ensures that if LTO occurs between crates with different DWARF versions, we
|
||||
// will choose the highest DWARF version for the final binary. This matches Clang's behavior.
|
||||
|
||||
//@ only-linux
|
||||
//@ aux-build:dwarf-mixed-versions-lto-aux.rs
|
||||
//@ compile-flags: -C lto -g -Zdwarf-version=5
|
||||
//@ assembly-output: emit-asm
|
||||
//@ no-prefer-dynamic
|
||||
|
||||
extern crate dwarf_mixed_versions_lto_aux;
|
||||
|
||||
fn main() {
|
||||
dwarf_mixed_versions_lto_aux::check_is_even(&0);
|
||||
}
|
||||
|
||||
// CHECK: .section .debug_info
|
||||
// CHECK-NOT: {{\.(short|hword)}} 2
|
||||
// CHECK-NOT: {{\.(short|hword)}} 4
|
||||
// CHECK: {{\.(short|hword)}} 5
|
5
tests/ui/lto/auxiliary/dwarf-mixed-versions-lto-aux.rs
Normal file
5
tests/ui/lto/auxiliary/dwarf-mixed-versions-lto-aux.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
//@ compile-flags: -g --crate-type=rlib -Zdwarf-version=4
|
||||
|
||||
pub fn say_hi() {
|
||||
println!("hello there")
|
||||
}
|
15
tests/ui/lto/dwarf-mixed-versions-lto.rs
Normal file
15
tests/ui/lto/dwarf-mixed-versions-lto.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// This test verifies that we do not produce a warning when performing LTO on a
|
||||
// crate graph that contains a mix of different DWARF version settings. This
|
||||
// matches Clang's behavior.
|
||||
|
||||
//@ ignore-msvc Platform must use DWARF
|
||||
//@ aux-build:dwarf-mixed-versions-lto-aux.rs
|
||||
//@ compile-flags: -C lto -g -Zdwarf-version=5
|
||||
//@ no-prefer-dynamic
|
||||
//@ build-pass
|
||||
|
||||
extern crate dwarf_mixed_versions_lto_aux;
|
||||
|
||||
fn main() {
|
||||
dwarf_mixed_versions_lto_aux::say_hi();
|
||||
}
|
4
tests/ui/lto/dwarf-mixed-versions-lto.stderr
Normal file
4
tests/ui/lto/dwarf-mixed-versions-lto.stderr
Normal file
|
@ -0,0 +1,4 @@
|
|||
warning: linking module flags 'Dwarf Version': IDs have conflicting values ('i32 4' from with 'i32 5' from dwarf_mixed_versions_lto.7f4a44b55cf2f174-cgu.0)
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue