From 9c34473ecf87a6f541b9f6404b782eaa484033d7 Mon Sep 17 00:00:00 2001 From: David Wood Date: Sat, 25 May 2019 22:29:18 +0100 Subject: Special-case `.llvm` in mangler to fix segfaults This commit special cases `.llvm` in the mangler to print `.llvm$6d$` instead. This will avoid segfaults when names in a user's Rust code are `llvm`. --- src/librustc_codegen_utils/symbol_names.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/librustc_codegen_utils') diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 1a8647ed197..5a342114fe8 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -613,6 +613,9 @@ impl fmt::Write for SymbolPrinter<'_, '_> { // for ':' and '-' '-' | ':' => self.path.temp_buf.push('.'), + // Avoid segmentation fault on some platforms, see #60925. + 'm' if self.path.temp_buf.ends_with(".llv") => self.path.temp_buf.push_str("$6d$"), + // These are legal symbols 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' | '.' | '$' => self.path.temp_buf.push(c), -- cgit 1.4.1-3-g733a5