avoid dynamic linking on targets that do not support dynamic linking

This commit is contained in:
Pietro Albini 2023-06-09 11:32:49 +02:00
parent a56c829e74
commit 04f658f3d3
No known key found for this signature in database
GPG Key ID: CD76B35F7734769E
2 changed files with 3 additions and 1 deletions

View File

@ -542,6 +542,8 @@ pub struct TargetCfg {
endian: Endian,
#[serde(rename = "panic-strategy", default)]
pub(crate) panic: PanicStrategy,
#[serde(default)]
pub(crate) dynamic_linking: bool,
}
impl TargetCfg {

View File

@ -1810,8 +1810,8 @@ fn build_auxiliary(&self, source_path: &str, aux_dir: &Path) -> bool {
|| self.config.target.contains("wasm32")
|| self.config.target.contains("nvptx")
|| self.is_vxworks_pure_static()
|| self.config.target.contains("sgx")
|| self.config.target.contains("bpf")
|| !self.config.target_cfg().dynamic_linking
{
// We primarily compile all auxiliary libraries as dynamic libraries
// to avoid code size bloat and large binaries as much as possible