diff options
author | Rubén Rincón Blanco <ruben@rinconblanco.es> | 2022-10-10 15:29:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 15:29:34 +0200 |
commit | 0d09aecc19ad9880c5ab27df295d8305dbd81e43 (patch) | |
tree | 8cd92478c0d104db439a9b04d02a481e6ea54c57 /lib/compilers/rust.ts | |
parent | 2bc257d89d6fd9bc455fe71112ab5751b65bf691 (diff) | |
download | compiler-explorer-0d09aecc19ad9880c5ab27df295d8305dbd81e43.tar.gz compiler-explorer-0d09aecc19ad9880c5ab27df295d8305dbd81e43.zip |
Fix --emit llvm-ir when asked to emit binary mode (#4131)gh-4453
Diffstat (limited to 'lib/compilers/rust.ts')
-rw-r--r-- | lib/compilers/rust.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/compilers/rust.ts b/lib/compilers/rust.ts index a9fc71d5a..e1ba06316 100644 --- a/lib/compilers/rust.ts +++ b/lib/compilers/rust.ts @@ -32,6 +32,7 @@ import {BuildEnvDownloadInfo} from '../buildenvsetup/buildenv.interfaces'; import {parseRustOutput} from '../utils'; import {RustParser} from './argument-parsers'; +import {ParseFilters} from '../../types/features/filters.interfaces'; export class RustCompiler extends BaseCompiler { linker: string; @@ -137,7 +138,7 @@ export class RustCompiler extends BaseCompiler { if (this.linker) { options = options.concat(`-Clinker=${this.linker}`); } - } else if (!filters.binary) { + } else { if (!userRequestedEmit) { options = options.concat('--emit', 'asm'); } @@ -148,8 +149,13 @@ export class RustCompiler extends BaseCompiler { } // Override the IR file name method for rustc because the output file is different from clang. - override getIrOutputFilename(inputFilename) { - return this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase).replace('.s', '.ll'); + override getIrOutputFilename(inputFilename: string, filters: ParseFilters): string { + const outputFilename = this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase); + // As per #4054, if we are asked for binary mode, the output will be in the .s file, no .ll will be emited + if (!filters.binary) { + return outputFilename.replace('.s', '.ll'); + } + return outputFilename; } override getArgumentParser() { |