Suport passing arbitrary llvm arguments (#271)

- Support for passing LLVM command line options via the prcoess input or
providing one or more `--llvm-arg='..'` resolc CLI flag. This allows
more fine-grained control over the LLVM backend configuration.
- Make LLVM initialization idempotent.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-04-03 13:21:00 +02:00
committed by GitHub
parent 8a98346a9c
commit 87c1d7a8be
16 changed files with 142 additions and 26 deletions
+4
View File
@@ -66,6 +66,7 @@ impl Project {
optimizer_settings: revive_llvm_context::OptimizerSettings,
include_metadata_hash: bool,
debug_config: revive_llvm_context::DebugConfig,
llvm_arguments: &[String],
) -> anyhow::Result<Build> {
let project = self.clone();
#[cfg(feature = "parallel")]
@@ -81,6 +82,7 @@ impl Project {
include_metadata_hash,
optimizer_settings.clone(),
debug_config.clone(),
llvm_arguments.to_vec(),
);
let process_output = {
#[cfg(target_os = "emscripten")]
@@ -316,6 +318,7 @@ impl revive_llvm_context::PolkaVMDependency for Project {
optimizer_settings: revive_llvm_context::OptimizerSettings,
include_metadata_hash: bool,
debug_config: revive_llvm_context::DebugConfig,
llvm_arguments: &[String],
) -> anyhow::Result<String> {
let contract_path = project.resolve_path(identifier)?;
let contract = project
@@ -335,6 +338,7 @@ impl revive_llvm_context::PolkaVMDependency for Project {
optimizer_settings,
include_metadata_hash,
debug_config,
llvm_arguments,
)
.map_err(|error| {
anyhow::anyhow!(