about summary refs log tree commit diff
path: root/tests/codegen-llvm
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-08-08 12:52:57 +1000
committerGitHub <noreply@github.com>2025-08-08 12:52:57 +1000
commit432a4f27fe5f1703af0277cd6b2e855ec47996f4 (patch)
treeeaa6e666eed89ddcb7c81b70f18b99fe2320d9cb /tests/codegen-llvm
parente4b2fad8c9c8e99cb1c68c79441dc698c3435573 (diff)
parent6c02653c4a564a2a1509dc55bdec2e5b8f02bdd9 (diff)
Rollup merge of #145051 - bjorn3:prevent_linkage_symbol_name_collision, r=petrochenkov
Prevent name collisions with internal implementation details

The implementation of the linkage attribute inside extern blocks defines symbols starting with _rust_extern_with_linkage_. If someone tries to also define this symbol you will get a symbol conflict or even an ICE. By adding an unpredictable component to the symbol name, this becomes less of an issue.

Spawned from the discussion at [#t-compiler > About static variables &#96;_rust_extern_with_linkage_&#42;&#96;](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/About.20static.20variables.20.60_rust_extern_with_linkage_*.60) cc `@ywxt`

Fixes https://github.com/rust-lang/rust/issues/144940
Diffstat (limited to 'tests/codegen-llvm')
-rw-r--r--tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs
index 00e9b5029af..b3cb6dfdd37 100644
--- a/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs
+++ b/tests/codegen-llvm/sanitizer/cfi/external_weak_symbols.rs
@@ -10,7 +10,7 @@ unsafe extern "C" {
     #[linkage = "extern_weak"]
     static FOO: Option<unsafe extern "C" fn(f64) -> ()>;
 }
-// CHECK: @_rust_extern_with_linkage_FOO = internal global ptr @FOO
+// CHECK: @_rust_extern_with_linkage_{{.*}}_FOO = internal global ptr @FOO
 
 fn main() {
     unsafe {