Skip to content

Commit c11be67

Browse files
authored
Rollup merge of #151571 - androm3da:bcain/cstr_merge, r=tgross35
Fix cstring-merging test for Hexagon target Hexagon assembler uses `.string` directive instead of `.asciz` for null-terminated strings. Both are equivalent but the test was only checking for `.asciz`. Update the CHECK patterns to accept both directives using `.{{asciz|string}}` regex pattern.
2 parents f6cc562 + e558544 commit c11be67

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/assembly-llvm/cstring-merging.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// MIPS assembler uses the label prefix `$anon.` for local anonymous variables
22
// other architectures (including ARM and x86-64) use the prefix `.Lanon.`
3+
// Hexagon uses `.string` instead of `.asciz` for null-terminated strings
34
//@ only-linux
45
//@ assembly-output: emit-asm
56
//@ compile-flags: --crate-type=lib -Copt-level=3 -Cllvm-args=-enable-global-merge=0
@@ -9,21 +10,21 @@ use std::ffi::CStr;
910

1011
// CHECK: .section .rodata.str1.{{[12]}},"aMS"
1112
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
12-
// CHECK-NEXT: .asciz "foo"
13+
// CHECK-NEXT: .{{asciz|string}} "foo"
1314
#[unsafe(no_mangle)]
1415
static CSTR: &[u8; 4] = b"foo\0";
1516

1617
// CHECK-NOT: .section
1718
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
18-
// CHECK-NEXT: .asciz "bar"
19+
// CHECK-NEXT: .{{asciz|string}} "bar"
1920
#[unsafe(no_mangle)]
2021
pub fn cstr() -> &'static CStr {
2122
c"bar"
2223
}
2324

2425
// CHECK-NOT: .section
2526
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
26-
// CHECK-NEXT: .asciz "baz"
27+
// CHECK-NEXT: .{{asciz|string}} "baz"
2728
#[unsafe(no_mangle)]
2829
pub fn manual_cstr() -> &'static str {
2930
"baz\0"

0 commit comments

Comments
 (0)