diff options
author | Yann Herklotz <git@yannherklotz.com> | 2021-09-17 16:52:29 +0100 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2021-09-17 16:52:29 +0100 |
commit | 4be142376801c205ffd701208fad8eedf2c08d90 (patch) | |
tree | d2f4d54cc34319e380e349eddef61c2994202e8b /aarch64/SelectOp.vp | |
parent | 48a9dcbdc968bcf05b4eec17b8c7fd471fb80240 (diff) | |
parent | c9fad7cd7bdc4e79fb06a1d39abfa0d5471623e5 (diff) | |
download | compcert-4be142376801c205ffd701208fad8eedf2c08d90.tar.gz compcert-4be142376801c205ffd701208fad8eedf2c08d90.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'aarch64/SelectOp.vp')
-rw-r--r-- | aarch64/SelectOp.vp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/aarch64/SelectOp.vp b/aarch64/SelectOp.vp index 5bd96987..b5a03989 100644 --- a/aarch64/SelectOp.vp +++ b/aarch64/SelectOp.vp @@ -536,10 +536,18 @@ Definition select (ty: typ) (cond: condition) (args: exprlist) (e1 e2: expr) := (** ** Recognition of addressing modes for load and store operations *) +(** Some symbols are relocatable (e.g. external symbols in macOS) + and cannot be used with [Aglobal] addressing mode. *) + +Parameter symbol_is_relocatable: ident -> bool. + Nondetfunction addressing (chunk: memory_chunk) (e: expr) := match e with | Eop (Oaddrstack n) Enil => (Ainstack n, Enil) - | Eop (Oaddrsymbol id ofs) Enil => (Aglobal id ofs, Enil) + | Eop (Oaddrsymbol id ofs) Enil => + if symbol_is_relocatable id + then (Aindexed (Ptrofs.to_int64 ofs), Eop (Oaddrsymbol id Ptrofs.zero) Enil ::: Enil) + else (Aglobal id ofs, Enil) | Eop (Oaddlimm n) (e1:::Enil) => (Aindexed n, e1:::Enil) | Eop (Oaddlshift Slsl a) (e1:::e2:::Enil) => (Aindexed2shift a, e1:::e2:::Enil) | Eop (Oaddlext x a) (e1:::e2:::Enil) => (Aindexed2ext x a, e1:::e2:::Enil) |