Skip to content

Commit

Permalink
Support for compiling to binary object (#3232)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkm authored and mattgodbolt committed Jan 24, 2023
1 parent 0e246d2 commit 7403be8
Show file tree
Hide file tree
Showing 32 changed files with 233 additions and 118 deletions.
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ To specify a compilation request as a JSON document, post it as the appropriate
},
"filters": {
"binary": false,
"binaryObject": false,
"commentOnly": true,
"demangle": true,
"directives": true,
Expand Down Expand Up @@ -121,8 +122,7 @@ probably not useful for most REST users.

To force a cache bypass, set `bypassCache` in the root of the request to `true`.

Filters include `binary`, `labels`, `intel`, `directives` and `demangle`, which correspond to the UI buttons on the HTML
version.
Filters include `binary`, `binaryObject`, `labels`, `intel`, `directives` and `demangle`, which correspond to the UI buttons on the HTML version.

With the tools array you can ask CE to execute certain tools available for the current compiler, and also supply
arguments for this tool.
Expand Down
31 changes: 16 additions & 15 deletions docs/AddingACompiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,22 @@ once the site runs on the Amazon environment, the `&clang` group **will not** ha

### Configuration keys

| Key Name | Type | Description |
| ---------------- | ---------- | ---------------------------------------------------------------------------------------------------------------- |
| name | String | Human readable name of the compiler |
| exe | Path | Path to the executable |
| alias | Identifier | Another identifier for this compiler (mostly deprecated, used for backwards compatibility with very old CE URLs) |
| options | String | Additional compiler options passed to the compiler when running it |
| 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 |
| 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 |
| compilerType | String | The name of the class handling this compiler |
| interpreted | Boolean | Whether this is an interpreted language, and so the "compiler" is really an interpreter |
| executionWrapper | Path | Path to script that can execute the compiler's output (e.g. could run under `qemu` or `mpi_run` or similar) |
| Key Name | Type | Description |
|----------------------|------------|------------------------------------------------------------------------------------------------------------------|
| name | String | Human readable name of the compiler |
| exe | Path | Path to the executable |
| alias | Identifier | Another identifier for this compiler (mostly deprecated, used for backwards compatibility with very old CE URLs) |
| options | String | Additional compiler options passed to the compiler when running it |
| 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 linking to binary (e.g. compile, assemble and link to final executable program) |
| supportsBinaryObject | Boolean | Whether this compiler supports compiling to binary object (e.g. compile and assemble to binary object) |
| 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 |
| compilerType | String | The name of the class handling this compiler |
| interpreted | Boolean | Whether this is an interpreted language, and so the "compiler" is really an interpreter |
| executionWrapper | Path | Path to script that can execute the compiler's output (e.g. could run under `qemu` or `mpi_run` or similar) |

The `compilerType` option is special: it refers to the Javascript class in `lib/compilers/*.js` which handles running
and handling output for this compiler type.
Expand Down
1 change: 1 addition & 0 deletions etc/config/ada.amazon.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ group.gnat.isSemVer=true
group.gnat.licenseLink=https://gcc.gnu.org/onlinedocs/gcc/Copying.html
group.gnat.licenseName=GNU General Public License
group.gnat.licensePreamble=Copyright (c) 2007 Free Software Foundation, Inc. <a href="https://fsf.org/" target="_blank">https://fsf.org/</a>
group.gnat.supportsBinaryObject=true

compiler.gnat82.exe=/opt/compiler-explorer/gcc-8.2.0/bin/gnatmake
compiler.gnat82.semver=8.2
Expand Down
3 changes: 2 additions & 1 deletion etc/config/ada.defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ defaultCompiler=gnatdefault
demangler=c++filt
versionFlag=--version
compilerType=ada

group.gnat.supportsBinaryObject=true
group.gnat.compilers=gnatdefault
group.gnat.intelAsm=-masm=intel
group.gnat.supportsBinary=true
group.gnat.supportsExecute=true
group.gnat.supportsBinaryObject=true
group.gnat.objdumper=objdump

compiler.gnatdefault.exe=/usr/bin/gnatmake
Expand Down
23 changes: 3 additions & 20 deletions etc/config/c++.amazon.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ group.gcc86.supportsPVS-Studio=true
group.gcc86.licenseLink=https://gcc.gnu.org/onlinedocs/gcc/Copying.html
group.gcc86.licenseName=GNU General Public License
group.gcc86.licensePreamble=Copyright (c) 2007 Free Software Foundation, Inc. <a href="https://fsf.org/" target="_blank">https://fsf.org/</a>
group.gcc86.supportsBinaryObject=true

compiler.g412.exe=/opt/compiler-explorer/gcc-4.1.2/bin/g++
compiler.g412.semver=4.1.2
Expand Down Expand Up @@ -204,6 +205,7 @@ group.clang.supportsPVS-Studio=true
group.clang.licenseName=LLVM Apache 2
group.clang.licenseLink=https://github.com/llvm/llvm-project/blob/main/LICENSE.TXT
group.clang.licensePreamble=The LLVM Project is under the Apache License v2.0 with LLVM Exceptions
group.clang.supportsBinaryObject=true

# Ancient clangs don't support GCC toolchain option
compiler.clang30.exe=/opt/compiler-explorer/clang+llvm-3.0-x86_64-linux-Ubuntu-11_10/bin/clang++
Expand Down Expand Up @@ -863,6 +865,7 @@ compiler.zapcc190308.name=x86-64 Zapcc 190308
###############################
# Cross GCC
group.cross.compilers=&ppcs:&mipss:&nanomips:&mrisc32:&msp:&gccarm:&avr:&rvgcc:&xtensaesp32:&xtensaesp32s2:&xtensaesp32s3:&platspec:&kalray:&s390x:&sh:&loongarch64:&c6x:&sparc:&sparc64:&sparcleon:&bpf
group.cross.supportsBinaryObject=true
group.cross.supportsBinary=true
group.cross.groupName=Cross GCC
group.cross.supportsExecute=false
Expand Down Expand Up @@ -916,8 +919,6 @@ group.sparc.compilers=&gccsparc

# GCC for SPARC
group.gccsparc.compilers=sparcg1220
group.gccsparc.supportsBinary=true
group.gccsparc.supportsExecute=false
group.gccsparc.baseName=SPARC gcc
group.gccsparc.groupName=SPARC GCC
group.gccsparc.isSemVer=true
Expand All @@ -933,8 +934,6 @@ group.sparc64.compilers=&gccsparc64

# GCC for SPARC64
group.gccsparc64.compilers=sparc64g1220
group.gccsparc64.supportsBinary=true
group.gccsparc64.supportsExecute=false
group.gccsparc64.baseName=SPARC64 gcc
group.gccsparc64.groupName=SPARC64 GCC
group.gccsparc64.isSemVer=true
Expand All @@ -950,8 +949,6 @@ group.sparcleon.compilers=&gccsparcleon

# GCC for SPARC-LEON
group.gccsparcleon.compilers=sparcleong1220
group.gccsparcleon.supportsBinary=true
group.gccsparcleon.supportsExecute=false
group.gccsparcleon.baseName=SPARC LEON gcc
group.gccsparcleon.groupName=SPARC LEON GCC
group.gccsparcleon.isSemVer=true
Expand All @@ -967,8 +964,6 @@ group.c6x.compilers=&gccc6x

# GCC for TI C6x
group.gccc6x.compilers=c6xg1220
group.gccc6x.supportsBinary=true
group.gccc6x.supportsExecute=false
group.gccc6x.baseName=TI C6x gcc
group.gccc6x.groupName=TI C6x GCC
group.gccc6x.isSemVer=true
Expand All @@ -983,8 +978,6 @@ compiler.c6xg1220.demangler=/opt/compiler-explorer/c6x/gcc-12.2.0/tic6x-elf/bin/
group.loongarch64.compilers=&gccloongarch64

# GCC for loongarch64
group.gccloongarch64.supportsBinary=true
group.gccloongarch64.supportsExecute=false
group.gccloongarch64.baseName=loongarch64 gcc
group.gccloongarch64.groupName=loongarch64 gcc
group.gccloongarch64.compilers=loongarch64g1220
Expand All @@ -1000,8 +993,6 @@ compiler.loongarch64g1220.demangler=/opt/compiler-explorer/loongarch64/gcc-12.2.
group.sh.compilers=&gccsh

# GCC for sh
group.gccsh.supportsBinary=true
group.gccsh.supportsExecute=false
group.gccsh.baseName=sh gcc
group.gccsh.groupName=sh gcc
group.gccsh.compilers=shg494:shg950:shg1220
Expand All @@ -1027,8 +1018,6 @@ compiler.shg1220.demangler=/opt/compiler-explorer/sh/gcc-12.2.0/sh-unknown-elf/b
group.s390x.compilers=&gccs390x

# GCC for s390x
group.gccs390x.supportsBinary=true
group.gccs390x.supportsExecute=false
group.gccs390x.baseName=s390x gcc
group.gccs390x.groupName=s390x gcc
group.gccs390x.compilers=gccs390x1120:s390xg1210:s390xg1220
Expand All @@ -1052,8 +1041,6 @@ compiler.s390xg1220.demangler=/opt/compiler-explorer/s390x/gcc-12.2.0/s390x-ibm-
# Cross compilers for PPC
group.ppcs.compilers=&ppc:&ppc64:&ppc64le
group.ppcs.isSemVer=true
group.ppcs.supportsBinary=true
group.ppcs.supportsExecute=false

## POWER
group.ppc.compilers=ppcg48:ppcg1120:ppcg1210:ppcg1220
Expand Down Expand Up @@ -1508,10 +1495,7 @@ compiler.avrg1220.demangler=/opt/compiler-explorer/avr/gcc-12.2.0/avr/bin/avr-c+
###############################
# GCC for MIPS
group.mipss.compilers=&mips:&mipsel:&mips64:&mips64el

group.mipss.isSemVer=true
group.mipss.supportsBinary=true
group.mipss.supportsExecute=false

## MIPS
group.mips.groupName=MIPS GCC
Expand Down Expand Up @@ -1623,7 +1607,6 @@ compiler.mrisc32-gcc-trunk.objdumper=/opt/compiler-explorer/mrisc32-trunk/mrisc3
# GCC for RISC-V
group.rvgcc.compilers=rv64-gcc1220:rv64-gcc1210:rv64-gcc1130:rv64-gcc1120:rv64-gcc1030:rv64-gcc1020:rv64-gcc940:rv64-gcc850:rv64-gcc820:rv32-gcc1220:rv32-gcc1210:rv32-gcc1130:rv32-gcc1120:rv32-gcc1030:rv32-gcc1020:rv32-gcc940:rv32-gcc850:rv32-gcc820
group.rvgcc.groupName=RISC-V GCC
group.rvgcc.supportsExecute=false
group.rvgcc.isSemVer=true

compiler.rv64-gcc820.exe=/opt/compiler-explorer/riscv64/gcc-8.2.0/riscv64-unknown-linux-gnu/bin/riscv64-unknown-linux-gnu-g++
Expand Down
1 change: 1 addition & 0 deletions etc/config/c++.defaults.properties
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ objdumper=objdump
#androidNdk=/opt/google/android-ndk-r9c
options=
supportsBinary=true
supportsBinaryObject=true
binaryHideFuncRe=^(__.*|_(init|start|fini)|(de)?register_tm_clones|call_gmon_start|frame_dummy|\.plt.*|_dl_relocate_static_pie)$
needsMulti=false
stubRe=\bmain\b
Expand Down

0 comments on commit 7403be8

Please sign in to comment.