Rollup merge of #139971 - LukasWoodtli:gardena/lw/fix-cstring-merging-test, r=wesleywiser
Make C string merging test work on MIPS Assembly for MIPS uses, by convention, a different prefix for local anonymous variables.
This commit is contained in:
commit
18f6c595ee
1 changed files with 5 additions and 3 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
// MIPS assembler uses the label prefix `$anon.` for local anonymous variables
|
||||||
|
// other architectures (including ARM and x86-64) use the prefix `.Lanon.`
|
||||||
//@ only-linux
|
//@ only-linux
|
||||||
//@ assembly-output: emit-asm
|
//@ assembly-output: emit-asm
|
||||||
//@ compile-flags: --crate-type=lib -Copt-level=3
|
//@ compile-flags: --crate-type=lib -Copt-level=3
|
||||||
|
@ -6,13 +8,13 @@
|
||||||
use std::ffi::CStr;
|
use std::ffi::CStr;
|
||||||
|
|
||||||
// CHECK: .section .rodata.str1.{{[12]}},"aMS"
|
// CHECK: .section .rodata.str1.{{[12]}},"aMS"
|
||||||
// CHECK: .Lanon.{{.+}}:
|
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
|
||||||
// CHECK-NEXT: .asciz "foo"
|
// CHECK-NEXT: .asciz "foo"
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
static CSTR: &[u8; 4] = b"foo\0";
|
static CSTR: &[u8; 4] = b"foo\0";
|
||||||
|
|
||||||
// CHECK-NOT: .section
|
// CHECK-NOT: .section
|
||||||
// CHECK: .Lanon.{{.+}}:
|
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
|
||||||
// CHECK-NEXT: .asciz "bar"
|
// CHECK-NEXT: .asciz "bar"
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub fn cstr() -> &'static CStr {
|
pub fn cstr() -> &'static CStr {
|
||||||
|
@ -20,7 +22,7 @@ pub fn cstr() -> &'static CStr {
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-NOT: .section
|
// CHECK-NOT: .section
|
||||||
// CHECK: .Lanon.{{.+}}:
|
// CHECK: {{(\.L|\$)}}anon.{{.+}}:
|
||||||
// CHECK-NEXT: .asciz "baz"
|
// CHECK-NEXT: .asciz "baz"
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub fn manual_cstr() -> &'static str {
|
pub fn manual_cstr() -> &'static str {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue