The name of NativeLib will be presented
This commit is contained in:
parent
c22f154e3f
commit
d5558e67ef
8 changed files with 71 additions and 56 deletions
|
@ -67,12 +67,11 @@ pub enum LinkagePreference {
|
|||
#[derive(Debug, Encodable, Decodable, HashStable_Generic)]
|
||||
pub struct NativeLib {
|
||||
pub kind: NativeLibKind,
|
||||
pub name: Option<Symbol>,
|
||||
pub name: Symbol,
|
||||
/// If packed_bundled_libs enabled, actual filename of library is stored.
|
||||
pub filename: Option<Symbol>,
|
||||
pub cfg: Option<ast::MetaItem>,
|
||||
pub foreign_module: Option<DefId>,
|
||||
pub wasm_import_module: Option<Symbol>,
|
||||
pub verbatim: Option<bool>,
|
||||
pub dll_imports: Vec<DllImport>,
|
||||
}
|
||||
|
@ -81,6 +80,10 @@ impl NativeLib {
|
|||
pub fn has_modifiers(&self) -> bool {
|
||||
self.verbatim.is_some() || self.kind.has_modifiers()
|
||||
}
|
||||
|
||||
pub fn wasm_import_module(&self) -> Option<Symbol> {
|
||||
if self.kind == NativeLibKind::WasmImportModule { Some(self.name) } else { None }
|
||||
}
|
||||
}
|
||||
|
||||
/// Different ways that the PE Format can decorate a symbol name.
|
||||
|
|
|
@ -37,6 +37,10 @@ pub enum NativeLibKind {
|
|||
/// Argument which is passed to linker, relative order with libraries and other arguments
|
||||
/// is preserved
|
||||
LinkArg,
|
||||
|
||||
/// Module imported from WebAssembly
|
||||
WasmImportModule,
|
||||
|
||||
/// The library kind wasn't specified, `Dylib` is currently used as a default.
|
||||
Unspecified,
|
||||
}
|
||||
|
@ -50,7 +54,10 @@ impl NativeLibKind {
|
|||
NativeLibKind::Dylib { as_needed } | NativeLibKind::Framework { as_needed } => {
|
||||
as_needed.is_some()
|
||||
}
|
||||
NativeLibKind::RawDylib | NativeLibKind::Unspecified | NativeLibKind::LinkArg => false,
|
||||
NativeLibKind::RawDylib
|
||||
| NativeLibKind::Unspecified
|
||||
| NativeLibKind::LinkArg
|
||||
| NativeLibKind::WasmImportModule => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue