Browse code

Compile x86/swscale_template with -mno-red-zone.

Replaces a very hackish hack to fix the same issue (call instruction
overwriting stack variables).

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>

Reimar Döffinger authored on 2011/09/22 02:10:58
Showing 3 changed files
... ...
@@ -3179,6 +3179,10 @@ else
3179 3179
 fi
3180 3180
 check_cflags -fno-math-errno
3181 3181
 check_cflags -fno-signed-zeros
3182
+check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
3183
+int x;
3184
+EOF
3185
+
3182 3186
 
3183 3187
 if enabled icc; then
3184 3188
     # Just warnings, no remarks
... ...
@@ -3469,6 +3473,7 @@ SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
3469 3469
 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
3470 3470
 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
3471 3471
 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
3472
+NOREDZONE_FLAGS=$noredzone_flags
3472 3473
 EOF
3473 3474
 
3474 3475
 get_version(){
... ...
@@ -21,6 +21,8 @@ OBJS-$(HAVE_MMX)           +=  x86/rgb2rgb.o            \
21 21
 OBJS-$(HAVE_VIS)           +=  sparc/yuv2rgb_vis.o
22 22
 OBJS-$(HAVE_YASM)          +=  x86/scale.o
23 23
 
24
+$(SUBDIR)x86/swscale_mmx.o: CFLAGS += $(NOREDZONE_FLAGS)
25
+
24 26
 TESTPROGS = colorspace swscale
25 27
 
26 28
 DIRS = bfin mlib ppc sparc x86
... ...
@@ -1963,10 +1963,6 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
1963 1963
 #if defined(PIC)
1964 1964
     DECLARE_ALIGNED(8, uint64_t, ebxsave);
1965 1965
 #endif
1966
-    // HACK: gcc 4.6 no longer decrements esp,
1967
-    // use this to make it reserve space for the call
1968
-    // return address
1969
-    void *dummy;
1970 1966
 
1971 1967
     __asm__ volatile(
1972 1968
 #if defined(PIC)
... ...
@@ -2018,7 +2014,6 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
2018 2018
 #if defined(PIC)
2019 2019
           ,"m" (ebxsave)
2020 2020
 #endif
2021
-          ,"m" (dummy)
2022 2021
         : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
2023 2022
 #if !defined(PIC)
2024 2023
          ,"%"REG_b
... ...
@@ -2040,10 +2035,6 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
2040 2040
 #if defined(PIC)
2041 2041
     DECLARE_ALIGNED(8, uint64_t, ebxsave);
2042 2042
 #endif
2043
-    // HACK: gcc 4.6 no longer decrements esp,
2044
-    // use this to make it reserve space for the call
2045
-    // return address
2046
-    void *dummy;
2047 2043
 
2048 2044
     __asm__ volatile(
2049 2045
 #if defined(PIC)
... ...
@@ -2083,7 +2074,6 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
2083 2083
 #if defined(PIC)
2084 2084
           ,"m" (ebxsave)
2085 2085
 #endif
2086
-          ,"m" (dummy)
2087 2086
         : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
2088 2087
 #if !defined(PIC)
2089 2088
          ,"%"REG_b