[commit: ghc] master: rts/Linker(ARM): Ensure all code sections are flushed from cache (0054bcd)

git at git.haskell.org git at git.haskell.org
Sun Dec 27 23:14:13 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0054bcd42260d248e391ed01d6b3da4fefdad45c/ghc

>---------------------------------------------------------------

commit 0054bcd42260d248e391ed01d6b3da4fefdad45c
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sun Dec 27 23:59:59 2015 +0100

    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


>---------------------------------------------------------------

0054bcd42260d248e391ed01d6b3da4fefdad45c
 rts/Linker.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

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



More information about the ghc-commits mailing list