[vlc-commits] [Git][videolan/vlc][master] aarch64: advertise assembler BTI support

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sun Feb 6 07:50:52 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
6550059e by Rémi Denis-Courmont at 2022-02-06T07:14:38+00:00
aarch64: advertise assembler BTI support

As per the AArch64 ELF ABI, object files that support BTI need to
advertise it via a dedicated Linux ELF object file property in an ELF
note section. The linker can then check if all input object files
support the feature to advertise it at the shared object or executable
level.

In the case of BTI, this is necessary to enable the guarded page bit
in the memory mapping for BTI-capable .text sections.

This defines a macro to populate the note section and uses it.

- - - - -


3 changed files:

- modules/isa/arm/asm.S
- modules/video_filter/deinterlace/merge_arm64.S
- modules/video_filter/deinterlace/merge_sve.S


Changes:

=====================================
modules/isa/arm/asm.S
=====================================
@@ -39,6 +39,36 @@
 EXTERN_ASM\name:
 .endm
 
+#ifdef __ELF__
+.macro	bti_advertise
+/* See SysV ABI Linux extensions */
+#define NT_GNU_PROPERTY_TYPE_0	5
+
+/* See ARM IHI0056 */
+#define	GNU_PROPERTY_AARCH64_FEATURE_1_AND	0xc0000000
+#define	GNU_PROPERTY_AARCH64_FEATURE_1_BTI	0x00000001
+#define	GNU_PROPERTY_AARCH64_FEATURE_1_PAC	0x00000002
+
+	.pushsection	.note.gnu.property, "a"
+	.align	3
+	.word	2f - 1f
+	.word	4f - 3f
+	.word	NT_GNU_PROPERTY_TYPE_0
+1:	.asciz	"GNU"
+
+2:	.align	3
+3:	.word	GNU_PROPERTY_AARCH64_FEATURE_1_AND	/* type */
+	.word	6f - 5f					/* size */
+5:	.word	GNU_PROPERTY_AARCH64_FEATURE_1_BTI	/* value */
+
+6:	.align	3
+4:	.popsection
+.endm
+#else
+.macro	bti_advertise
+.endm
+#endif
+
 .macro	bti	targets=
 .ifb	\targets
 	hint	#32


=====================================
modules/video_filter/deinterlace/merge_arm64.S
=====================================
@@ -23,6 +23,7 @@
 
 	.arch armv8-a+simd
 	.text
+	bti_advertise
 
 #define	DEST	x0
 #define	SRC1	x1


=====================================
modules/video_filter/deinterlace/merge_sve.S
=====================================
@@ -25,6 +25,7 @@
 	/* TODO: prefetch, unroll */
 
 	.text
+	bti_advertise
 function merge8_arm_sve
 	bti	c
 	mov	x4, #0



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6550059ef2cd9751f39661b1b60b83c27c58696b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/6550059ef2cd9751f39661b1b60b83c27c58696b
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list