Revision: 10977
Author: [email protected]
Date: Fri Mar 9 02:20:42 2012
Log: Add clobber list to arm inline asm.
While enabling "-fstack-protector", compiler generates code in
function prologue and epilogue to do stack check. However, without
knowing that 'r1', 'r2' and 'r3' is used/destroyed in inline asm,
compiler assumes that 'r1', 'r2', or 'r3' can be used exclusively,
which leads to a core dump.
Fix to this is quite straightforward, just add clobber list to the
inlineasm.
BUG=None
TEST=manually checked the generated asm code,boot up chrome browser
successfully with this modification
Review URL: https://chromiumcodereview.appspot.com/9618017
http://code.google.com/p/v8/source/detail?r=10977
Modified:
/branches/bleeding_edge/src/platform-linux.cc
=======================================
--- /branches/bleeding_edge/src/platform-linux.cc Thu Feb 23 04:11:24 2012
+++ /branches/bleeding_edge/src/platform-linux.cc Fri Mar 9 02:20:42 2012
@@ -187,15 +187,15 @@
// pair r0, r1 is loaded with 0.0. If -mfloat-abi=hard is pased to GCC then
// calling this will return 1.0 and otherwise 0.0.
static void ArmUsingHardFloatHelper() {
- asm("mov r0, #0");
+ asm("mov r0, #0":::"r0");
#if defined(__VFP_FP__) && !defined(__SOFTFP__)
// Load 0x3ff00000 into r1 using instructions available in both ARM
// and Thumb mode.
- asm("mov r1, #3");
- asm("mov r2, #255");
- asm("lsl r1, r1, #8");
- asm("orr r1, r1, r2");
- asm("lsl r1, r1, #20");
+ asm("mov r1, #3":::"r1");
+ asm("mov r2, #255":::"r2");
+ asm("lsl r1, r1, #8":::"r1");
+ asm("orr r1, r1, r2":::"r1");
+ asm("lsl r1, r1, #20":::"r1");
// For vmov d0, r0, r1 use ARM mode.
#ifdef __thumb__
asm volatile(
@@ -209,12 +209,12 @@
" adr r3, 2f+1 \n\t"
" bx r3 \n\t"
" .THUMB \n"
- "2: \n\t");
+ "2: \n\t":::"r3");
#else
asm("vmov d0, r0, r1");
#endif // __thumb__
#endif // defined(__VFP_FP__) && !defined(__SOFTFP__)
- asm("mov r1, #0");
+ asm("mov r1, #0":::"r1");
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev