* 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; sym : TAsmSymbol;
begin begin
{ check not really correct: should only be used for non-Thumb cpus } { check not really correct: should only be used for non-Thumb cpus }
if (CPUARM_HAS_BLX_LABEL in cpu_capabilities[current_settings.cputype]) and // 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 } // { WinCE GNU AS (not sure if this applies in general) does not support BLX imm }
(target_info.system<>system_arm_wince) then // (target_info.system<>system_arm_wince) then
branchopcode:=A_BLX // branchopcode:=A_BLX
else // 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; branchopcode:=A_BL;
if not(weak) then if not(weak) then
sym:=current_asmdata.RefAsmSymbol(s) sym:=current_asmdata.RefAsmSymbol(s)

View File

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