Prechádzať zdrojové kódy

* do not generate blx instructions, the generation of blx instead of bl was introduced some years ago but today it proves to be wrong: if necessary, the linker converts the bl into a blx, this is also how gcc and clang handle it

git-svn-id: trunk@32788 -
florian 9 rokov pred
rodič
commit
3f2057a2f2
2 zmenil súbory, kde vykonal 14 pridanie a 9 odobranie
  1. 7 5
      compiler/arm/cgcpu.pas
  2. 7 4
      rtl/arm/arm.inc

+ 7 - 5
compiler/arm/cgcpu.pas

@@ -646,11 +646,13 @@ unit cgcpu;
         sym : TAsmSymbol;
       begin
         { check not really correct: should only be used for non-Thumb cpus }
-        if (CPUARM_HAS_BLX_LABEL in cpu_capabilities[current_settings.cputype]) and
-          { WinCE GNU AS (not sure if this applies in general) does not support BLX imm }
-          (target_info.system<>system_arm_wince) then
-          branchopcode:=A_BLX
-        else
+        // if (CPUARM_HAS_BLX_LABEL in cpu_capabilities[current_settings.cputype]) and
+        //   { WinCE GNU AS (not sure if this applies in general) does not support BLX imm }
+        // (target_info.system<>system_arm_wince) then
+        //   branchopcode:=A_BLX
+        // else
+        { use always BL as newer binutils do not translate blx apparently
+          generating BL is also what clang and gcc do by default }
           branchopcode:=A_BL;
         if not(weak) then
           sym:=current_asmdata.RefAsmSymbol(s)

+ 7 - 4
rtl/arm/arm.inc

@@ -547,11 +547,14 @@ asm
 {$endif}
   stmfd   sp!, {r1, lr}
   sub     r0, r1, #8
-{$if defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
-  blx     InterLockedDecrement
-{$else defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
+
+// We use always bl, as newer binutils apparently never translate blx into bl
+// {$if defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
+//   blx     InterLockedDecrement
+// {$else defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
   bl      InterLockedDecrement
-{$endif defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
+// {$endif defined(CPUARM_HAS_BLX_LABEL) and not(defined(WINCE))}
+
   // InterLockedDecrement is a nice guy and sets the z flag for us
   // if the reference count dropped to 0
   ldmnefd sp!, {r1, pc}