aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/assembly.js
diff options
context:
space:
mode:
authorPatrick Quist <partouf@gmail.com>2021-03-11 20:35:30 +0100
committerGitHub <noreply@github.com>2021-03-11 20:35:30 +0100
commita0f70d4b0bf6132ca2f432f723cf153bdb485072 (patch)
tree6b42d827071e06cb3ee851a4daf65d1128095a6e /lib/compilers/assembly.js
parent67228de59273562671e1d9584551e0e076722a7f (diff)
downloadcompiler-explorer-a0f70d4b0bf6132ca2f432f723cf153bdb485072.tar.gz
compiler-explorer-a0f70d4b0bf6132ca2f432f723cf153bdb485072.zip
allow other nasm inputformat, add readelf to assembly (#2481)
Diffstat (limited to 'lib/compilers/assembly.js')
-rw-r--r--lib/compilers/assembly.js35
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js
index c1d94fb59..f684b1ba6 100644
--- a/lib/compilers/assembly.js
+++ b/lib/compilers/assembly.js
@@ -52,6 +52,24 @@ export class AssemblyCompiler extends BaseCompiler {
return [];
}
+ getGeneratedOutputFilename(fn) {
+ const outputFolder = path.dirname(fn);
+ const files = fs.readdirSync(outputFolder);
+
+ let outputFilename = super.filename(fn);
+ files.forEach(file => {
+ if (file[0] !== '.' && file !== this.compileFilename) {
+ outputFilename = path.join(outputFolder, file);
+ }
+ });
+
+ return outputFilename;
+ }
+
+ getOutputFilename(dirPath) {
+ return this.getGeneratedOutputFilename(path.join(dirPath, 'example.asm'));
+ }
+
async runCompiler(compiler, options, inputFilename, execOptions) {
if (!execOptions) {
execOptions = this.getDefaultExecOptions();
@@ -69,23 +87,8 @@ export class AssemblyCompiler extends BaseCompiler {
return this.postProcess(asmResult, outputFilename, filters);
}
- getGeneratedOutputFilename(inputFilename) {
- const outputFolder = path.dirname(inputFilename);
-
- return new Promise((resolve, reject) => {
- fs.readdir(outputFolder, (err, files) => {
- files.forEach(file => {
- if (file[0] !== '.' && file !== this.compileFilename) {
- resolve(path.join(outputFolder, file));
- }
- });
- reject('No output file was generated');
- });
- });
- }
-
async objdump(outputFilename, result, maxSize, intelAsm, demangle) {
- const realOutputFilename = await this.getGeneratedOutputFilename(outputFilename);
+ const realOutputFilename = this.getGeneratedOutputFilename(outputFilename);
const dirPath = path.dirname(realOutputFilename);
let args = ['-d', realOutputFilename, '-l', '--insn-width=16'];
if (demangle) args = args.concat('-C');