fixup! Support for compiling to binary object

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
This commit is contained in:
Marc Poulhiès
2022-11-04 19:00:30 +01:00
parent 66e1504c70
commit 4ba0dd2aca
6 changed files with 23 additions and 9 deletions
+1
View File
@@ -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 |
+3
View File
@@ -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 = {
+2
View File
@@ -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,
+2
View File
@@ -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,
+6 -6
View File
@@ -116,7 +116,7 @@ export class AsmParser extends AsmRegex {
this.asmOpcodeRe = /^\s*(?<address>[\da-f]+):\s*(?<opcodes>([\da-f]{2} ?)+)\s*(?<disasm>.*)/;
this.relocationRe = /^\s*(?<address>[\da-f]+):\s*(?<relocname>(R_[\dA-Z_]+))\s*(?<relocdata>.*)/;
this.relocDataSymNameRe = /^(?<symname>[^\d-+][\w.]*)?\s*(?<addend_or_value>.*)$/;
this.relocDataSymNameRe = /^(?<symname>[^\d-+][\w.]*)?\s*(?<addend_or_value>.*)$/; // TO REMOVE
this.lineRe = /^(\/[^:]+):(?<line>\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,
});
}
}
+9 -3
View File
@@ -1103,6 +1103,10 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
getEffectiveFilters(): Record<string, boolean> {
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<monaco.editor.IStandaloneCodeEditor, Co
(button.prop('disabled') ? ' [LOCKED]' : '')
);
};
const isIntelFilterDisabled = !this.compiler.supportsIntel && (!filters.binary && !filters.binaryobject);
const isIntelFilterDisabled = !this.compiler.supportsIntel && !filters.binary && !filters.binaryobject;
this.filterIntelButton.prop('disabled', isIntelFilterDisabled);
formatFilterTitle(this.filterIntelButton, this.filterIntelTitle);
// Disable binaryobject support on compilers that don't work with it or if binary is selected
this.filterBinaryObjectButton.prop('disabled', !this.compiler.supportsBinary || filters.binary);
this.filterBinaryObjectButton.prop('disabled', !this.compiler.supportsBinaryObject || filters.binary);
formatFilterTitle(this.filterBinaryObjectButton, this.filterBinaryObjectTitle);
// Disable binary support on compilers that don't work with it or if binaryobject is selected
this.filterBinaryButton.prop('disabled', !this.compiler.supportsBinary || filters.binaryobject);
formatFilterTitle(this.filterBinaryButton, this.filterBinaryTitle);
this.filterExecuteButton.prop('disabled', !this.compiler.supportsExecute || filters.binaryobject);
this.filterExecuteButton.prop('disabled', !this.compiler.supportsExecute);
formatFilterTitle(this.filterExecuteButton, this.filterExecuteTitle);
// Disable demangle for compilers where we can't access it
this.filterDemangleButton.prop('disabled', !this.compiler.supportsDemangle);
@@ -2583,6 +2587,8 @@ export class Compiler extends MonacoPane<monaco.editor.IStandaloneCodeEditor, Co
this.gnatDebugTreeButton.toggle(!!(this.compiler as any).supportsGnatDebugViews);
this.gnatDebugButton.toggle(!!(this.compiler as any).supportsGnatDebugViews);
this.executorButton.toggle(this.compiler.supportsExecute);
this.filterBinaryButton.toggle(this.compiler.supportsBinary);
this.filterBinaryObjectButton.toggle(this.compiler.supportsBinaryObject);
this.compilerLicenseButton.toggle(!!this.hasCompilerLicenseInfo());