rustc_codegen_ssa::back::metadata

Function create_compressed_metadata_file_for_xcoff

Source
pub fn create_compressed_metadata_file_for_xcoff(
    file: Object<'_>,
    data: &[u8],
    symbol_name: &str,
) -> Vec<u8>
Expand description
  • 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 to
    1. Create an empty .text section, a empty .data section.
    2. Define an empty symbol named symbol_name inside .data section.
    3. 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.