* 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 -
This commit is contained in:
florian 2015-12-29 13:32:21 +00:00
parent c929bb32ae
commit 3f2057a2f2
2 changed files with 14 additions and 9 deletions

View File

@ -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)

View File

@ -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}