fix vfasl relocation for arm32

original commit: e15c51c2c29aea545fbb4790f36b15002b7a25a5
This commit is contained in:
Matthew Flatt 2020-06-06 14:29:32 -06:00
parent 0adffe2c19
commit bbbd5a76ac
2 changed files with 17 additions and 7 deletions

View File

@ -167,6 +167,7 @@ static ptr copy(vfasl_info *vfi, ptr pp, seginfo *si);
static uptr sweep(vfasl_info *vfi, ptr p);
static int is_rtd(ptr tf, vfasl_info *vfi);
static IFASLCODE abs_reloc_variant(IFASLCODE type);
static ptr vfasl_encode_relocation(vfasl_info *vfi, ptr obj);
static void relink_code(ptr co, ptr sym_base, ptr *vspaces, uptr *vspace_offsets, IBOOL to_static);
static ptr find_pointer_from_offset(uptr p_off, ptr *vspaces, uptr *vspace_offsets);
@ -1083,6 +1084,20 @@ static int is_rtd(ptr tf, vfasl_info *vfi)
#define VFASL_RELOC_TAG(p) (UNFIX(p) & ((1 << VFASL_RELOC_TAG_BITS) - 1))
#define VFASL_RELOC_POS(p) (UNFIX(p) >> VFASL_RELOC_TAG_BITS)
/* Picks a relocation variant that fits into the actual relocation's
shape, but holds an absolue value */
static IFASLCODE abs_reloc_variant(IFASLCODE type) {
if (type == reloc_abs)
return reloc_abs;
#if defined(I386) || defined(X86_64)
return reloc_abs;
#elif defined(ARMV6)
return reloc_arm32_abs;
#else
>> need to fill in for this platform <<
#endif
}
static ptr vfasl_encode_relocation(vfasl_info *vfi, ptr obj) {
ptr pos;
int which_singleton;
@ -1142,7 +1157,7 @@ static void relink_code(ptr co, ptr sym_base, ptr *vspaces, uptr *vspace_offsets
code_off = RELOC_CODE_OFFSET(entry);
}
a += code_off;
obj = S_get_code_obj(reloc_abs, co, a, item_off);
obj = S_get_code_obj(abs_reloc_variant(RELOC_TYPE(entry)), co, a, item_off);
if (IMMEDIATE(obj)) {
if (Sfixnump(obj)) {

View File

@ -1072,7 +1072,7 @@
[sweep
(S_set_code_obj "gc" (RELOC_TYPE entry) _ a obj item_off)]
[vfasl-sweep
(S_set_code_obj "vfasl" (abs-for-vfasl (RELOC_TYPE entry)) _ a obj item_off)]
(S_set_code_obj "vfasl" (abs_reloc_variant (RELOC_TYPE entry)) _ a obj item_off)]
[else]))))
(case-mode
@ -1142,11 +1142,6 @@
[(vfasl-copy vfasl-sweep) e]
[else]))
(define-trace-macro (abs-for-vfasl e)
(case-mode
[vfasl-sweep reloc_abs]
[else e]))
(define-trace-macro (when-mark e)
(case-mode
[(mark) e]