Jelajahi Sumber

- Applied patch by Christo Crause from #33914

git-svn-id: trunk@42493 -
Jeppe Johansen 6 tahun lalu
induk
melakukan
ff3372567f
2 mengubah file dengan 33 tambahan dan 0 penghapusan
  1. 17 0
      compiler/aasmtai.pas
  2. 16 0
      compiler/dbgdwarf.pas

+ 17 - 0
compiler/aasmtai.pas

@@ -702,6 +702,9 @@ interface
           constructor Create_int_codeptr_unaligned(_value: int64);
           constructor Create_int_dataptr(_value: int64);
           constructor Create_int_dataptr_unaligned(_value: int64);
+{$ifdef avr}
+          constructor Create_int_dataptr_unaligned(_value: int64; size: taiconst_type);
+{$endif}
 {$ifdef i8086}
           constructor Create_seg_name(const name:string);
           constructor Create_dgroup;
@@ -1962,6 +1965,20 @@ implementation
       end;
 
 
+{$ifdef avr}
+    constructor tai_const.Create_int_dataptr_unaligned(_value: int64;
+      size: taiconst_type);
+      begin
+        inherited Create;
+        typ:=ait_const;
+        consttype:=size;
+        sym:=nil;
+        endsym:=nil;
+        symofs:=0;
+        value:=_value;
+      end;
+{$endif avr}
+
 {$ifdef i8086}
     constructor tai_const.Create_seg_name(const name:string);
       begin

+ 16 - 0
compiler/dbgdwarf.pas

@@ -48,6 +48,12 @@ interface
       DbgBase;
 
     type
+      {$ifdef avr}
+      // re-map to larger types because of offsets required to distinguish different memory spaces
+      puint = cardinal;
+      pint = longint;
+      {$endif avr}
+
       { Tag names and codes.   }
       tdwarf_tag = (DW_TAG_padding := $00,DW_TAG_array_type := $01,
         DW_TAG_class_type := $02,DW_TAG_entry_point := $03,
@@ -538,6 +544,11 @@ implementation
       { Implementation-defined range start.   }
       DW_LANG_hi_user = $ffff;
 
+      {$ifdef avr}
+      // More space required to include memory type offset
+      aitconst_ptr_unaligned = aitconst_32bit_unaligned;
+      {$endif avr}
+
     type
       { Names and codes for macro information.   }
       tdwarf_macinfo_record_type = (DW_MACINFO_define := 1,DW_MACINFO_undef := 2,
@@ -3142,7 +3153,12 @@ implementation
                  end;
                *)
                templist.concat(tai_const.create_8bit(3));
+               {$ifdef avr}
+               // Add $800000 to indicate that the address is in memory space
+               templist.concat(tai_const.create_int_dataptr_unaligned(sym.addroffset + $800000, aitconst_ptr_unaligned));
+               {$else}
                templist.concat(tai_const.create_int_dataptr_unaligned(sym.addroffset));
+               {$endif}
                blocksize:=1+sizeof(puint);
             end;
           toasm :