summaryrefslogtreecommitdiff
path: root/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S')
-rw-r--r--graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S137
1 files changed, 0 insertions, 137 deletions
diff --git a/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S b/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S
deleted file mode 100644
index bee9f51..0000000
--- a/graphics/ffmpeg/patches/patch-libavutil_aarch64_asm_S
+++ /dev/null
@@ -1,137 +0,0 @@
1Index: libavutil/aarch64/asm.S
2--- libavutil/aarch64/asm.S.orig
3+++ libavutil/aarch64/asm.S
4@@ -36,6 +36,125 @@
5 # define __has_feature(x) 0
6 #endif
7
8+
9+/* Support macros for
10+ * - Armv8.3-A Pointer Authentication and
11+ * - Armv8.5-A Branch Target Identification
12+ * features which require emitting a .note.gnu.property section with the
13+ * appropriate architecture-dependent feature bits set.
14+ *
15+ * |AARCH64_SIGN_LINK_REGISTER| and |AARCH64_VALIDATE_LINK_REGISTER| expand to
16+ * PACIxSP and AUTIxSP, respectively. |AARCH64_SIGN_LINK_REGISTER| should be
17+ * used immediately before saving the LR register (x30) to the stack.
18+ * |AARCH64_VALIDATE_LINK_REGISTER| should be used immediately after restoring
19+ * it. Note |AARCH64_SIGN_LINK_REGISTER|'s modifications to LR must be undone
20+ * with |AARCH64_VALIDATE_LINK_REGISTER| before RET. The SP register must also
21+ * have the same value at the two points. For example:
22+ *
23+ * .global f
24+ * f:
25+ * AARCH64_SIGN_LINK_REGISTER
26+ * stp x29, x30, [sp, #-96]!
27+ * mov x29, sp
28+ * ...
29+ * ldp x29, x30, [sp], #96
30+ * AARCH64_VALIDATE_LINK_REGISTER
31+ * ret
32+ *
33+ * |AARCH64_VALID_CALL_TARGET| expands to BTI 'c'. Either it, or
34+ * |AARCH64_SIGN_LINK_REGISTER|, must be used at every point that may be an
35+ * indirect call target. In particular, all symbols exported from a file must
36+ * begin with one of these macros. For example, a leaf function that does not
37+ * save LR can instead use |AARCH64_VALID_CALL_TARGET|:
38+ *
39+ * .globl return_zero
40+ * return_zero:
41+ * AARCH64_VALID_CALL_TARGET
42+ * mov x0, #0
43+ * ret
44+ *
45+ * A non-leaf function which does not immediately save LR may need both macros
46+ * because |AARCH64_SIGN_LINK_REGISTER| appears late. For example, the function
47+ * may jump to an alternate implementation before setting up the stack:
48+ *
49+ * .globl with_early_jump
50+ * with_early_jump:
51+ * AARCH64_VALID_CALL_TARGET
52+ * cmp x0, #128
53+ * b.lt .Lwith_early_jump_128
54+ * AARCH64_SIGN_LINK_REGISTER
55+ * stp x29, x30, [sp, #-96]!
56+ * mov x29, sp
57+ * ...
58+ * ldp x29, x30, [sp], #96
59+ * AARCH64_VALIDATE_LINK_REGISTER
60+ * ret
61+ *
62+ * .Lwith_early_jump_128:
63+ * ...
64+ * ret
65+ *
66+ * These annotations are only required with indirect calls. Private symbols that
67+ * are only the target of direct calls do not require annotations. Also note
68+ * that |AARCH64_VALID_CALL_TARGET| is only valid for indirect calls (BLR), not
69+ * indirect jumps (BR). Indirect jumps in assembly are supported through
70+ * |AARCH64_VALID_JUMP_TARGET|. Landing Pads which shall serve for jumps and
71+ * calls can be created using |AARCH64_VALID_JUMP_CALL_TARGET|.
72+ *
73+ * Although not necessary, it is safe to use these macros in 32-bit ARM
74+ * assembly. This may be used to simplify dual 32-bit and 64-bit files.
75+ *
76+ * References:
77+ * - "ELF for the ArmĀ® 64-bit Architecture"
78+ * https: *github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst
79+ * - "Providing protection for complex software"
80+ * https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software
81+ */
82+#if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1)
83+# define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has BTI
84+# define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c'
85+# define AARCH64_VALID_JUMP_TARGET hint #38 // BTI 'j'
86+#else
87+# define GNU_PROPERTY_AARCH64_BTI 0 // No BTI
88+# define AARCH64_VALID_CALL_TARGET
89+# define AARCH64_VALID_JUMP_TARGET
90+#endif
91+
92+#if defined(__ARM_FEATURE_PAC_DEFAULT)
93+# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 0)) != 0) // authentication using key A
94+# define AARCH64_SIGN_LINK_REGISTER paciasp
95+# define AARCH64_VALIDATE_LINK_REGISTER autiasp
96+# elif ((__ARM_FEATURE_PAC_DEFAULT & (1 << 1)) != 0) // authentication using key B
97+# define AARCH64_SIGN_LINK_REGISTER pacibsp
98+# define AARCH64_VALIDATE_LINK_REGISTER autibsp
99+# else
100+# error Pointer authentication defines no valid key!
101+# endif
102+# if ((__ARM_FEATURE_PAC_DEFAULT & (1 << 2)) != 0)
103+# error Authentication of leaf functions is enabled but not supported in FFmpeg!
104+# endif
105+# define GNU_PROPERTY_AARCH64_PAC (1 << 1)
106+#else
107+# define GNU_PROPERTY_AARCH64_PAC 0
108+# define AARCH64_SIGN_LINK_REGISTER
109+# define AARCH64_VALIDATE_LINK_REGISTER
110+#endif
111+
112+
113+#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0)
114+ .pushsection .note.gnu.property, "a"
115+ .balign 8
116+ .long 4
117+ .long 0x10
118+ .long 0x5
119+ .asciz "GNU"
120+ .long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */
121+ .long 4
122+ .long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC)
123+ .long 0
124+ .popsection
125+#endif
126+
127 .macro function name, export=0, align=2
128 .macro endfunc
129 ELF .size \name, . - \name
130@@ -49,6 +168,7 @@ FUNC .endfunc
131 ELF .type EXTERN_ASM\name, %function
132 FUNC .func EXTERN_ASM\name
133 EXTERN_ASM\name:
134+ AARCH64_VALID_CALL_TARGET
135 .else
136 ELF .type \name, %function
137 FUNC .func \name