Force code generation in assembly generation smoke-tests

In llvm/llvm-project@7b23f413d1 , `.text`
started being suppressed from LLVM assembly in cases where it wasn't
strictly necessary. Currently, the sample functions in these two tests
are frequently decided to be IR-only functions, resulting in no code
generation, so LLVM drops the `.text` directive.

Adding `#[no_mangle]` forces these tests back to their original intent -
assembly code is generated, and so a `.text` directive is generated as
well.
This commit is contained in:
Matthew Maurer 2025-01-03 22:21:39 +00:00
parent 6c8347b958
commit cf679e4281
2 changed files with 4 additions and 0 deletions

View File

@ -676,6 +676,8 @@
#[lang = "sized"]
trait Sized {}
// Force linkage to ensure code is actually generated
#[no_mangle]
pub fn test() -> u8 {
42
}

View File

@ -83,6 +83,8 @@
#[lang = "sized"]
trait Sized {}
// Force linkage to ensure code is actually generated
#[no_mangle]
pub fn test() -> u8 {
42
}