Browse Source

* Streamlined label referencing

J. Gareth "Curious Kit" Moreton 3 years ago
parent
commit
0962578511
1 changed files with 3 additions and 3 deletions
  1. 3 3
      compiler/aasmcnst.pas

+ 3 - 3
compiler/aasmcnst.pas

@@ -1027,6 +1027,9 @@ implementation
        else
          prelist.concat(tai_label.Create(tasmlabel(asmsym)));
 
+       { Newly referenced symbol }
+       asmsym.increfs;
+
        if tcalo_weak in options then
          prelist.concat(tai_directive.Create(asd_weak_definition,asmsym.name));
        { insert the symbol information before the data }
@@ -1475,7 +1478,6 @@ implementation
              so we keep the difference depending on whether the original was
              allocated via getstatic/getlocal/getglobal datalabel) }
            startlab:=tasmlabel.create(current_asmdata.AsmSymbolDict,startlab.name+'$strlab',startlab.bind,startlab.typ);
-           startlab.increfs;
          end;
        { sanity check }
        if result.ofs<>string_symofs then
@@ -1744,7 +1746,6 @@ implementation
                { allocate a separate label for the start of the data (see
                  emit_string_const_common() for explanation) }
                startlab:=tasmlabel.create(current_asmdata.AsmSymbolDict,startlab.name+'$strlab',startlab.bind,startlab.typ);
-               startlab.increfs;
              end
            else
              internalerror(2015031502);
@@ -1809,7 +1810,6 @@ implementation
              so we keep the difference depending on whether the original was
              allocated via getstatic/getlocal/getglobal datalabel) }
            startlab:=tasmlabel.create(current_asmdata.AsmSymbolDict,startlab.name+'$dynarrlab',startlab.bind,startlab.typ);
-           startlab.increfs;
          end;
        { sanity check }
        if result.ofs<>dynarray_symofs then