diff options
author | Matt Godbolt <matt@godbolt.org> | 2020-05-28 23:11:03 -0500 |
---|---|---|
committer | Matt Godbolt <matt@godbolt.org> | 2020-05-28 23:11:03 -0500 |
commit | 263ff0ed727f87bab61b8cfaa04e3684886ec96f (patch) | |
tree | b9506ec3ef467113d502c25f84b702941be5da8c /lib/compilers/rust.js | |
parent | 65a643e1bc90413024a00dc3a19d6967800808fc (diff) | |
download | compiler-explorer-263ff0ed727f87bab61b8cfaa04e3684886ec96f.tar.gz compiler-explorer-263ff0ed727f87bab61b8cfaa04e3684886ec96f.zip |
Support binary in rust.
Closes #509
Diffstat (limited to 'lib/compilers/rust.js')
-rw-r--r-- | lib/compilers/rust.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/compilers/rust.js b/lib/compilers/rust.js index 24499e435..2b073a918 100644 --- a/lib/compilers/rust.js +++ b/lib/compilers/rust.js @@ -33,6 +33,7 @@ class RustCompiler extends BaseCompiler { this.compiler.supportsIntel = true; this.compiler.supportsIrView = true; this.compiler.irArg = ['--emit', 'llvm-ir']; + this.linker = this.compilerProps("linker"); } getSharedLibraryPathsAsArguments() { @@ -42,15 +43,19 @@ class RustCompiler extends BaseCompiler { optionsForFilter(filters, outputFilename, userOptions) { let options = ['-C', 'debuginfo=1', '-o', this.filename(outputFilename)]; - let userRequestedEmit = _.any(userOptions, opt => opt.indexOf("--emit") > -1); - //TODO: Binary not supported (?) - if (!filters.binary) { + const userRequestedEmit = _.any(userOptions, opt => opt.indexOf("--emit") > -1); + if (filters.binary) { + options = options.concat(['--crate-type', 'bin']); + if (this.linker) { + options = options.concat(`-Clinker=${this.linker}`); + } + } else if (!filters.binary) { if (!userRequestedEmit) { options = options.concat('--emit', 'asm'); } if (filters.intel) options = options.concat('-Cllvm-args=--x86-asm-syntax=intel'); + options = options.concat(['--crate-type', 'rlib']); } - options = options.concat(['--crate-type', 'rlib']); return options; } |