summaryrefslogtreecommitdiff
path: root/compiler/arm
diff options
context:
space:
mode:
authoryury <yury@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-09-16 21:30:20 +0000
committeryury <yury@3ad0048d-3df7-0310-abae-a5850022a9f2>2015-09-16 21:30:20 +0000
commit5c461671648d2713397111b2be61ad2f1b1b9655 (patch)
treebe9c38c1a4d50093026e65179688a87465e354ac /compiler/arm
parent17082c33b52e0cf23f5396e3a8bc9c3640d47a79 (diff)
downloadfpc-5c461671648d2713397111b2be61ad2f1b1b9655.tar.gz
* ARM: Fixed GOT init when optimization is off.
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@31728 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/arm')
-rw-r--r--compiler/arm/cgcpu.pas21
1 files changed, 8 insertions, 13 deletions
diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas
index 96f59d7afc..a3a60597be 100644
--- a/compiler/arm/cgcpu.pas
+++ b/compiler/arm/cgcpu.pas
@@ -2355,19 +2355,14 @@ unit cgcpu;
current_asmdata.getaddrlabel(l);
current_procinfo.aktlocaldata.concat(tai_const.Create_rel_sym_offset(aitconst_32bit,l,current_asmdata.RefAsmSymbol('_GLOBAL_OFFSET_TABLE_'),-8));
cg.a_label(list,l);
- if cs_opt_regvar in current_settings.optimizerswitches then
- begin
- {
- When regvars are used, it is needed to perform GOT calculations using the scratch register R12
- and then MOV the result to the GOT register. Otherwise the register allocator will use
- register R0 as temp to perform calculations in case if a procedure uses all available registers.
- It leads to corruption of R0 which is normally holds a value of the first procedure parameter.
- }
- list.concat(Taicpu.op_reg_reg_reg(A_ADD,NR_R12,NR_PC,NR_R12));
- list.concat(Taicpu.op_reg_reg(A_MOV,current_procinfo.got,NR_R12));
- end
- else
- list.concat(Taicpu.op_reg_reg_reg(A_ADD,current_procinfo.got,NR_PC,NR_R12));
+ {
+ It is needed to perform GOT calculations using the scratch register R12
+ and then MOV the result to the GOT register. Otherwise the register allocator will use
+ register R0 as temp to perform calculations in case if a procedure uses all available registers.
+ It leads to corruption of R0 which is normally holds a value of the first procedure parameter.
+ }
+ list.concat(Taicpu.op_reg_reg_reg(A_ADD,NR_R12,NR_PC,NR_R12));
+ list.concat(Taicpu.op_reg_reg(A_MOV,current_procinfo.got,NR_R12));
a_reg_dealloc(list,NR_R12);
end;
end;