summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rts/Linker.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/rts/Linker.c b/rts/Linker.c
index 2ee3cbce26..c0ab664987 100644
--- a/rts/Linker.c
+++ b/rts/Linker.c
@@ -2747,8 +2747,16 @@ static int ocAllocateSymbolExtras( ObjectCode* oc, int count, int first )
static void
ocFlushInstructionCache( ObjectCode *oc )
{
+ int i;
// Object code
- __clear_cache(oc->image, oc->image + oc->fileSize);
+ for (i=0; i < oc->n_sections; i++) {
+ Section *s = &oc->sections[i];
+ // This is a bit too broad but we don't have any way to determine what
+ // is certainly code
+ if (s->kind == SECTIONKIND_CODE_OR_RODATA)
+ __clear_cache(s->start, (void*) ((uintptr_t) s->start + s->size));
+ }
+
// Jump islands
__clear_cache(oc->symbol_extras, &oc->symbol_extras[oc->n_symbol_extras]);
}