diff --git a/docs/AddingACompiler.md b/docs/AddingACompiler.md index 18115cecd..517956d58 100644 --- a/docs/AddingACompiler.md +++ b/docs/AddingACompiler.md @@ -93,6 +93,7 @@ once the site runs on the Amazon environment, the `&clang` group **will not** ha | intelAsm | String | Flags used to select intel assembly format (if not detected automatically) | | needsMulti | Boolean | Whether the compiler needs multi arch support (defaults to yes if the host has multiarch enabled) | | supportsBinary | Boolean | Whether this compiler supports compiling to binary | +|supportsBinaryObject | Boolean | Whether this compiler supports compiling to binary object (e.g. assembling to binary) | | supportsExecute | Boolean | Whether binary output from this compiler can be executed | | versionFlag | String | The flag to pass to the compiler to make it emit its version | | versionRe | RegExp | A regular expression used to capture the version from the version output | diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 62dbb9b7a..5ad338aba 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -1416,6 +1416,7 @@ export class BaseCompiler { const outputFilename = this.getExecutableFilename(dirPath, this.outputFilebase, key); const buildFilters: ParseFilters = Object.assign({}, key.filters); + buildFilters.binaryobject = false; buildFilters.binary = true; buildFilters.execute = true; @@ -2099,6 +2100,8 @@ export class BaseCompiler { for (const key in filters) { filters[key] = false; } + if (filters.binaryobject && !this.compiler.supportsBinaryObject) { + delete filters.binaryobject; } const executeParameters = { diff --git a/lib/compiler-finder.js b/lib/compiler-finder.js index 4fbadad5f..8b3fa228b 100644 --- a/lib/compiler-finder.js +++ b/lib/compiler-finder.js @@ -176,6 +176,7 @@ export class CompilerFinder { const ceToolsPath = props('ceToolsPath', './'); const supportsBinary = !!props('supportsBinary', true); + const supportsBinaryObject = !!props('supportsBinaryObject', false); const interpreted = !!props('interpreted', false); const supportsExecute = (interpreted || supportsBinary) && !!props('supportsExecute', true); const executionWrapper = props('executionWrapper', ''); @@ -237,6 +238,7 @@ export class CompilerFinder { adarts: props('adarts', ''), supportsDemangle: !!demangler, supportsBinary, + supportsBinaryObject, interpreted, supportsExecute, executionWrapper, diff --git a/lib/options-handler.js b/lib/options-handler.js index 2bb78a522..7cb57b781 100755 --- a/lib/options-handler.js +++ b/lib/options-handler.js @@ -62,6 +62,7 @@ export class ClientOptionsHandler { const languages = compilerProps.languages; this.supportsBinary = this.compilerProps(languages, 'supportsBinary', true, res => !!res); + this.supportsBinaryObject = this.compilerProps(languages, 'supportsBinaryObject', true, res => !!res); this.supportsExecutePerLanguage = this.compilerProps(languages, 'supportsExecute', true, res => !!res); this.supportsExecute = Object.values(this.supportsExecutePerLanguage).some(value => value); @@ -94,6 +95,7 @@ export class ClientOptionsHandler { defaultCompiler: this.compilerProps(languages, 'defaultCompiler', ''), compileOptions: this.compilerProps(languages, 'defaultOptions', ''), supportsBinary: this.supportsBinary, + supportsBinaryObject: this.supportsBinaryObject, supportsExecute: this.supportsExecute, supportsLibraryCodeFilter: this.supportsLibraryCodeFilter, languages: languages, diff --git a/lib/parsers/asm-parser.ts b/lib/parsers/asm-parser.ts index b056177dc..52575fba1 100644 --- a/lib/parsers/asm-parser.ts +++ b/lib/parsers/asm-parser.ts @@ -116,7 +116,7 @@ export class AsmParser extends AsmRegex { this.asmOpcodeRe = /^\s*(?
[\da-f]+):\s*(?([\da-f]{2} ?)+)\s*(?.*)/; this.relocationRe = /^\s*(?
[\da-f]+):\s*(?(R_[\dA-Z_]+))\s*(?.*)/; - this.relocDataSymNameRe = /^(?[^\d-+][\w.]*)?\s*(?.*)$/; + this.relocDataSymNameRe = /^(?[^\d-+][\w.]*)?\s*(?.*)$/; // TO REMOVE this.lineRe = /^(\/[^:]+):(?\d+).*/; // labelRe is made very greedy as it's also used with demangled objdump @@ -295,7 +295,9 @@ export class AsmParser extends AsmRegex { // Remove labels which do not have a definition. removeLabelsWithoutDefinition(asm, labelDefinitions) { for (const obj of asm) { - obj.labels = obj.labels.filter(label => labelDefinitions[label.name]); + if (obj.labels) { + obj.labels = obj.labels.filter(label => labelDefinitions[label.name]); + } } } @@ -713,12 +715,10 @@ export class AsmParser extends AsmRegex { const address = parseInt(match.groups.address, 16); const relocname = match.groups.relocname; const relocdata = match.groups.relocdata; - const match_value = relocdata.match(this.relocDataSymNameRe); + const match_value = relocdata.match(this.relocDataSymNameRe); // TO REMOVE asm.push({ - text: ` ${relocname} ${relocdata}`, + text: ` ${relocname} ${relocdata}`, address: address, - labels: labelsInLine, - source: null, }); } } diff --git a/static/panes/compiler.ts b/static/panes/compiler.ts index 66cd552ae..cdb8dada2 100644 --- a/static/panes/compiler.ts +++ b/static/panes/compiler.ts @@ -1103,6 +1103,10 @@ export class Compiler extends MonacoPane { if (!this.compiler) return {}; const filters = this.filters.get(); + if (filters.binaryobject && !this.compiler.supportsBinaryObject) { + delete filters.binaryobject; + } + if (filters.binary && !this.compiler.supportsBinary) { delete filters.binary; } @@ -2503,19 +2507,19 @@ export class Compiler extends MonacoPane