diff --git a/libavcodec/bfin/config_bfin.h b/libavcodec/bfin/config_bfin.h
index 322919275afc57d803b11d5934a62037c0ee59bf..f3a2c6ebc6ef8220b4f8ffc52d55eca864ecbfa3 100644
--- a/libavcodec/bfin/config_bfin.h
+++ b/libavcodec/bfin/config_bfin.h
@@ -31,11 +31,13 @@ DEFUN(put_pixels_clamped,mL1,
 #ifndef AVCODEC_BFIN_CONFIG_BFIN_H
 #define AVCODEC_BFIN_CONFIG_BFIN_H
 
+#include "config.h"
+
 #ifndef DEFUN
 
 #define mL3 .text
 #ifndef mL1
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 #define mL1 .l1.text
 #else
 #define mL1 mL3
diff --git a/libavcodec/bfin/dsputil_bfin.h b/libavcodec/bfin/dsputil_bfin.h
index 8d5d32746d745dd9dffb9364d7f461934e21da83..90d7e2fb3ba0b37ab68e4b07620ca780f24a4402 100644
--- a/libavcodec/bfin/dsputil_bfin.h
+++ b/libavcodec/bfin/dsputil_bfin.h
@@ -24,7 +24,7 @@
 #ifndef AVCODEC_BFIN_DSPUTIL_BFIN_H
 #define AVCODEC_BFIN_DSPUTIL_BFIN_H
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 #define attribute_l1_text  __attribute__ ((l1_text))
 #define attribute_l1_data_b __attribute__((l1_data_B))
 #else
diff --git a/libavcodec/bfin/fdct_bfin.S b/libavcodec/bfin/fdct_bfin.S
index 03f2709e3c1a3e8b75496acfc07f5727759919d9..0eac7a304287ef2ef19acd0e3d0a23d585cfe93e 100644
--- a/libavcodec/bfin/fdct_bfin.S
+++ b/libavcodec/bfin/fdct_bfin.S
@@ -127,9 +127,10 @@ root:/u/ffmpeg/bhead/libavcodec>
 
 */
 
+#include "config.h"
 #include "config_bfin.h"
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.B,"aw",@progbits
 #else
 .data
@@ -138,7 +139,7 @@ root:/u/ffmpeg/bhead/libavcodec>
 dct_coeff:
 .short 0x5a82, 0x2d41, 0x187e, 0x3b21, 0x0c7c, 0x3ec5, 0x238e, 0x3537;
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.A,"aw",@progbits
 #endif
 .align 4
diff --git a/libavcodec/bfin/idct_bfin.S b/libavcodec/bfin/idct_bfin.S
index 7bb104038d4da2cce853db0003f8d09877da790e..04f9159d8d884f447960b17760297b64432a568f 100644
--- a/libavcodec/bfin/idct_bfin.S
+++ b/libavcodec/bfin/idct_bfin.S
@@ -55,9 +55,10 @@ IDCT BFINidct: 88.3 kdct/s
 
 */
 
+#include "config.h"
 #include "config_bfin.h"
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.B,"aw",@progbits
 #else
 .data
@@ -76,7 +77,7 @@ coefs:
 .short 0x18F9;           //cos(7pi/16)
 .short 0x7D8A;           //cos(pi/16)
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.A,"aw",@progbits
 #endif
 
diff --git a/libavcodec/bfin/vp3_idct_bfin.S b/libavcodec/bfin/vp3_idct_bfin.S
index ec8c1bee77c543ba8f068ab5fe7692e43de19c75..21f732c58d135ddc10557626351b5041cdfa48c8 100644
--- a/libavcodec/bfin/vp3_idct_bfin.S
+++ b/libavcodec/bfin/vp3_idct_bfin.S
@@ -28,9 +28,10 @@ Registers Used  : A0, A1, R0-R7, I0-I3, B0, B2, B3, M0-M2, L0-L3, P0-P5, LC0.
 
 */
 
+#include "config.h"
 #include "config_bfin.h"
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.B,"aw",@progbits
 #else
 .data
@@ -49,7 +50,7 @@ coefs:
 .short 0x18F9;           //cos(7pi/16)
 .short 0x7D8A;           //cos(pi/16)
 
-#ifdef __FDPIC__
+#if defined(__FDPIC__) && CONFIG_SRAM
 .section .l1.data.A
 #endif