[MPlayer-dev-eng] [PATCH] Fix crash when using win32 codecs on mac osx / intel

Ulion ulion2002 at gmail.com
Wed Aug 29 04:14:24 CEST 2007


Hello,

I'm sorry for a script bug in the previous patch I posted.

Here I fixed it and please review it.

-- 
Ulion
-------------- next part --------------
Index: configure
===================================================================
--- configure	(revision 24280)
+++ configure	(working copy)
@@ -1504,6 +1504,30 @@
   }
 fi
 
+# Check whether compiler support -mstackrealign or -fstackrealign flag.
+echocheck "cflag stackrealign"
+cat > $TMPC << EOF
+__attribute__((noinline)) static int foo3(int i1, int i2, int i3) {
+  return i3;
+}
+int main() {
+  return foo3(1,2,3)==3 ? 0 : 1;
+}
+EOF
+_cflag_stackrealign=
+if test "$cc_vendor" = "gnu" ; then
+  # Gcc offical version above 4.2 has flag -fstackrealign.
+  # Or earlier svn version has flag -mstackrealign for intel x86 platform only.
+  cc_check -O4 -fstackrealign && _cflag_stackrealign=-fstackrealign
+  test -z "$_cflag_stackrealign" && cc_check -O4 -mstackrealign && _cflag_stackrealign=-mstackrealign
+  if test -n "$_cflag_stackrealign" && ! tmp_run ; then
+    # Check the lost-third-parameter bug, try to fix it if we can. Referred in
+    # http://www.dribin.org/dave/blog/archives/2006/12/05/missing_third_param/
+    cc_check -O4 $_cflag_stackrealign -fno-unit-at-a-time && tmp_run && _cflag_stackrealign="$_cflag_stackrealign -fno-unit-at-a-time"
+  fi
+fi
+test -n "$_cflag_stackrealign" && echores "$_cflag_stackrealign" || echores "no"
+
 # ---
 
 # now that we know what compiler should be used for compilation, try to find
@@ -7498,6 +7522,7 @@
 EXTRAXX_INC = $_inc_extra $_inc_extraxx
 OPTFLAGS = $CFLAGS \$(EXTRA_INC)
 CXXFLAGS = $CXXFLAGS \$(EXTRAXX_INC)
+CFLAG_STACKREALIGN = $_cflag_stackrealign
 INSTALLSTRIP = $_install_strip
 CHARSET = $_charset
 HELP_FILE = $_mp_help
Index: loader/Makefile
===================================================================
--- loader/Makefile	(revision 24280)
+++ loader/Makefile	(working copy)
@@ -11,6 +11,8 @@
 # QTX emulation is not supported in Darwin
 ifneq ($(TARGET_OS),Darwin)
 SRCS_COMMON += wrapper.S
+else
+win32.o: CFLAGS += $(CFLAG_STACKREALIGN)
 endif
 endif
 


More information about the MPlayer-dev-eng mailing list