[1/2] arm: Use .data.rel.ro for const data with relocations

Message ID 1418039105-89526-1-git-send-email-martin@martin.st
State Committed
Commit f963f80399deb1a2b44c1bac3af7123e8a0c9e46
Headers show

Commit Message

Martin Storsjö Dec. 8, 2014, 11:45 a.m.
---
 configure                       | 3 +++
 libavcodec/arm/fft_fixed_neon.S | 2 +-
 libavcodec/arm/fft_neon.S       | 2 +-
 libavcodec/arm/fft_vfp.S        | 2 +-
 libavutil/arm/asm.S             | 6 +++++-
 5 files changed, 11 insertions(+), 4 deletions(-)

Comments

Janne Grunau Dec. 8, 2014, 2:03 p.m. | #1
On 2014-12-08 13:45:04 +0200, Martin Storsjö wrote:
> ---
>  configure                       | 3 +++
>  libavcodec/arm/fft_fixed_neon.S | 2 +-
>  libavcodec/arm/fft_neon.S       | 2 +-
>  libavcodec/arm/fft_vfp.S        | 2 +-
>  libavutil/arm/asm.S             | 6 +++++-
>  5 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/configure b/configure
> index 9ac4a8e..ed8316f 100755
> --- a/configure
> +++ b/configure
> @@ -1543,6 +1543,7 @@ HAVE_LIST="
>      libdc1394_1
>      libdc1394_2
>      sdl
> +    section_data_rel_ro
>      threads
>      vdpau_x11
>      xlib
> @@ -3415,6 +3416,7 @@ case $target_os in
>          ;;
>      android)
>          disable symver
> +        enable section_data_rel_ro
>          SLIB_INSTALL_NAME='$(SLIBNAME)'
>          SLIB_INSTALL_LINKS=
>          # soname not set on purpose
> @@ -3549,6 +3551,7 @@ case $target_os in
>          ;;
>      linux)
>          enable dv1394
> +        enable section_data_rel_ro
>          ;;
>      irix*)
>          target_os=irix
> diff --git a/libavcodec/arm/fft_fixed_neon.S b/libavcodec/arm/fft_fixed_neon.S
> index faddc00..c70a189 100644
> --- a/libavcodec/arm/fft_fixed_neon.S
> +++ b/libavcodec/arm/fft_fixed_neon.S
> @@ -242,7 +242,7 @@ function ff_fft_fixed_calc_neon, export=1
>          bx              r3
>  endfunc
>  
> -const   fft_fixed_tab_neon
> +const   fft_fixed_tab_neon, relocate=1
>          .word fft4_neon
>          .word fft8_neon
>          .word fft16_neon
> diff --git a/libavcodec/arm/fft_neon.S b/libavcodec/arm/fft_neon.S
> index c4d8918..b161015 100644
> --- a/libavcodec/arm/fft_neon.S
> +++ b/libavcodec/arm/fft_neon.S
> @@ -348,7 +348,7 @@ function ff_fft_permute_neon, export=1
>          pop             {r4,pc}
>  endfunc
>  
> -const   fft_tab_neon
> +const   fft_tab_neon, relocate=1
>          .word fft4_neon
>          .word fft8_neon
>          .word fft16_neon
> diff --git a/libavcodec/arm/fft_vfp.S b/libavcodec/arm/fft_vfp.S
> index 9c7b54e..c2801fa 100644
> --- a/libavcodec/arm/fft_vfp.S
> +++ b/libavcodec/arm/fft_vfp.S
> @@ -33,7 +33,7 @@ function ff_fft_calc_vfp, export=1
>          movrel  a2, (fft_tab_vfp - 8)
>          ldr     pc, [a2, ip, lsl #2]
>  endfunc
> -const fft_tab_vfp
> +const   fft_tab_vfp, relocate=1
>          .word   fft4_vfp
>          .word   fft8_vfp
>          .word   X(ff_fft16_vfp)     @ this one alone is exported
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index 93d74b6..8479304 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -89,12 +89,16 @@ FUNC    .func   \name
>      .endif
>  .endm
>  
> -.macro  const   name, align=2
> +.macro  const   name, align=2, relocate=0
>      .macro endconst
>  ELF     .size   \name, . - \name
>          .purgem endconst
>      .endm
> +.if HAVE_SECTION_DATA_REL_RO && \relocate
> +        .section        .data.rel.ro
> +.else
>          .section        .rodata
> +.endif
>          .align          \align
>  \name:
>  .endm

ok

Janne

Patch

diff --git a/configure b/configure
index 9ac4a8e..ed8316f 100755
--- a/configure
+++ b/configure
@@ -1543,6 +1543,7 @@  HAVE_LIST="
     libdc1394_1
     libdc1394_2
     sdl
+    section_data_rel_ro
     threads
     vdpau_x11
     xlib
@@ -3415,6 +3416,7 @@  case $target_os in
         ;;
     android)
         disable symver
+        enable section_data_rel_ro
         SLIB_INSTALL_NAME='$(SLIBNAME)'
         SLIB_INSTALL_LINKS=
         # soname not set on purpose
@@ -3549,6 +3551,7 @@  case $target_os in
         ;;
     linux)
         enable dv1394
+        enable section_data_rel_ro
         ;;
     irix*)
         target_os=irix
diff --git a/libavcodec/arm/fft_fixed_neon.S b/libavcodec/arm/fft_fixed_neon.S
index faddc00..c70a189 100644
--- a/libavcodec/arm/fft_fixed_neon.S
+++ b/libavcodec/arm/fft_fixed_neon.S
@@ -242,7 +242,7 @@  function ff_fft_fixed_calc_neon, export=1
         bx              r3
 endfunc
 
-const   fft_fixed_tab_neon
+const   fft_fixed_tab_neon, relocate=1
         .word fft4_neon
         .word fft8_neon
         .word fft16_neon
diff --git a/libavcodec/arm/fft_neon.S b/libavcodec/arm/fft_neon.S
index c4d8918..b161015 100644
--- a/libavcodec/arm/fft_neon.S
+++ b/libavcodec/arm/fft_neon.S
@@ -348,7 +348,7 @@  function ff_fft_permute_neon, export=1
         pop             {r4,pc}
 endfunc
 
-const   fft_tab_neon
+const   fft_tab_neon, relocate=1
         .word fft4_neon
         .word fft8_neon
         .word fft16_neon
diff --git a/libavcodec/arm/fft_vfp.S b/libavcodec/arm/fft_vfp.S
index 9c7b54e..c2801fa 100644
--- a/libavcodec/arm/fft_vfp.S
+++ b/libavcodec/arm/fft_vfp.S
@@ -33,7 +33,7 @@  function ff_fft_calc_vfp, export=1
         movrel  a2, (fft_tab_vfp - 8)
         ldr     pc, [a2, ip, lsl #2]
 endfunc
-const fft_tab_vfp
+const   fft_tab_vfp, relocate=1
         .word   fft4_vfp
         .word   fft8_vfp
         .word   X(ff_fft16_vfp)     @ this one alone is exported
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 93d74b6..8479304 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -89,12 +89,16 @@  FUNC    .func   \name
     .endif
 .endm
 
-.macro  const   name, align=2
+.macro  const   name, align=2, relocate=0
     .macro endconst
 ELF     .size   \name, . - \name
         .purgem endconst
     .endm
+.if HAVE_SECTION_DATA_REL_RO && \relocate
+        .section        .data.rel.ro
+.else
         .section        .rodata
+.endif
         .align          \align
 \name:
 .endm