]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
mips: add clearing $ra to CLEAR_CALLER_SAVED_REGS macro
authorPetar Jovanovic <mips32r2@gmail.com>
Fri, 15 Sep 2017 14:04:18 +0000 (16:04 +0200)
committerPetar Jovanovic <mips32r2@gmail.com>
Fri, 15 Sep 2017 14:04:18 +0000 (16:04 +0200)
Return address register belongs to caller saved registers, and compiler can
use it to store temporary values. Clear it.

memcheck/tests/leak.h

index 7809aceae6ceb4bb292f4bd940a9bfba97ed9de2..a1f93e8aaa3b8b9170f857d5f57f1ee2ea3d5951 100644 (file)
                             "move $15, $0 \n\t"   /* t7 = 0 */               \
                             "move $24, $0 \n\t"   /* t8 = 0 */               \
                             "move $25, $0 \n\t"   /* t9 = 0 */               \
+                            "move $31, $0 \n\t"   /* ra = 0 */               \
                             ".set pop     \n\t"                              \
                             : : : "$1", "$2", "$3", "$4", "$5", "$6", "$7",  \
                                   "$8", "$9", "$10", "$11", "$12", "$13",    \
-                                  "$14", "$15", "$24", "$25");               \
+                                  "$14", "$15", "$24", "$25", "$31");        \
    } while (0)
 #elif (__mips == 64)
 #define CLEAR_CALLER_SAVED_REGS                                              \
                             "move $15, $0 \n\t"  /* t3 = 0 */                \
                             "move $24, $0 \n\t"  /* t8 = 0 */                \
                             "move $25, $0 \n\t"  /* t9 = 0 */                \
+                            "move $31, $0 \n\t"  /* ra = 0 */                \
                             ".set pop     \n\t"                              \
                             : : : "$1", "$2", "$3", "$4", "$5", "$6", "$7",  \
                                   "$8", "$9", "$10", "$11", "$12", "$13",    \
-                                  "$14", "$15", "$24", "$25");               \
+                                  "$14", "$15", "$24", "$25", "$31");        \
    } while (0)
 #else
 #define CLEAR_CALLER_SAVED_REGS  /*nothing*/