diff options
| author | David Wood <david@davidtw.co> | 2019-05-25 22:29:18 +0100 |
|---|---|---|
| committer | David Wood <david@davidtw.co> | 2019-05-28 20:26:51 +0100 |
| commit | 9c34473ecf87a6f541b9f6404b782eaa484033d7 (patch) | |
| tree | 5e429e71901a4a4640008c240d9e2123331074ba /src/librustc_codegen_utils | |
| parent | 02f5786a324c40b2d8b2d0df98456e48fb45d30c (diff) | |
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`.
Diffstat (limited to 'src/librustc_codegen_utils')
| -rw-r--r-- | src/librustc_codegen_utils/symbol_names.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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), |
