about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2024-10-08 13:19:43 +1100
committerGitHub <noreply@github.com>2024-10-08 13:19:43 +1100
commit4d638960186c3ee5485a1e0738e4a5c3df5ef62b (patch)
tree442c3973ebdd46a0d3602b06bda1305592391a06 /tests/codegen
parent3ae715c8c63f9aeac47cbf7d8d9dadb3fa32c638 (diff)
parent540e41f8b3822661d2f9d0768bbfe1dd3bb65e4d (diff)
downloadrust-4d638960186c3ee5485a1e0738e4a5c3df5ef62b.tar.gz
rust-4d638960186c3ee5485a1e0738e4a5c3df5ef62b.zip
Rollup merge of #130824 - Darksonn:fix-function-return, r=wesleywiser
Add missing module flags for `-Zfunction-return=thunk-extern`

This fixes a bug in the `-Zfunction-return=thunk-extern` flag. The flag needs to be passed onto LLVM to ensure that functions such as `asan.module_ctor` and `asan.module_dtor` that are created internally in LLVM have the mitigation applied to them.

This was originally discovered [in the Linux kernel](https://lore.kernel.org/all/CANiq72myZL4_poCMuNFevtpYYc0V0embjSuKb7y=C+m3vVA_8g@mail.gmail.com/).

Original flag PR: #116892
PR for similar issue: #129373
Tracking issue: #116853

cc ``@ojeda``
r? ``@wesleywiser``
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/function-return.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs
index 0ca1a41ee86..2b9de4e1478 100644
--- a/tests/codegen/function-return.rs
+++ b/tests/codegen/function-return.rs
@@ -26,3 +26,9 @@ pub fn foo() {
     // keep-thunk-extern: attributes #0 = { {{.*}}fn_ret_thunk_extern{{.*}} }
     // thunk-extern-keep-NOT: fn_ret_thunk_extern
 }
+
+// unset-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
+// keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
+// thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
+// keep-thunk-extern: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}
+// thunk-extern-keep-NOT: !{{[0-9]+}} = !{i32 4, !"function_return_thunk_extern", i32 1}