[FFmpeg-devel] [PATCH 7/8] lavu/riscv: align functions to 4 bytes

Rémi Denis-Courmont remi at remlab.net
Mon Jul 22 23:13:49 EEST 2024


Currently the start of the byte range for each function is aligned to
4 bytes. But this can lead to situations whence the function is preceded
by a 2-byte C.NOP at the aligned 4-byte boundary. Then the first actual
instruction and the function symbol are only aligned on 2 bytes.

This forcefully disables compression for the alignment and the symbol,
thus ensuring that there is no padding before the function.
---
 libavutil/riscv/asm.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavutil/riscv/asm.S b/libavutil/riscv/asm.S
index 37fd7d3b03..633c93d5fd 100644
--- a/libavutil/riscv/asm.S
+++ b/libavutil/riscv/asm.S
@@ -38,7 +38,6 @@
 
         .macro func sym, ext1=, ext2=
             .text
-            .align 2
 
             .option push
             .ifnb \ext1
@@ -51,7 +50,11 @@
             .global \sym
             .hidden \sym
             .type   \sym, %function
+            .option push
+            .option norvc
+            .align  2
             \sym:
+            .option pop
 
             .macro endfunc
                 .size   \sym, . - \sym
-- 
2.45.2



More information about the ffmpeg-devel mailing list