Browse Source

+ initial support for ARMv2
* check for unassigned valuestr when writing ntbs eabi attributes

git-svn-id: trunk@49348 -

florian 4 years ago
parent
commit
8535c758ef

+ 1 - 0
compiler/arm/aasmcpu.pas

@@ -2213,6 +2213,7 @@ implementation
             IF_NONE,
             IF_NONE,
             IF_ARMv4,
             IF_ARMv4,
             IF_ARMv4,
             IF_ARMv4,
+            IF_ARMv4,
             IF_ARMv4T or IF_ARMv4,
             IF_ARMv4T or IF_ARMv4,
             IF_ARMv4T or IF_ARMv4 or IF_ARMv5 or IF_ARMv5T,
             IF_ARMv4T or IF_ARMv4 or IF_ARMv5 or IF_ARMv5T,
             IF_ARMv4T or IF_ARMv4 or IF_ARMv5 or IF_ARMv5T or IF_ARMv5TE,
             IF_ARMv4T or IF_ARMv4 or IF_ARMv5 or IF_ARMv5T or IF_ARMv5TE,

+ 1 - 0
compiler/arm/agarmgas.pas

@@ -61,6 +61,7 @@ unit agarmgas;
     const 
     const 
       cputype_to_gas_march : array[tcputype] of string = (
       cputype_to_gas_march : array[tcputype] of string = (
         '', // cpu_none
         '', // cpu_none
+        'armv2',
         'armv3',
         'armv3',
         'armv4',
         'armv4',
         'armv4t',
         'armv4t',

+ 3 - 0
compiler/arm/cpuinfo.pas

@@ -37,6 +37,7 @@ Type
    { possible supported processors for this target }
    { possible supported processors for this target }
    tcputype =
    tcputype =
       (cpu_none,
       (cpu_none,
+       cpu_armv2,
        cpu_armv3,
        cpu_armv3,
        cpu_armv4,
        cpu_armv4,
        cpu_armv4t,
        cpu_armv4t,
@@ -554,6 +555,7 @@ Const
    ];
    ];
 
 
    cputypestr : array[tcputype] of string[8] = ('',
    cputypestr : array[tcputype] of string[8] = ('',
+     'ARMV2',
      'ARMV3',
      'ARMV3',
      'ARMV4',
      'ARMV4',
      'ARMV4T',
      'ARMV4T',
@@ -1095,6 +1097,7 @@ Const
  const
  const
    cpu_capabilities : array[tcputype] of set of tcpuflags =
    cpu_capabilities : array[tcputype] of set of tcpuflags =
      ( { cpu_none     } [],
      ( { cpu_none     } [],
+       { cpu_armv2    } [],
        { cpu_armv3    } [],
        { cpu_armv3    } [],
        { cpu_armv4    } [CPUARM_HAS_ALL_MEM,CPUARM_HAS_UMULL],
        { cpu_armv4    } [CPUARM_HAS_ALL_MEM,CPUARM_HAS_UMULL],
        { cpu_armv4t   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_UMULL],
        { cpu_armv4t   } [CPUARM_HAS_THUMB,CPUARM_HAS_ALL_MEM,CPUARM_HAS_BX,CPUARM_HAS_UMULL],

+ 2 - 2
compiler/arm/narmmat.pas

@@ -77,8 +77,8 @@ implementation
            (nodetype=divn) and
            (nodetype=divn) and
            not(is_64bit(resultdef)) and
            not(is_64bit(resultdef)) and
            {Only the ARM and thumb2-isa support umull and smull, which are required for arbitary division by const optimization}
            {Only the ARM and thumb2-isa support umull and smull, which are required for arbitary division by const optimization}
-           (GenerateArmCode or
-            GenerateThumb2Code or
+           (((GenerateArmCode or
+             GenerateThumb2Code) and (CPUARM_HAS_UMULL in cpu_capabilities[current_settings.cputype])) or
             (ispowerof2(tordconstnode(right).value,power) or
             (ispowerof2(tordconstnode(right).value,power) or
             (tordconstnode(right).value=1) or
             (tordconstnode(right).value=1) or
             (tordconstnode(right).value=int64(-1))
             (tordconstnode(right).value=int64(-1))

+ 1 - 0
compiler/arm/narmutil.pas

@@ -97,6 +97,7 @@ interface
         if (target_info.system in [system_arm_linux]) and (target_info.abi in [abi_eabihf,abi_eabi]) then
         if (target_info.system in [system_arm_linux]) and (target_info.abi in [abi_eabihf,abi_eabi]) then
           begin
           begin
             case current_settings.cputype of
             case current_settings.cputype of
+              cpu_armv2,
               cpu_armv3:
               cpu_armv3:
                 begin
                 begin
                   current_asmdata.asmlists[al_start].Concat(tai_eabi_attribute.create(Tag_CPU_arch,0));
                   current_asmdata.asmlists[al_start].Concat(tai_eabi_attribute.create(Tag_CPU_arch,0));

+ 12 - 3
compiler/assemble.pas

@@ -1791,7 +1791,10 @@ Implementation
                    eattrtype_dword:
                    eattrtype_dword:
                      eabi_section.alloc(LengthUleb128(tai_eabi_attribute(hp).value));
                      eabi_section.alloc(LengthUleb128(tai_eabi_attribute(hp).value));
                    eattrtype_ntbs:
                    eattrtype_ntbs:
-                     eabi_section.alloc(Length(tai_eabi_attribute(hp).valuestr^)+1);
+                     if assigned(tai_eabi_attribute(hp).valuestr) then
+                       eabi_section.alloc(Length(tai_eabi_attribute(hp).valuestr^)+1)
+                     else
+                       eabi_section.alloc(1);
                    else
                    else
                      Internalerror(2019100701);
                      Internalerror(2019100701);
                  end;
                  end;
@@ -1969,7 +1972,10 @@ Implementation
                    eattrtype_dword:
                    eattrtype_dword:
                      eabi_section.alloc(LengthUleb128(tai_eabi_attribute(hp).value));
                      eabi_section.alloc(LengthUleb128(tai_eabi_attribute(hp).value));
                    eattrtype_ntbs:
                    eattrtype_ntbs:
-                     eabi_section.alloc(Length(tai_eabi_attribute(hp).valuestr^)+1);
+                     if assigned(tai_eabi_attribute(hp).valuestr) then
+                       eabi_section.alloc(Length(tai_eabi_attribute(hp).valuestr^)+1)
+                     else
+                       eabi_section.alloc(1);
                    else
                    else
                      Internalerror(2019100703);
                      Internalerror(2019100703);
                  end;
                  end;
@@ -2336,7 +2342,10 @@ Implementation
                      end;
                      end;
                    eattrtype_ntbs:
                    eattrtype_ntbs:
                      begin
                      begin
-                       s:=tai_eabi_attribute(hp).valuestr^+#0;
+                       if assigned(tai_eabi_attribute(hp).valuestr) then
+                         s:=tai_eabi_attribute(hp).valuestr^+#0
+                       else
+                         s:=#0;
                        eabi_section.write(s[1],Length(s));
                        eabi_section.write(s[1],Length(s));
                      end
                      end
                    else
                    else