arm: Mark .rodata section as read only in COFF object file

Message ID 20190110205927.31556-1-martin@martin.st
State Superseded
Headers show
Series
  • arm: Mark .rodata section as read only in COFF object file
Related show

Commit Message

Martin Storsjö Jan. 10, 2019, 8:59 p.m.
From: Tom Tan <Tom.Tan@microsoft.com>

.rodata directive from GAS assembly produces .rodata as read/write for COFF
object file by default (object file format for Windows), but read only for
ELF. This change marks it as read only explicitly for COFF.

Signed-off-by: Martin Storsjö <martin@martin.st>
---
 libavutil/aarch64/asm.S | 2 ++
 libavutil/arm/asm.S     | 2 ++
 2 files changed, 4 insertions(+)

Patch

diff --git a/libavutil/aarch64/asm.S b/libavutil/aarch64/asm.S
index 15b55d57d2..65341d58cd 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        .rodata, "r"
 #elif !defined(__MACH__)
         .section        .rodata
 #else
diff --git a/libavutil/arm/asm.S b/libavutil/arm/asm.S
index 62ce493180..06c3413489 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        .rodata, "r"
 #elif !defined(__MACH__)
         .section        .rodata
 #else