aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/Asmgen.v
diff options
context:
space:
mode:
authorJustus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr>2020-07-15 08:29:11 +0200
committerJustus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr>2020-07-15 08:29:11 +0200
commitd83bdbfb0f32f41fd979d37d6972e92c2f27325c (patch)
treedfa5a0fe80df015547ec6a876a6677967410ae96 /aarch64/Asmgen.v
parentc48fd3f91f6dc9a35c7c9cb4a4b21d0598d91930 (diff)
downloadcompcert-kvx-d83bdbfb0f32f41fd979d37d6972e92c2f27325c.tar.gz
compcert-kvx-d83bdbfb0f32f41fd979d37d6972e92c2f27325c.zip
"we must check that the generated code contains less than [2^32] instructions otherwise the offset part of the [PC] code pointer could wrap around, leading to incorrect executions"
-- From the original aarch64/Asmgen.v
Diffstat (limited to 'aarch64/Asmgen.v')
-rw-r--r--aarch64/Asmgen.v5
1 files changed, 3 insertions, 2 deletions
diff --git a/aarch64/Asmgen.v b/aarch64/Asmgen.v
index ec680478..a3b21a88 100644
--- a/aarch64/Asmgen.v
+++ b/aarch64/Asmgen.v
@@ -336,8 +336,9 @@ Fixpoint unfold (bbs: Asmblock.bblocks) : res Asm.code :=
Definition transf_function (f: Asmblock.function) : res Asm.function :=
do c <- unfold (Asmblock.fn_blocks f);
- OK {| Asm.fn_sig := Asmblock.fn_sig f
- ; Asm.fn_code := c |}.
+ if zlt Ptrofs.max_unsigned (Z.of_nat (length c))
+ then Error (msg "Asmgen.trans_function: code size exceeded")
+ else OK {| Asm.fn_sig := Asmblock.fn_sig f; Asm.fn_code := c |}.
Definition transf_fundef (f: Asmblock.fundef) : res Asm.fundef :=
transf_partial_fundef transf_function f.