pub(crate) fn macho_add_thread_var(&mut self, symbol_id: SymbolId) -> SymbolId {
        let symbol = self.symbol_mut(symbol_id);
        if symbol.kind != SymbolKind::Tls {
            return symbol_id;
        }

        // Create the initializer symbol.
        let mut name = symbol.name.clone();
        name.extend(b"$tlv$init");
        let init_symbol_id = self.add_raw_symbol(Symbol {
            name,
            value: 0,
            size: 0,
            kind: SymbolKind::Tls,
            scope: SymbolScope::Compilation,
            weak: false,
            section: SymbolSection::Undefined,
            flags: SymbolFlags::None,
        });

        // Add the tlv entry.
        // Three pointers in size:
        //   - __tlv_bootstrap - used to make sure support exists
        //   - spare pointer - used when mapped by the runtime
        //   - pointer to symbol initializer
        let section = self.section_id(StandardSection::TlsVariables);
        let address_size = self.architecture.address_size().unwrap().bytes();
        let size = u64::from(address_size) * 3;
        let data = vec![0; size as usize];
        let offset = self.append_section_data(section, &data, u64::from(address_size));

        let tlv_bootstrap = self.macho_tlv_bootstrap();
        self.add_relocation(
            section,
            Relocation {
                offset,
                size: address_size * 8,
                kind: RelocationKind::Absolute,
                encoding: RelocationEncoding::Generic,
                symbol: tlv_bootstrap,
                addend: 0,
            },
        )
        .unwrap();
        self.add_relocation(
            section,
            Relocation {
                offset: offset + u64::from(address_size) * 2,
                size: address_size * 8,
                kind: RelocationKind::Absolute,
                encoding: RelocationEncoding::Generic,
                symbol: init_symbol_id,
                addend: 0,
            },
        )
        .unwrap();

        // Update the symbol to point to the tlv.
        let symbol = self.symbol_mut(symbol_id);
        symbol.value = offset;
        symbol.size = size;
        symbol.section = SymbolSection::Section(section);

        init_symbol_id
    }
/// Create the `__thread_vars` entry for a TLS variable.
///
/// The symbol given by `symbol_id` will be updated to point to this entry.
///
/// A new `SymbolId` will be returned. The caller must update this symbol
/// to point to the initializer.
///
/// If `symbol_id` is not for a TLS variable, then it is returned unchanged.
Create the `__thread_vars` entry for a TLS variable.
The symbol given by `symbol_id` will be updated to point to this entry.

A new `SymbolId` will be returned. The caller must update this symbol
to point to the initializer.

If `symbol_id` is not for a TLS variable, then it is returned unchanged.
Create the ` __thread_vars ` entry for a TLS variable . The symbol given by ` symbol_id ` will be updated to point to this entry . A new ` SymbolId ` will be returned . The caller must update this symbol to point to the initializer . If ` symbol_id ` is not for a TLS variable then it is returned unchanged .
pub(crate) fn macho_add_thread_var(&mut self, symbol_id: SymbolId) -> SymbolId {
        let symbol = self.symbol_mut(symbol_id);
        if symbol.kind != SymbolKind::Tls {
            return symbol_id;
        }
        // Create the initializer symbol.
        let mut name = symbol.name.clone();
        name.extend(b"$tlv$init");
        let init_symbol_id = self.add_raw_symbol(Symbol {
            name,
            value: 0,
            size: 0,
            kind: SymbolKind::Tls,
            scope: SymbolScope::Compilation,
            weak: false,
            section: SymbolSection::Undefined,
            flags: SymbolFlags::None,
        });
        // Add the tlv entry.
        // Three pointers in size:
        //   - __tlv_bootstrap - used to make sure support exists
        //   - spare pointer - used when mapped by the runtime
        //   - pointer to symbol initializer
        let section = self.section_id(StandardSection::TlsVariables);
        let address_size = self.architecture.address_size().unwrap().bytes();
        let size = u64::from(address_size) * 3;
        let data = vec![0; size as usize];
        let offset = self.append_section_data(section, &data, u64::from(address_size));
        let tlv_bootstrap = self.macho_tlv_bootstrap();
        self.add_relocation(
            section,
            Relocation {
                offset,
                size: address_size * 8,
                kind: RelocationKind::Absolute,
                encoding: RelocationEncoding::Generic,
                symbol: tlv_bootstrap,
                addend: 0,
            },
        )
        .unwrap();
        self.add_relocation(
            section,
            Relocation {
                offset: offset + u64::from(address_size) * 2,
                size: address_size * 8,
                kind: RelocationKind::Absolute,
                encoding: RelocationEncoding::Generic,
                symbol: init_symbol_id,
                addend: 0,
            },
        )
        .unwrap();
        // Update the symbol to point to the tlv.
        let symbol = self.symbol_mut(symbol_id);
        symbol.value = offset;
        symbol.size = size;
        symbol.section = SymbolSection::Section(section);
        init_symbol_id
    }
pub ( crate ) fn macho_add_thread_var ( & mut self , symbol_id : SymbolId ) -> SymbolId { let symbol = self . symbol_mut ( symbol_id ) ; if symbol . kind != SymbolKind :: Tls { return symbol_id ; } // Create the initializer symbol. let mut name = symbol . name . clone ( ) ; name . extend ( b" " ) ; let init_symbol_id = self . add_raw_symbol ( Symbol { name , value : 0 , size : 0 , kind : SymbolKind :: Tls , scope : SymbolScope :: Compilation , weak : false , section : SymbolSection :: Undefined , flags : SymbolFlags :: None , } ) ; // Add the tlv entry. // Three pointers in size: //   - __tlv_bootstrap - used to make sure support exists //   - spare pointer - used when mapped by the runtime //   - pointer to symbol initializer let section = self . section_id ( StandardSection :: TlsVariables ) ; let address_size = self . architecture . address_size ( ) . unwrap ( ) . bytes ( ) ; let size = u64 :: from ( address_size ) * 3 ; let data = vec ! [ 0 size as usize ] ; let offset = self . append_section_data ( section , & data , u64 :: from ( address_size ) ) ; let tlv_bootstrap = self . macho_tlv_bootstrap ( ) ; self . add_relocation ( section , Relocation { offset , size : address_size * 8 , kind : RelocationKind :: Absolute , encoding : RelocationEncoding :: Generic , symbol : tlv_bootstrap , addend : 0 , } , ) . unwrap ( ) ; self . add_relocation ( section , Relocation { offset : offset + u64 :: from ( address_size ) * 2 , size : address_size * 8 , kind : RelocationKind :: Absolute , encoding : RelocationEncoding :: Generic , symbol : init_symbol_id , addend : 0 , } , ) . unwrap ( ) ; // Update the symbol to point to the tlv. let symbol = self . symbol_mut ( symbol_id ) ; symbol . value = offset ; symbol . size = size ; symbol . section = SymbolSection :: Section ( section ) ; init_symbol_id }
Create the `__thread_vars` entry for a TLS variable.
Create the ` __thread_vars ` entry for a TLS variable .
&mut self
symbol_id
SymbolId
&mut self
symbol_id
SymbolId