
  PROCEDURE [INLINE] lop$store_linkage (
        reference_details: {input} ^lot$reference_details;
        entry_definition: {input} ^lot$entry_definition;
    VAR binding_section_overwrite {control} : boolean;
    VAR declaration_mismatch {control} : boolean;
    VAR address_value_unaligned {control} : boolean);
?? PUSH (LISTEXT := ON) ??

    TYPE
      binding_section_address = record
        case 1 .. 4 of
        = 1 =
          word1: integer,
          word2: integer,
        = 2 =
          pva_target: lot$address,
        = 3 =
          cbp_target: lot$cbp_template,
        = 4 =
          external_proc_cbp: lot$cbp_template,
          filler: 0 .. 0ffff(16),
          external_proc_pva: lot$address,
        casend,
      recend;


    VAR
      address_ptr: ^binding_section_address,
      of_execution: ^cell,
      malfunction_status: ^ost$status,
      abort_status: ^ost$status;

    binding_section_overwrite := FALSE;
    declaration_mismatch := FALSE;
    IF (entry_definition^.attributes.declaration_matching_required AND
          reference_details^.declaration_matching_required) AND (entry_definition^.attributes.language =
          reference_details^.language) THEN
      IF (entry_definition^.attributes.language = llc$cybil) THEN
        IF (entry_definition^.attributes.source_declaration_matching) THEN
          IF (entry_definition^.attributes.declaration_matching.source_encryption <>
                reference_details^.declaration_matching.source_encryption) THEN
            declaration_mismatch := TRUE;
          IFEND;
        ELSE
          IF (entry_definition^.attributes.declaration_matching.object_encryption <>
                reference_details^.declaration_matching.object_encryption) THEN
            declaration_mismatch := TRUE;
          IFEND;
        IFEND;
      ELSE
        IF (entry_definition^.attributes.declaration_matching.language_dependent_value <>
              reference_details^.declaration_matching.language_dependent_value) THEN
          declaration_mismatch := TRUE;
        IFEND;
      IFEND;
    IFEND;
    IF reference_details^.binding_section_destination THEN
      { This code assumes that the target address is aligned properly for the type of
      { linkage to be generated.
      address_ptr := #address (#ring (^of_execution), reference_details^.address.segment, reference_details^.
            address.offset - (reference_details^.address.offset MOD 8));
      IF address_ptr^.word1 <> 0 THEN
        binding_section_overwrite := TRUE;
        RETURN
      IFEND;
      IF reference_details^.kind = llc$external_proc THEN
        IF address_ptr^.word2 <> 0 THEN
          binding_section_overwrite := TRUE;
          RETURN
        IFEND;
      IFEND;
    IFEND;
    address_ptr := #address (#ring (^of_execution), reference_details^.address.segment, reference_details^.
          address.offset);
    CASE reference_details^.kind OF
    = llc$address, llc$address_addition, llc$address_subtraction =
      address_ptr^.pva_target := entry_definition^.attributes.address;
      IF reference_details^.kind = llc$address_addition THEN
        address_ptr^.pva_target.offset := address_ptr^.pva_target.offset + reference_details^.offset_operand;
      ELSEIF reference_details^.kind = llc$address_subtraction THEN
        address_ptr^.pva_target.offset := address_ptr^.pva_target.offset - reference_details^.offset_operand;
      IFEND;
      address_value_unaligned := FALSE;
    = llc$internal_proc =
      address_ptr^.cbp_target.vmid := entry_definition^.attributes.vmid;
      address_ptr^.cbp_target.external_proc_flag := FALSE;
      address_ptr^.cbp_target.call_bracket := entry_definition^.attributes.loaded_ring;
      address_ptr^.cbp_target.address := entry_definition^.attributes.address;
      address_value_unaligned := (entry_definition^.attributes.address.offset MOD 8) <> 0;
    = llc$external_proc =
      address_ptr^.cbp_target.vmid := entry_definition^.attributes.vmid;
      address_ptr^.cbp_target.external_proc_flag := TRUE;
      address_ptr^.cbp_target.call_bracket := entry_definition^.attributes.call_bracket;
      address_ptr^.cbp_target.address := entry_definition^.attributes.address;
      address_value_unaligned := (entry_definition^.attributes.address.offset MOD 8) <> 0;
      address_ptr^.external_proc_pva := entry_definition^.attributes.binding_section_address;
    ELSE
{!  address_kind should have been verified prior to arrival here.
      PUSH malfunction_status;
      osp$set_status_abnormal ('LL', lle$loader_malfunctioned, 'store_linkage', malfunction_status^);
      PUSH abort_status;
      pmp$cause_condition (loe$loader_malfunction, malfunction_status, abort_status^);
      pmp$exit (abort_status^);
    CASEND;
  PROCEND lop$store_linkage;

*copyc pmp$cause_condition
*copyc osp$set_status_abnormal
*copyc pmp$exit
*copyc LOT$LOADER_TYPE_DEFINITIONS
*copyc LOE$ABORT_LOAD
*copyc LLE$LOADER_STATUS_CONDITIONS
?? POP ??
