title: Android gcc 4.6 crash on __check_for_sync8_kernelhelper - ARM - FFmpeg
body: <p>I'm compiling ffmpeg with gcc 4.6 (as this is default on ndk r9) for armv7-a devices and a weird crash occurs on certain devices that didn't happen when running code compiled with gcc 4.4.3.</p>
  
  <p>this is the backtrace:</p>
  
  <pre><code>08-02 18:36:08.200: I/sec_anm_ahi_output(1535): setParameters(stop_output_streamtype=1)
  08-02 18:36:08.360: I/DEBUG(18804):          #00  pc 000162a0  /system/lib/libc.so (__libc_android_abort)
  08-02 18:36:08.360: I/DEBUG(18804):          #01  pc 00418334  /data/data/com.ffmpeg.android/lib/libffmpeg.so (__check_for_sync8_kernelhelper)
  08-02 18:36:08.360: I/DEBUG(18804): libc base address: afd00000
  </code></pre>
  
  <p>After searching on google, it seems the problem is in 64-bit atomic as it seems my compiled code it's not using dmb instructions instead it's calling kernelhelper:</p>
  
  <p><a href="https://code.google.com/p/android/issues/detail?id=41297" rel="nofollow">https://code.google.com/p/android/issues/detail?id=41297</a></p>
  
  <p><a href="http://www.ogre3d.org/forums/viewtopic.php?f=21&amp;t=78199" rel="nofollow">http://www.ogre3d.org/forums/viewtopic.php?f=21&amp;t=78199</a></p>
  
  <p>The workaround it's to compile for armv7-a, but I'm already doing this with the same results. These are the flags I'm using:</p>
  
  <pre><code>CPU=armv7-a
  OPTIMIZE_CFLAGS="-march=$CPU -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb -D__thumb__"
  EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -march=armv7-a"
  PREFIX=./android/$CPU 
  EXTRA_CONFIGURE=""
  </code></pre>
  
  <p>I have also tried with these, but with same results:</p>
  
  <pre><code>CPU=armv7-a
  OPTIMIZE_CFLAGS="-march=$CPU -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb -D__thumb__"
  EXTRA_LDFLAGS="-Wl,--fix-cortex-a8 -march=armv7-a"
  PREFIX=./android/$CPU 
  EXTRA_CONFIGURE="--disable-armv5te --disable-armv6 --disable-armv6t2"
  </code></pre>
  
  <p>I have tested on different devices and these are the results:</p>
  
  <p>Nexus 4 - No Crash</p>
  
  <p>Nexus 7 - No crash</p>
  
  <p>Galaxy sII - Crash</p>
  
  <p>Galaxy Ace 2 - Crash</p>
  
  <p>I would appreciate any help.</p>
  
  <p>Thanks.</p>