From 3f2057a2f2e890cc911efb5fd82dc1e2c7bc6d04 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 29 Dec 2015 13:32:21 +0000 Subject: [PATCH] * 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 - --- compiler/arm/cgcpu.pas | 12 +++++++----- rtl/arm/arm.inc | 11 +++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index 11ba97a605..d29222a3e6 100644 --- a/compiler/arm/cgcpu.pas +++ b/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) diff --git a/rtl/arm/arm.inc b/rtl/arm/arm.inc index cf6e3ec588..a163e2dc86 100644 --- a/rtl/arm/arm.inc +++ b/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}