mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-09-11 06:41:59 -04:00
Supersedes #8872. Thanks to @likecrazy1, whose `AburiCompiler` class is taken from that PR unchanged and who is credited as co-author — the reason this is a new PR rather than an edit is that the properties needed rewriting from scratch once upstream changed direction. @serjective has [confirmed](https://github.com/compiler-explorer/compiler-explorer/pull/8872#issuecomment-) that `godbolt` is the live branch and the pinned `atta-mills` classic version is abandoned, so this configures the nightly built from `godbolt`. ## What changed from #8872, and why **It is not an aarch64 Darwin cross compiler any more.** The new build reports `Target: x86_64-unknown-linux-gnu`, so the group is plain `aburi` with `instructionSet=amd64` rather than "Aburi (aarch64 Apple Darwin)". **No `--sysroot`.** This is the important one. On Linux, aburi's `resolve_effective_stdlib` treats an explicit `--sysroot` as a different root filesystem and **switches off Adinkra**, its own C++ standard library. That is exactly why the previous configuration compiled CE's header-free `square` example byte-perfectly and then failed on the first `#include`. For a Linux target aburi takes its C headers from the host root and its C++ headers from Adinkra, so it wants no sysroot at all. **`-std=c++20` is required**, not optional — Adinkra `#error`s below C++20, so a bare C++ compile fails outright. **Nightly shape:** `isNightly=true` and `semver=(trunk)` instead of a pinned `0.1.1`, since it now tracks a moving branch. **Binary, binary object and execution are off.** Linking does work (I built and ran a C++ executable against the shipped artifact), but nothing has exercised those paths on the site, and they need `-L`/`-Wl,-rpath` pointing at the bundled libc++abi to link at all. Advertising a control that hard-fails is the exact trap this compiler fell into last time, so I would rather turn them on as a follow-up once someone can try them for real. ## Testing Everything below was run against the artifact that is actually on S3 (`aburi-godbolt-20260814.tar.xz`), installed through the infra installable: - `--version` and `--help` both exit 0 (a non-zero version command silently drops a compiler from the dropdown) - C++ `-S` emits x86-64 assembly - C compiles, links and runs - `--emit-llvm` alone emits valid LLVM IR, which is what `AburiCompiler` uses for the IR view. Note it rejects `--emit-llvm` combined with `-S`, and the class already strips `-S` on that path - `-g` is accepted, which the class always passes - a TU using `<vector>`, `<string>` and a thrown-and-caught exception compiles, links and runs — the case the old `--sysroot` broke `npm run test:props` (90 passed), `npm run ts-check` and `npm run lint-check` all clean. ## Merge order This should land after, and only after, the compiler is installed: - compiler-explorer/misc-builder#142, #143 (builder) — merged - compiler-explorer/infra#2294 (nightly installable) - compiler-explorer/compiler-workflows#76 (daily build) Co-Authored-By: likecrazy1 <157763655+likecrazy1@users.noreply.github.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com> Co-authored-by: likecrazy1 <157763655+likecrazy1@users.noreply.github.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
85 lines
3.4 KiB
TypeScript
85 lines
3.4 KiB
TypeScript
// Copyright (c) 2025, Compiler Explorer Authors
|
|
// All rights reserved.
|
|
//
|
|
// Redistribution and use in source and binary forms, with or without
|
|
// modification, are permitted provided that the following conditions are met:
|
|
//
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
// this list of conditions and the following disclaimer.
|
|
// * Redistributions in binary form must reproduce the above copyright
|
|
// notice, this list of conditions and the following disclaimer in the
|
|
// documentation and/or other materials provided with the distribution.
|
|
//
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
import _ from 'underscore';
|
|
|
|
import type {LLVMIrBackendOptions} from '../../types/compilation/ir.interfaces.js';
|
|
import type {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js';
|
|
import {unwrap} from '../assert.js';
|
|
import {BaseCompiler} from '../base-compiler.js';
|
|
import * as utils from '../utils.js';
|
|
|
|
export class AburiCompiler extends BaseCompiler {
|
|
static get key() {
|
|
return 'aburi';
|
|
}
|
|
|
|
constructor(info, env) {
|
|
super(info, env);
|
|
this.compiler.supportsIrView = true;
|
|
this.compiler.irArg = ['--emit-llvm'];
|
|
}
|
|
|
|
override optionsForFilter(filters: ParseFiltersAndOutputOptions, outputFilename: string, userOptions?: string[]) {
|
|
if (_.some(unwrap(userOptions), opt => opt === '--help' || opt === '-h' || opt === '-hh')) {
|
|
return [];
|
|
}
|
|
const options = ['-g', '-o', this.filename(outputFilename)];
|
|
if (!filters.binary) {
|
|
options.unshift('-S');
|
|
}
|
|
return options;
|
|
}
|
|
|
|
override filterUserOptions(userOptions: string[]) {
|
|
return userOptions.filter(opt => opt !== '-run');
|
|
}
|
|
|
|
override getIrOutputFilename(inputFilename: string): string {
|
|
return utils.changeExtension(inputFilename, '.ll');
|
|
}
|
|
|
|
override generateIR(
|
|
inputFilename: string,
|
|
options: string[],
|
|
irOptions: LLVMIrBackendOptions,
|
|
produceCfg: boolean,
|
|
filters: ParseFiltersAndOutputOptions,
|
|
) {
|
|
const irPath = this.getIrOutputFilename(inputFilename);
|
|
const irOptions_ = options
|
|
.filter(opt => opt !== '-S')
|
|
.map(opt => {
|
|
if (opt === '-o') return '__OFLAG__';
|
|
return opt;
|
|
});
|
|
const oIdx = irOptions_.indexOf('__OFLAG__');
|
|
if (oIdx !== -1 && oIdx + 1 < irOptions_.length) {
|
|
irOptions_[oIdx] = '-o';
|
|
irOptions_[oIdx + 1] = irPath;
|
|
}
|
|
return super.generateIR(inputFilename, irOptions_, irOptions, produceCfg, filters);
|
|
}
|
|
}
|