summaryrefslogtreecommitdiff
path: root/rts/Linker.c
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2015-12-27 23:59:59 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-28 00:02:53 +0100
commit0054bcd42260d248e391ed01d6b3da4fefdad45c (patch)
tree55dd4f41521526ce966fd5c49d052012b827d659 /rts/Linker.c
parent1b0001680ef66a2853103974d3f3f956bb0560a3 (diff)
downloadhaskell-0054bcd42260d248e391ed01d6b3da4fefdad45c.tar.gz
rts/Linker(ARM): Ensure all code sections are flushed from cache
Test Plan: Validate with T12299 Reviewers: hsyl20, austin, erikd Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1708 GHC Trac Issues: #11299
Diffstat (limited to 'rts/Linker.c')
-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]);
}