فهرست منبع

+ add method get_dynarray_symofs to retrieve the platform specific offset of the dynamic array data from its
meta data record

git-svn-id: trunk@39039 -

svenbarth 7 سال پیش
والد
کامیت
e863245021
1فایلهای تغییر یافته به همراه16 افزوده شده و 0 حذف شده
  1. 16 0
      compiler/aasmcnst.pas

+ 16 - 0
compiler/aasmcnst.pas

@@ -444,6 +444,12 @@ type
        supported this is equal to the header size }
        supported this is equal to the header size }
      class function get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint; virtual;
      class function get_string_symofs(typ: tstringtype; winlikewidestring: boolean): pint; virtual;
 
 
+     { returns the offset of the array data relatve to dynamic array constant
+       labels. On most platforms, this is 0 (with the header at a negative
+       offset), but on some platforms such negative offsets are not supported
+       and thus this is equal to the header size }
+     class function get_dynarray_symofs:pint;virtual;
+
      { set the fieldvarsym whose data we will emit next; needed
      { set the fieldvarsym whose data we will emit next; needed
        in case of variant records, so we know which part of the variant gets
        in case of variant records, so we know which part of the variant gets
        initialised. Also in case of objects, because the fieldvarsyms are spread
        initialised. Also in case of objects, because the fieldvarsyms are spread
@@ -1118,6 +1124,16 @@ implementation
      end;
      end;
 
 
 
 
+   class function ttai_typedconstbuilder.get_dynarray_symofs:pint;
+     begin
+       { darwin's linker does not support negative offsets }
+       if not (target_info.system in systems_darwin) then
+         result:=0
+       else
+         result:=get_dynarray_header_size;
+     end;
+
+
    class function ttai_typedconstbuilder.get_string_header_size(typ: tstringtype; winlikewidestring: boolean): pint;
    class function ttai_typedconstbuilder.get_string_header_size(typ: tstringtype; winlikewidestring: boolean): pint;
      var
      var
        ansistring_header_size: pint;
        ansistring_header_size: pint;