From nobody Mon Feb 19 16:45:31 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TdpLh4QMhz5C9Nr; Mon, 19 Feb 2024 16:45:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TdpLh0ZwTz4c9v; Mon, 19 Feb 2024 16:45:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9WIASPYbXjP9rFUdM8rwOxtQvYhGIBCXfDLXqYIF31A=; b=F2IFfICMWwl/u1t0L199AGI6F7jHWb9L5kCz7Q+qdwI23km0UAc5Wm+GZX36T0JuUnp2ed uHBw1iYzEQPczUwLapNdN8Uue8LcOChPSXNCpqmaiMGLfZ+6CsWa33tgX05ggPPNRwK2J1 Y+SeDbfK//L3bb7Le00BPxcSNox1HChfnHmkedrUTN+zAg/I9GxWTl2vfWhOhUvrZj3Sxs p+L2dYeNdJdj760PRiayFx4QoTMRlpsu81Oxk9q9q13Co6QkRwWK7KKV2YKjBIsiafyykE 03Au61B8feghxuiltqjrhf+hC3QFLlv4uyXfzFSIUq4Gz2yr4GGvexcghNS/kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708361132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9WIASPYbXjP9rFUdM8rwOxtQvYhGIBCXfDLXqYIF31A=; b=dZ49QKDg73Oz4iV6P7PuJQz7BX1kJXUkryFzLuDBBAmsS9Rxv9nJIW47mWdzI2GOh1gR8n LGBJZ48OuXVgDqHD59i3lzdc6gsdsrTzhjseehEobigPvbdp1JiBDbkWFQZ4Ghg4Pbyl3b Cl0P2q7YmOpDBtliiWxc5SYlHw9zRK3FddHexOm4pMNWQPCzir95c8rjTnNAF07Phqu2KH xwdQsiei1qVpFERnBAhtGgWz7lSeXTKrwAnhn9uBS/t7qh1Tq2W5VjvTprHXjYJUWjl76c m88m3Ssc8KvweEZDtT/O0PcprRNAUSxd8hlj8VR8KerB/8xR1jyBaqan6782PA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708361132; a=rsa-sha256; cv=none; b=DgA6KDDb/Zb/S+Icb4jZb2+YMncIaVtQg8+k0sYp0gma7PINNAOtcUupVmbpUKljcUeK5n SOXAmCXAjLkqtUygeMlDOwrHaQ5y86JM4BiCYCSDp2lxC0GToYpyhN4n/1qJ33+S+Qz2N4 d6AgPWJrDaYIH+LkK8s3Nt3klSHFC//9Pjz9q08+6XDr54pYUjs28Lf2jZcu5EbmrUc0Sj Iv/NWNhzPXwap0C6t5ZsF32qCtbAkK1y7XommXlCO2yGaMfRprCyQQwEOqbqoSqs6yiCjI JxVGL1GWWZ4l1xVyrKyPAttYh8mEeXmGhv9tBF56wzXJOO8YyWHAbISbkxlGvg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TdpLg6nrqzjDS; Mon, 19 Feb 2024 16:45:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 41JGjVR3096633; Mon, 19 Feb 2024 16:45:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41JGjV9F096630; Mon, 19 Feb 2024 16:45:31 GMT (envelope-from git) Date: Mon, 19 Feb 2024 16:45:31 GMT Message-Id: <202402191645.41JGjV9F096630@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: bce8a0ba1506 - stable/14 - libc: Teach libc about the BTI elf note List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: bce8a0ba15063186774aeb8207587884e68c38dd Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=bce8a0ba15063186774aeb8207587884e68c38dd commit bce8a0ba15063186774aeb8207587884e68c38dd Author: Andrew Turner AuthorDate: 2023-10-12 14:22:18 +0000 Commit: Andrew Turner CommitDate: 2024-02-19 13:17:37 +0000 libc: Teach libc about the BTI elf note Add the Branch Target Identification (BTI) note to libc assembly sources. As all obect files need the note for the library to have it we need to insert it in all asm files. Reviewed by: emaste, markj Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42228 (cherry picked from commit fd5aaf2ea0178b03aa93c35245053247e5d3840c) --- lib/libc/aarch64/gen/_ctx_start.S | 4 ++++ lib/libc/aarch64/gen/_setjmp.S | 3 +++ lib/libc/aarch64/gen/fabs.S | 4 ++++ lib/libc/aarch64/gen/setjmp.S | 3 +++ lib/libc/aarch64/gen/sigsetjmp.S | 3 +++ lib/libc/aarch64/string/memmove.S | 4 ++++ lib/libc/aarch64/sys/cerror.S | 4 ++++ lib/libc/aarch64/sys/syscall.S | 3 +++ lib/libc/aarch64/sys/vfork.S | 3 +++ lib/libc/sys/Makefile.inc | 7 +++++++ 10 files changed, 38 insertions(+) diff --git a/lib/libc/aarch64/gen/_ctx_start.S b/lib/libc/aarch64/gen/_ctx_start.S index 15edcf21d463..a4049e6c241a 100644 --- a/lib/libc/aarch64/gen/_ctx_start.S +++ b/lib/libc/aarch64/gen/_ctx_start.S @@ -27,9 +27,13 @@ */ #include +#include + ENTRY(_ctx_start) blr x19 /* Call func from makecontext */ mov x0, x20 /* Load ucp saved in makecontext */ bl _C_LABEL(ctx_done) bl _C_LABEL(abort) END(_ctx_start) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/gen/_setjmp.S b/lib/libc/aarch64/gen/_setjmp.S index 4fc9ce304893..037eccf1a48a 100644 --- a/lib/libc/aarch64/gen/_setjmp.S +++ b/lib/libc/aarch64/gen/_setjmp.S @@ -30,6 +30,7 @@ #include #include +#include ENTRY(_setjmp) /* Store the magic value and stack pointer */ @@ -101,3 +102,5 @@ botch: bl _C_LABEL(abort) #endif END(_longjmp) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/gen/fabs.S b/lib/libc/aarch64/gen/fabs.S index 29e4b89d5ee1..91967a10299b 100644 --- a/lib/libc/aarch64/gen/fabs.S +++ b/lib/libc/aarch64/gen/fabs.S @@ -24,7 +24,11 @@ */ #include +#include + ENTRY(fabs) fabs d0, d0 ret END(fabs) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/gen/setjmp.S b/lib/libc/aarch64/gen/setjmp.S index ecc677de2620..97d98ae2fb52 100644 --- a/lib/libc/aarch64/gen/setjmp.S +++ b/lib/libc/aarch64/gen/setjmp.S @@ -30,6 +30,7 @@ #include #include +#include ENTRY(setjmp) sub sp, sp, #16 @@ -119,3 +120,5 @@ botch: bl _C_LABEL(longjmperror) bl _C_LABEL(abort) END(longjmp) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/gen/sigsetjmp.S b/lib/libc/aarch64/gen/sigsetjmp.S index cdff7a46c85b..daf3914b6278 100644 --- a/lib/libc/aarch64/gen/sigsetjmp.S +++ b/lib/libc/aarch64/gen/sigsetjmp.S @@ -28,6 +28,7 @@ #include #include +#include ENTRY(sigsetjmp) cmp x1, #0 @@ -52,3 +53,5 @@ ENTRY(siglongjmp) .Lmagic: .quad _JB_MAGIC__SETJMP END(siglongjmp) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/string/memmove.S b/lib/libc/aarch64/string/memmove.S index e2f99790e0da..6ca014b3a565 100644 --- a/lib/libc/aarch64/string/memmove.S +++ b/lib/libc/aarch64/string/memmove.S @@ -3,3 +3,7 @@ * as it stops MISRCS from picking up the C implementation and rtld expects * to copy the memmove object file into its object directory. */ + +#include +#include +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/sys/cerror.S b/lib/libc/aarch64/sys/cerror.S index a83514bc2511..85e75af8ec0d 100644 --- a/lib/libc/aarch64/sys/cerror.S +++ b/lib/libc/aarch64/sys/cerror.S @@ -25,6 +25,8 @@ */ #include +#include + ENTRY(cerror) .hidden cerror sub sp, sp, #16 @@ -37,3 +39,5 @@ ENTRY(cerror) add sp, sp, #16 ret END(cerror) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/sys/syscall.S b/lib/libc/aarch64/sys/syscall.S index 2c7e207f82f7..037c4b12ddae 100644 --- a/lib/libc/aarch64/sys/syscall.S +++ b/lib/libc/aarch64/sys/syscall.S @@ -27,6 +27,9 @@ */ #include +#include #include "SYS.h" RSYSCALL(syscall) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/aarch64/sys/vfork.S b/lib/libc/aarch64/sys/vfork.S index f9489738a3c7..03ae5a6325ba 100644 --- a/lib/libc/aarch64/sys/vfork.S +++ b/lib/libc/aarch64/sys/vfork.S @@ -25,6 +25,7 @@ */ #include +#include #include "SYS.h" ENTRY(__sys_vfork) @@ -38,3 +39,5 @@ ENTRY(__sys_vfork) mov lr, x2 ret END(__sys_vfork) + +GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL) diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index 8cb5f54e2969..4e3ac43b2b80 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -131,12 +131,18 @@ NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n' .else NOTE_GNU_STACK='' .endif +.if ${MACHINE_CPUARCH} == "aarch64" +FEATURE_NOTE='\#include \nGNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)' +.else +FEATURE_NOTE='' +.endif ${SASM}: printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET} printf '#include "compat.h"\n' >> ${.TARGET} printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET} printf ${NOTE_GNU_STACK} >>${.TARGET} + printf ${FEATURE_NOTE} >> ${.TARGET} ${SPSEUDO}: printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET} @@ -144,6 +150,7 @@ ${SPSEUDO}: printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \ >> ${.TARGET} printf ${NOTE_GNU_STACK} >>${.TARGET} + printf ${FEATURE_NOTE} >> ${.TARGET} MAN+= abort2.2 \ accept.2 \