mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-06 20:58:28 +00:00
Make PIC optional for compilers
This commit is contained in:
@@ -37,6 +37,8 @@ pub struct CraneliftConfig {
|
||||
/// The verifier assures that the generated Cranelift IR is valid.
|
||||
pub enable_verifier: bool,
|
||||
|
||||
enable_pic: bool,
|
||||
|
||||
/// The optimization levels when optimizing the IR.
|
||||
pub opt_level: OptLevel,
|
||||
|
||||
@@ -52,6 +54,7 @@ impl CraneliftConfig {
|
||||
enable_nan_canonicalization: false,
|
||||
enable_verifier: false,
|
||||
opt_level: OptLevel::Speed,
|
||||
enable_pic: false,
|
||||
features,
|
||||
target,
|
||||
}
|
||||
@@ -124,7 +127,9 @@ impl CraneliftConfig {
|
||||
.enable("avoid_div_traps")
|
||||
.expect("should be valid flag");
|
||||
|
||||
flags.enable("is_pic").expect("should be a valid flag");
|
||||
if self.enable_pic {
|
||||
flags.enable("is_pic").expect("should be a valid flag");
|
||||
}
|
||||
|
||||
// Invert cranelift's default-on verification to instead default off.
|
||||
let enable_verifier = if self.enable_verifier {
|
||||
@@ -174,6 +179,10 @@ impl CompilerConfig for CraneliftConfig {
|
||||
&self.features
|
||||
}
|
||||
|
||||
fn enable_pic(&mut self) {
|
||||
self.enable_pic = true;
|
||||
}
|
||||
|
||||
/// Gets the target that we will use for compiling
|
||||
/// the WebAssembly module
|
||||
fn target(&self) -> &Target {
|
||||
|
||||
Reference in New Issue
Block a user