Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: devel/objfw: add BTCFI landing pads for amd64 and arm64
To:
Theo Buehler <tb@theobuehler.org>
Cc:
ports@openbsd.org, js@nil.im, kettenis@openbsd.org
Date:
Sat, 24 Feb 2024 21:36:48 +0100

Download raw body.

Thread
  • Mark Kettenis:

    devel/objfw: add BTCFI landing pads for amd64 and arm64

  • > Date: Sat, 24 Feb 2024 20:01:06 +0100
    > From: Theo Buehler <tb@theobuehler.org>
    > 
    > This adds missing landing pads for amd64 and arm64. Not sure if for
    > upstream a <cet.h> dance using _CET_ENDBR would be preferable. For the
    > port I kept it simple.
    > 
    > ld: warning: objc_msg_lookup: missing endbr64
    > ld: warning: objc_msg_lookup_stret: missing endbr64
    > ld: warning: objc_msg_lookup_super: missing endbr64
    > ld: warning: objc_msg_lookup_super_stret: missing endbr64
    > ld: warning: OFForward: missing endbr64
    > ld: warning: OFForward_stret: missing endbr64
    
    My knowledge of ObjC is limited, but to me it looks like these are
    right.
    
    ok kettenis@
    
    > Index: Makefile
    > ===================================================================
    > RCS file: /cvs/ports/devel/objfw/Makefile,v
    > diff -u -p -r1.6 Makefile
    > --- Makefile	24 Jan 2024 21:08:06 -0000	1.6
    > +++ Makefile	24 Feb 2024 18:50:12 -0000
    > @@ -1,6 +1,7 @@
    >  COMMENT =	portable, lightweight framework for the Objective-C language
    >  
    >  DISTNAME =	objfw-1.0.8
    > +REVISION =	0
    >  
    >  SHARED_LIBS +=	objfw		0.0
    >  SHARED_LIBS +=	objfwrt		0.0
    > Index: patches/patch-src_forwarding_forwarding-amd64-elf_S
    > ===================================================================
    > RCS file: patches/patch-src_forwarding_forwarding-amd64-elf_S
    > diff -N patches/patch-src_forwarding_forwarding-amd64-elf_S
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-src_forwarding_forwarding-amd64-elf_S	24 Feb 2024 18:53:27 -0000
    > @@ -0,0 +1,19 @@
    > +Index: src/forwarding/forwarding-amd64-elf.S
    > +--- src/forwarding/forwarding-amd64-elf.S.orig
    > ++++ src/forwarding/forwarding-amd64-elf.S
    > +@@ -22,6 +22,7 @@
    > + 
    > + .section .text
    > + OFForward:
    > ++	endbr64
    > + 	pushq	%rbp
    > + 	movq	%rsp, %rbp
    > + 
    > +@@ -107,6 +108,7 @@ OFForward:
    > + .size OFForward, .-OFForward
    > + 
    > + OFForward_stret:
    > ++	endbr64
    > + 	pushq	%rbp
    > + 	movq	%rsp, %rbp
    > + 
    > Index: patches/patch-src_forwarding_forwarding-arm64-elf_S
    > ===================================================================
    > RCS file: patches/patch-src_forwarding_forwarding-arm64-elf_S
    > diff -N patches/patch-src_forwarding_forwarding-arm64-elf_S
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-src_forwarding_forwarding-arm64-elf_S	24 Feb 2024 18:53:27 -0000
    > @@ -0,0 +1,11 @@
    > +Index: src/forwarding/forwarding-arm64-elf.S
    > +--- src/forwarding/forwarding-arm64-elf.S.orig
    > ++++ src/forwarding/forwarding-arm64-elf.S
    > +@@ -23,6 +23,7 @@
    > + .section .text
    > + OFForward:
    > + OFForward_stret:
    > ++	bti	c
    > + 	stp	fp, lr, [sp, #-208]!
    > + 	mov	fp, sp
    > + 	sub	sp, sp, #208
    > Index: patches/patch-src_runtime_lookup-asm_lookup-asm-amd64-elf_S
    > ===================================================================
    > RCS file: patches/patch-src_runtime_lookup-asm_lookup-asm-amd64-elf_S
    > diff -N patches/patch-src_runtime_lookup-asm_lookup-asm-amd64-elf_S
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-src_runtime_lookup-asm_lookup-asm-amd64-elf_S	24 Feb 2024 18:53:27 -0000
    > @@ -0,0 +1,19 @@
    > +Index: src/runtime/lookup-asm/lookup-asm-amd64-elf.S
    > +--- src/runtime/lookup-asm/lookup-asm-amd64-elf.S.orig
    > ++++ src/runtime/lookup-asm/lookup-asm-amd64-elf.S
    > +@@ -25,6 +25,7 @@
    > + .section .text
    > + .macro GENERATE_LOOKUP name notFound
    > + \name:
    > ++	endbr64
    > + 	testq	%rdi, %rdi
    > + 	jz	returnNilMethod
    > + 
    > +@@ -68,6 +69,7 @@
    > + 
    > + .macro GENERATE_LOOKUP_SUPER name lookup
    > + \name:
    > ++	endbr64
    > + 	movq	%rdi, %r8
    > + 	movq	(%rdi), %rdi
    > + 	testq	%rdi, %rdi
    > Index: patches/patch-src_runtime_lookup-asm_lookup-asm-arm64-elf_S
    > ===================================================================
    > RCS file: patches/patch-src_runtime_lookup-asm_lookup-asm-arm64-elf_S
    > diff -N patches/patch-src_runtime_lookup-asm_lookup-asm-arm64-elf_S
    > --- /dev/null	1 Jan 1970 00:00:00 -0000
    > +++ patches/patch-src_runtime_lookup-asm_lookup-asm-arm64-elf_S	24 Feb 2024 18:53:27 -0000
    > @@ -0,0 +1,19 @@
    > +Index: src/runtime/lookup-asm/lookup-asm-arm64-elf.S
    > +--- src/runtime/lookup-asm/lookup-asm-arm64-elf.S.orig
    > ++++ src/runtime/lookup-asm/lookup-asm-arm64-elf.S
    > +@@ -25,6 +25,7 @@
    > + .section .text
    > + .macro GENERATE_LOOKUP name notFound
    > + \name:
    > ++	bti	c
    > + 	cbz	x0, returnNilMethod
    > + 
    > + 	tst	x0, #1
    > +@@ -68,6 +69,7 @@
    > + 
    > + .macro GENERATE_LOOKUP_SUPER name lookup
    > + \name:
    > ++	bti	c
    > + 	mov	x2, x0
    > + 	ldr	x0, [x0]
    > + 	cbz	x0, returnNilMethod
    > 
    
    
    
  • Mark Kettenis:

    devel/objfw: add BTCFI landing pads for amd64 and arm64