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>
(cherry picked from commit 424bcc46b5fb0d662e0fb9ad6319c5b9ef3d770f)

Reimar Döffinger authored on 2011/09/22 02:10:58
Showing 3 changed files
... ...
@@ -3073,6 +3073,10 @@ else
3073 3073
 fi
3074 3074
 check_cflags -fno-math-errno
3075 3075
 check_cflags -fno-signed-zeros
3076
+check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
3077
+int x;
3078
+EOF
3079
+
3076 3080
 
3077 3081
 if enabled icc; then
3078 3082
     # Just warnings, no remarks
... ...
@@ -3383,6 +3387,7 @@ SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
3383 3383
 SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}
3384 3384
 SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}
3385 3385
 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
3386
+NOREDZONE_FLAGS=$noredzone_flags
3386 3387
 EOF
3387 3388
 
3388 3389
 get_version(){
... ...
@@ -20,6 +20,8 @@ OBJS-$(HAVE_MMX)           +=  x86/rgb2rgb.o            \
20 20
                                x86/yuv2rgb_mmx.o
21 21
 OBJS-$(HAVE_VIS)           +=  sparc/yuv2rgb_vis.o
22 22
 
23
+$(SUBDIR)x86/swscale_mmx.o: CFLAGS += $(NOREDZONE_FLAGS)
24
+
23 25
 TESTPROGS = colorspace swscale
24 26
 
25 27
 DIRS = bfin mlib ppc sparc x86
... ...
@@ -2240,10 +2240,6 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
2240 2240
 #if defined(PIC)
2241 2241
     DECLARE_ALIGNED(8, uint64_t, ebxsave);
2242 2242
 #endif
2243
-    // HACK: gcc 4.6 no longer decrements esp,
2244
-    // use this to make it reserve space for the call
2245
-    // return address
2246
-    void *dummy;
2247 2243
 
2248 2244
     __asm__ volatile(
2249 2245
 #if defined(PIC)
... ...
@@ -2295,7 +2291,6 @@ static void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst,
2295 2295
 #if defined(PIC)
2296 2296
           ,"m" (ebxsave)
2297 2297
 #endif
2298
-          ,"m" (dummy)
2299 2298
         : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
2300 2299
 #if !defined(PIC)
2301 2300
          ,"%"REG_b
... ...
@@ -2317,10 +2312,6 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
2317 2317
 #if defined(PIC)
2318 2318
     DECLARE_ALIGNED(8, uint64_t, ebxsave);
2319 2319
 #endif
2320
-    // HACK: gcc 4.6 no longer decrements esp,
2321
-    // use this to make it reserve space for the call
2322
-    // return address
2323
-    void *dummy;
2324 2320
 
2325 2321
     __asm__ volatile(
2326 2322
 #if defined(PIC)
... ...
@@ -2360,7 +2351,6 @@ static void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst1, int16_t *dst2,
2360 2360
 #if defined(PIC)
2361 2361
           ,"m" (ebxsave)
2362 2362
 #endif
2363
-          ,"m" (dummy)
2364 2363
         : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D
2365 2364
 #if !defined(PIC)
2366 2365
          ,"%"REG_b