tests/ui/sanitizer/hwaddress.rs: Run on aarch64 and remove cgu hack

To avoid linker errors like

    relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against `.data.rel.ro..L.hwasan'

we need to have `-C target-feature=+tagged-globals`, which is documented here:
https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#hwaddresssanitizer
This commit is contained in:
Martin Nordholts 2025-10-18 09:29:21 +02:00
parent 4f08307f6e
commit 38a17905b7
2 changed files with 10 additions and 5 deletions

View file

@ -1,11 +1,7 @@
//@ needs-sanitizer-support
//@ needs-sanitizer-hwaddress
//
// FIXME(#83706): this test triggers errors on aarch64-gnu
//@ ignore-aarch64-unknown-linux-gnu
//
// FIXME(#83989): codegen-units=1 triggers linker errors on aarch64-gnu
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C codegen-units=16 -C unsafe-allow-abi-mismatch=sanitizer
//@ compile-flags: -Z sanitizer=hwaddress -O -g -C target-feature=+tagged-globals -C unsafe-allow-abi-mismatch=sanitizer
//
//@ run-fail
//@ error-pattern: HWAddressSanitizer: tag-mismatch
@ -19,3 +15,5 @@ fn main() {
let code = unsafe { *xs.offset(4) };
std::process::exit(code);
}
//~? WARN unknown and unstable feature specified for `-Ctarget-feature`: `tagged-globals`

View file

@ -0,0 +1,7 @@
warning: unknown and unstable feature specified for `-Ctarget-feature`: `tagged-globals`
|
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
= help: consider filing a feature request
warning: 1 warning emitted