diff --git a/rts/Linker.c b/rts/Linker.c index 2ee3cbce265d6f73165e0aa14b88f494c9cb76a6..c0ab66498725efa58c3801454dd5bbe44fbe071a 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]); }