Skip to content
/ rust Public
forked from rust-lang/rust

Commit 7a5a884

Browse files
committed
Make C string merging test work on MIPS
Assembly for MIPS uses, by convention, a different prefix for local anonymous variables.
1 parent f433fa4 commit 7a5a884

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/assembly/cstring-merging.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// MIPS assembler uses the label prefix `$anon.` for local anonymous variables
2+
// other architectures (including ARM and x86-64) use the prefix `.Lanon.`
13
//@ only-linux
24
//@ assembly-output: emit-asm
35
//@ compile-flags: --crate-type=lib -Copt-level=3
@@ -6,21 +8,21 @@
68
use std::ffi::CStr;
79

810
// CHECK: .section .rodata.str1.{{[12]}},"aMS"
9-
// CHECK: .Lanon.{{.+}}:
11+
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
1012
// CHECK-NEXT: .asciz "foo"
1113
#[unsafe(no_mangle)]
1214
static CSTR: &[u8; 4] = b"foo\0";
1315

1416
// CHECK-NOT: .section
15-
// CHECK: .Lanon.{{.+}}:
17+
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
1618
// CHECK-NEXT: .asciz "bar"
1719
#[unsafe(no_mangle)]
1820
pub fn cstr() -> &'static CStr {
1921
c"bar"
2022
}
2123

2224
// CHECK-NOT: .section
23-
// CHECK: .Lanon.{{.+}}:
25+
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
2426
// CHECK-NEXT: .asciz "baz"
2527
#[unsafe(no_mangle)]
2628
pub fn manual_cstr() -> &'static str {

0 commit comments

Comments
 (0)