Skip to main content

Module metadata

Module metadata 

Source
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Β§

DefaultMetadataLoader
The default metadata loader. This is used by cg_llvm and cg_clif.

EnumsΒ§

MetadataPosition πŸ”’

StaticsΒ§

AIX_METADATA_SYMBOL_NAME πŸ”’

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_name inside .data section.Define an symbol named AIX_METADATA_SYMBOL_NAME referencing 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_name with contents data.
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 πŸ”’