arm: Create proper .rdata sections for COFF

Message ID 20190111132419.56467-1-martin@martin.st
State New
Headers show
Series
  • arm: Create proper .rdata sections for COFF
Related show

Commit Message

Martin Storsjo Jan. 11, 2019, 1:24 p.m.
As .rodata isn't one of the default created sections for COFF, it was
created as a read-write data section. By using the default .rdata
section name for COFF, it automatically becomes a read-only data section.
The existing ".section .rodata" works as intended for ELF though.

This is based on an original patch and diagnose by Tom Tan
<Tom.Tan@microsoft.com>.
---
 libavutil/aarch64/asm.S | 2 ++
 libavutil/arm/asm.S     | 2 ++
 2 files changed, 4 insertions(+)

Comments

Luca Barbato Jan. 13, 2019, 7:51 a.m. | #1
On 11/01/2019 14:24, Martin Storsjö wrote:
> As .rodata isn't one of the default created sections for COFF, it was
> created as a read-write data section. By using the default .rdata
> section name for COFF, it automatically becomes a read-only data section.
> The existing ".section .rodata" works as intended for ELF though.
> 
> This is based on an original patch and diagnose by Tom Tan
> <Tom.Tan@microsoft.com>.
> ---
>   libavutil/aarch64/asm.S | 2 ++
>   libavutil/arm/asm.S     | 2 ++
>   2 files changed, 4 insertions(+)
> 
> diff --git a/libavutil/aarch64/asm.S b/libavutil/aarch64/asm.S
> index 15b55d57d2..bf5c1b7ee1 100644
> --- a/libavutil/aarch64/asm.S
> +++ b/libavutil/aarch64/asm.S
> @@ -63,6 +63,8 @@ ELF     .size   \name, . - \name
>   .else
>           .section        .rodata
>   .endif
> +#elif defined(_WIN32)
> +        .section        .rdata
>   #elif !defined(__MACH__)
>           .section        .rodata
>   #else
> diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
> index 62ce493180..9842d03bc0 100644
> --- a/libavutil/arm/asm.S
> +++ b/libavutil/arm/asm.S
> @@ -125,6 +125,8 @@ ELF     .size   \name, . - \name
>   .else
>           .section        .rodata
>   .endif
> +#elif defined(_WIN32)
> +        .section        .rdata
>   #elif !defined(__MACH__)
>           .section        .rodata
>   #else
> 

OK.

Patch

diff --git a/libavutil/aarch64/asm.S b/libavutil/aarch64/asm.S
index 15b55d57d2..bf5c1b7ee1 100644
--- a/libavutil/aarch64/asm.S
+++ b/libavutil/aarch64/asm.S
@@ -63,6 +63,8 @@  ELF     .size   \name, . - \name
 .else
         .section        .rodata
 .endif
+#elif defined(_WIN32)
+        .section        .rdata
 #elif !defined(__MACH__)
         .section        .rodata
 #else
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 62ce493180..9842d03bc0 100644
--- a/libavutil/arm/asm.S
+++ b/libavutil/arm/asm.S
@@ -125,6 +125,8 @@  ELF     .size   \name, . - \name
 .else
         .section        .rodata
 .endif
+#elif defined(_WIN32)
+        .section        .rdata
 #elif !defined(__MACH__)
         .section        .rodata
 #else