ObjFW  Check-in [d73a388eca]

Overview
Comment:Add bti instructions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.0
Files: files | file ages | folders
SHA3-256: d73a388ecaf73b2ada092fde758e0daaa2fe922ce1a09cda1ab3f9f12c255d56
User & Date: js on 2024-02-24 21:08:39
Other Links: branch diff | manifest | tags
Context
2024-02-24
21:12
Update ChangeLog for 1.0.10 check-in: 8fa5cb1a44 user: js tags: 1.0
21:08
Add bti instructions check-in: d73a388eca user: js tags: 1.0
21:07
Add bti instructions check-in: 5c0891c85d user: js tags: trunk
20:57
Add endbr32 / endbr64 check-in: 262baf76e7 user: js tags: 1.0
Changes

Modified configure.ac from [ab9ba27d1a] to [9ec5346e70].

839
840
841
842
843
844
845













846
847
848
849
850
851
852
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865







+
+
+
+
+
+
+
+
+
+
+
+
+







		])
	], [
		AC_DEFINE(HAVE_VFP2, 1, [Whether we have VFP2 or above])
		AC_MSG_RESULT(yes)
	], [
		AC_MSG_RESULT(no)
	])
	;;
aarch64* | arm64*)
	AC_MSG_CHECKING(for bti)
	AC_COMPILE_IFELSE([
		AC_LANG_PROGRAM([], [
			__asm__ __volatile__ ("bti jc");
		])
	], [
		AC_DEFINE(HAVE_BTI, 1, [Whether we have bti])
		AC_MSG_RESULT(yes)
	], [
		AC_MSG_RESULT(no)
	])
	;;
i?86)
	AC_MSG_CHECKING(for endbr32)
	AC_COMPILE_IFELSE([
		AC_LANG_PROGRAM([], [
			__asm__ __volatile__ ("endbr32");
		])

Modified src/forwarding/apple-forwarding-arm64.S from [662163e821] to [ff5af9e7d0].

29
30
31
32
33
34
35




36
37
38
39
40
41
42
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46







+
+
+
+







.section __DATA, __objc_imageinfo, regular, no_dead_strip
	.long 0, 0

.section __TEXT, __text, regular, pure_instructions
.align 2
_OFForward:
_OFForward_stret:
#ifdef HAVE_BTI
	bti	jc
#endif

	stp	fp, lr, [sp, #-208]!
	mov	fp, sp
	sub	sp, sp, #208

	/* Save all arguments, x8 and x19 */
	stp	x0, x1, [sp]
	stp	x2, x3, [sp, #16]

Modified src/forwarding/forwarding-arm64-elf.S from [7210e45d15] to [d964627f1b].

19
20
21
22
23
24
25




26
27
28
29
30
31
32
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







+
+
+
+








.globl OFForward
.globl OFForward_stret

.section .text
OFForward:
OFForward_stret:
#ifdef HAVE_BTI
	bti	jc
#endif

	stp	fp, lr, [sp, #-208]!
	mov	fp, sp
	sub	sp, sp, #208

	/* Save all arguments, x8 and x19 */
	stp	x0, x1, [sp]
	stp	x2, x3, [sp, #16]
99
100
101
102
103
104
105




106
107
108
109
110
111
112
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120







+
+
+
+







	b	OFMethodNotFound
.type OFForward, %function
.size OFForward, .-OFForward
.type OFForward_stret, %function
.size OFForward_stret, .-OFForward_stret

init:
#ifdef HAVE_BTI
	bti	c
#endif

	adrp	x0, module
	add	x0, x0, :lo12:module
	b	__objc_exec_class

.section .init_array, "aw", %init_array
	.xword init

Modified src/runtime/lookup-asm/lookup-asm-arm64-elf.S from [972266461b] to [bed2f1a908].

21
22
23
24
25
26
27




28
29
30
31
32
33
34
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38







+
+
+
+







.globl objc_msg_lookup_stret
.globl objc_msg_lookup_super
.globl objc_msg_lookup_super_stret

.section .text
.macro GENERATE_LOOKUP name notFound
\name:
#ifdef HAVE_BTI
	bti	jc
#endif

	cbz	x0, returnNilMethod

	tst	x0, #1
	b.ne	.LtaggedPointer_\name

	ldr	x2, [x0]
	ldr	x2, [x2, #64]
64
65
66
67
68
69
70




71
72
73
74
75
76
77
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85







+
+
+
+







	b	.Lmain_\name
.type \name, %function
.size \name, .-\name
.endm

.macro GENERATE_LOOKUP_SUPER name lookup
\name:
#ifdef HAVE_BTI
	bti	jc
#endif

	mov	x2, x0
	ldr	x0, [x0]
	cbz	x0, returnNilMethod

	ldr	x2, [x2, #8]
	ldr	x2, [x2, #64]