Expand description
Reading of the rustc metadata for rlibs and dylibs
Re-exportsΒ§
use std::borrow::Cow;πuse std::fs::File;πuse std::io::Write;πuse std::path::Path;πuse itertools::Itertools;πuse object::write;πuse object::write::StandardSegment;πuse object::write::Symbol;πuse object::write::SymbolSection;πuse object::Architecture;πuse object::BinaryFormat;πuse object::Endianness;πuse object::FileFlags;πuse object::Object;πuse object::ObjectSection;πuse object::ObjectSymbol;πuse object::SectionFlags;πuse object::SectionKind;πuse object::SymbolFlags;πuse object::SymbolKind;πuse object::SymbolScope;πuse object::elf;πuse object::pe;πuse object::xcoff;πuse rustc_abi::Endian;πuse rustc_data_structures::memmap::Mmap;πuse rustc_data_structures::owned_slice::OwnedSlice;πuse rustc_data_structures::owned_slice::try_slice_owned;πuse rustc_metadata::EncodedMetadata;πuse rustc_metadata::creader::MetadataLoader;πuse rustc_metadata::fs::METADATA_FILENAME;πuse rustc_session::Session;πuse rustc_span::bug;πuse rustc_span::sym;πuse rustc_target::spec::CfgAbi;πuse rustc_target::spec::LlvmAbi;πuse rustc_target::spec::Os;πuse rustc_target::spec::RelocModel;πuse rustc_target::spec::Target;πuse rustc_target::spec::ef_avr_arch;πuse tracing::debug;πuse super::apple;πuse crate::diagnostics;π
StructsΒ§
- Default
Metadata Loader - The default metadata loader. This is used by cg_llvm and cg_clif.
EnumsΒ§
- Metadata
Position π
StaticsΒ§
FunctionsΒ§
- add_
gnu_ πproperty_ note - create_
compressed_ metadata_ file - create_
compressed_ metadata_ file_ for_ xcoff - Xcoff - On AIX, custom sections are merged into predefined sections,
so custom .rustc section is not preserved during linking.
For this reason, we store metadata in predefined .info section, and
define a symbol to reference the metadata. To preserve metadata during
linking on AIX, we have toCreate an empty .text section, a empty .data section.Define an empty symbol named
symbol_nameinside .data section.Define an symbol namedAIX_METADATA_SYMBOL_NAMEreferencing data inside .info section. From XCOFFβs view, (2) creates a csect entry in the symbol table, the symbol created by (3) is a info symbol for the preceding csect. Thus two symbols are preserved during linking and we can use the second symbol to reference the metadata. - create_
metadata_ file_ for_ wasm - Creates a simple WebAssembly object file, which is itself a wasm module,
that contains a custom section of the name
section_namewith contentsdata. - create_
object_ πfile - create_
wrapper_ πfile - For rlibs we βpackβ rustc metadata into a dummy object file.
- elf_
e_ πflags - elf_
os_ πabi - get_
metadata_ πxcoff - load_
metadata_ πwith - macho_
is_ πarm64e - Is Appleβs CPU subtype
arm64es - macho_
object_ πbuild_ version_ for_ target - Mach-O files contain information about:
- search_
for_ πsection