aboutsummaryrefslogtreecommitdiff
path: root/lib/compilers/ocaml.js
diff options
context:
space:
mode:
authorHaz <hyphens@pm.me>2021-08-14 20:03:13 +0200
committerGitHub <noreply@github.com>2021-08-14 13:03:13 -0500
commit60db8ba531326d7eaf6fff6a93d093be6c4507fd (patch)
treec6c293136d747c48606c5557dca25e796515ae64 /lib/compilers/ocaml.js
parentb6c2380c56ece8e0a0a65a4217aa81d0335453d7 (diff)
downloadcompiler-explorer-60db8ba531326d7eaf6fff6a93d093be6c4507fd.tar.gz
compiler-explorer-60db8ba531326d7eaf6fff6a93d093be6c4507fd.zip
Make OCaml examples executable and objdumpable (#2853)
Changes: - ocaml.default.properties: - add the relevant flags for execution and emitting binaries - add nicer version number reporting - let CE know `objdump` can be used on ocaml objects - ocaml.js: - update optionsForFilter for both executable and object handling - override the getter for executable to work within ocamlopt context
Diffstat (limited to 'lib/compilers/ocaml.js')
-rw-r--r--lib/compilers/ocaml.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/compilers/ocaml.js b/lib/compilers/ocaml.js
index 8bd3d9c09..de1c91c96 100644
--- a/lib/compilers/ocaml.js
+++ b/lib/compilers/ocaml.js
@@ -33,11 +33,21 @@ export class OCamlCompiler extends BaseCompiler {
return [];
}
- optionsForFilter() {
- return ['-S', '-g', '-c'];
+ optionsForFilter(filters, outputFileName) {
+ let options = ['-g', '-S'];
+ if (filters.binary) {
+ options = options.concat('-o', this.filename(outputFileName));
+ } else {
+ options = options.concat('-c');
+ }
+ return options;
}
getOutputFilename(dirPath) {
return path.join(dirPath, `${path.basename(this.compileFilename, this.lang.extensions[0])}.s`);
}
+
+ getExecutableFilename(dirPath, outputFilebase) {
+ return path.join(dirPath, outputFilebase);
+ }
}