aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/config/ada.amazon.properties11
-rw-r--r--etc/config/ada.defaults.properties4
-rw-r--r--lib/compilers/ada.js16
-rw-r--r--lib/tooling/strings-tool.js10
4 files changed, 33 insertions, 8 deletions
diff --git a/etc/config/ada.amazon.properties b/etc/config/ada.amazon.properties
index 74515273a..36b496745 100644
--- a/etc/config/ada.amazon.properties
+++ b/etc/config/ada.amazon.properties
@@ -36,7 +36,7 @@ libs=
#################################
# Tools
-tools=readelf:ldd
+tools=readelf:ldd:readelf:strings
tools.readelf.name=readelf (trunk)
tools.readelf.exe=/opt/compiler-explorer/gcc-snapshot/bin/readelf
@@ -49,5 +49,12 @@ tools.ldd.name=ldd
tools.ldd.exe=/usr/bin/ldd
tools.ldd.type=postcompilation
tools.ldd.class=readelf-tool
-tools.ldd.exclude=djggp
+tools.ldd.exclude=
tools.ldd.stdinHint=disabled
+
+tools.strings.exe=/opt/compiler-explorer/gcc-snapshot/bin/strings
+tools.strings.name=strings
+tools.strings.type=postcompilation
+tools.strings.class=strings-tool
+tools.strings.exclude=
+tools.strings.stdinHint=disabled
diff --git a/etc/config/ada.defaults.properties b/etc/config/ada.defaults.properties
index 98659bdbc..36c9c7e42 100644
--- a/etc/config/ada.defaults.properties
+++ b/etc/config/ada.defaults.properties
@@ -4,8 +4,8 @@ defaultCompiler=gnat
demangler=c++filt
objdumper=objdump
versionFlag=--version
-supportsBinary=false
-supportsExecute=false
+supportsBinary=true
+supportsExecute=true
compilerType=ada
intelAsm=-masm=intel
diff --git a/lib/compilers/ada.js b/lib/compilers/ada.js
index daa6d538e..105ee8ae1 100644
--- a/lib/compilers/ada.js
+++ b/lib/compilers/ada.js
@@ -41,10 +41,14 @@ export class AdaCompiler extends BaseCompiler {
}
getExecutableFilename(dirPath) {
+ // The name here must match the value used in the pragma Source_File
+ // in the user provided source.
return path.join(dirPath, 'example');
}
getOutputFilename(dirPath) {
+ // The basename here must match the value used in the pragma Source_File
+ // in the user provided source.
return path.join(dirPath, 'example.o');
}
@@ -66,7 +70,13 @@ export class AdaCompiler extends BaseCompiler {
optionsForFilter(filters, outputFilename) {
let options = [];
+ // Always add -cargs to the options. If not needed here, put it last.
+ // It's used in runCompiler to insert the input filename at the correct
+ // location in the command line.
+ // input filename is inserted before -cargs.
+
if (!filters.binary) {
+ // produce assembly output in outputFilename
options.push(
'compile',
'-g', // enable debugging
@@ -84,12 +94,14 @@ export class AdaCompiler extends BaseCompiler {
options = options.concat(this.compiler.intelAsm.split(' '));
}
} else {
+ // produce an executable in the file specified in getExecutableFilename.
+ // The output file is automatically decided by GNAT based on the Source_File_Name being used.
+ // As we are for forcing 'example.adb', the output here will be 'example'.
options.push(
'make',
'-eS',
'-g',
- 'example',
- '-cargs',
+ '-cargs', // Compiler Switches for gcc.
);
}
diff --git a/lib/tooling/strings-tool.js b/lib/tooling/strings-tool.js
index ce1feb662..7385b6319 100644
--- a/lib/tooling/strings-tool.js
+++ b/lib/tooling/strings-tool.js
@@ -22,16 +22,22 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
+import { fileExists } from '../utils';
+
import { BaseTool } from './base-tool';
export class StringsTool extends BaseTool {
static get key() { return 'strings-tool'; }
- runTool(compilationInfo, inputFilename, args) {
+ async runTool(compilationInfo, inputFilename, args) {
if(!compilationInfo.filters.binary)
{
return this.createErrorResponse('Strings requires a binary output');
}
- return super.runTool(compilationInfo, compilationInfo.executableFilename, args);
+ if (await fileExists(compilationInfo.executableFilename)) {
+ return super.runTool(compilationInfo, compilationInfo.executableFilename, args);
+ } else {
+ return super.runTool(compilationInfo, compilationInfo.outputFilename, args);
+ }
}
}