about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2023-10-06 16:37:47 -0700
committerGitHub <noreply@github.com>2023-10-06 16:37:47 -0700
commit5268120d4a10a879b0fe8aae0ffa9443b3e45266 (patch)
tree740690764eb0419fabe46d71575e036ae8c6f141
parent0d68e416a568ae0e206bcf65a2c5234565ba3bf5 (diff)
parentecf271cfb6224fae07a2b096bfbae22c6112b011 (diff)
downloadrust-5268120d4a10a879b0fe8aae0ffa9443b3e45266.tar.gz
rust-5268120d4a10a879b0fe8aae0ffa9443b3e45266.zip
Rollup merge of #116458 - bjorn3:fix_global_asm_test, r=workingjubilee
Properly export function defined in test which uses global_asm!()

Currently the test passes with the LLVM backend as the codegen unit partitioning logic happens to place both the global_asm!() and the function which calls the function defined by the global_asm!() in the same CGU. With the Cranelift backend it breaks however as it will place all assembly in separate codegen units to be passed to an external linker.
-rw-r--r--tests/ui/asm/x86_64/issue-96797.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/ui/asm/x86_64/issue-96797.rs b/tests/ui/asm/x86_64/issue-96797.rs
index 951dd949b32..6c22c2f6c94 100644
--- a/tests/ui/asm/x86_64/issue-96797.rs
+++ b/tests/ui/asm/x86_64/issue-96797.rs
@@ -11,7 +11,14 @@ use std::arch::global_asm;
 #[no_mangle]
 fn my_func() {}
 
-global_asm!("call_foobar: jmp {}", sym foobar);
+global_asm!("
+.globl call_foobar
+.type call_foobar,@function
+.pushsection .text.call_foobar,\"ax\",@progbits
+call_foobar: jmp {}
+.size call_foobar, .-call_foobar
+.popsection
+", sym foobar);
 
 fn foobar() {}