armv8a: Set -mbranch-protection more specifically
PATCH 1/1 armv8a: Set -mbranch-protection more specifically
GCC-15 enable gcs in standard branch protection, which is support by armv9. Openssl don't support this feature in assemble code, caused ld warning. Moeover, other recipes will fail when link with openssl.
This patch set armv8a branch protection based on extension version.
--- meta/conf/machine/include/arm/arch-arm64.inc | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)
meta/conf/machine/include/arm/arch-arm64.inc +20 -1
@@ -41,4 +41,23 @@ TARGET_FPU = "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', '${TARGET_FPU_64} # Emit branch protection (PAC/BTI) instructions. On hardware that doesn't # support these they're meaningless NOP instructions, so there's very little # reason not to. -TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', ' -mbranch-protection=standard', '', d)}" +def arm64_get_branch_protection(d): + import re + bp = "standard" + tunes = d.getVar('AVAILTUNES') + if "armv8a" in tunes.split(): + bp = "none" + subver = 0 + for tune in tunes.split(): + arch = re.match('armv8-[1-9]a', tune) + if arch: + subver = int(tune[6:7]) + break + + if subver >= 5: + bp = "bti+pac-ret" + elif subver >= 3: + bp = "pac-ret" + return bp + +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'aarch64', ' -mbranch-protection=%s' % (arm64_get_branch_protection(d)), '', d)}"
Quoted 5 lines · Frank Zhang via lists.openembedded.org
GCC-15 enable gcs in standard branch protection, which is support by armv9. Openssl don't support this feature in assemble code, caused ld warning. Moeover, other recipes will fail when link with openssl.
This patch set armv8a branch protection based on extension version.
What other recipes? We’ve already fixed this in systemd (oe-core 295e30) so I’m curious what else breaks, as it’s nothing on the AB.
I don’t think we should be quite so particular about breaking down the ISA version, if we do this then I think simply gating it on v8 vs v9 is going to be just as effective with a lot less logic.
Ross
As I know karchive kfilemetadata and kpipewire will fail. They are in meta-kf6 and meta-kde.
Do I need update patch, just set v8 branch-protection to BTI & PAC?
Quoted 5 lines · Frank Zhang via lists.openembedded.org
As I know karchive kfilemetadata and kpipewire will fail. They are in meta-kf6 and meta-kde.
Do I need update patch, just set v8 branch-protection to BTI & PAC?
Please use the systemd patch-like approach for these recipes.
Quoted 12 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#226285):
https://lists.openembedded.org/g/openembedded-core/message/226285
Mute This Topic: https://lists.openembedded.org/mt/116271008/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 5 lines · Khem Raj via lists.openembedded.org
On Thu, Nov 13, 2025 at 7:19 PM Frank Zhang via lists.openembedded.org <[email protected]> wrote:
As I know karchive kfilemetadata and kpipewire will fail. They are in meta-kf6 and meta-kde.
Do I need update patch, just set v8 branch-protection to BTI & PAC?Please use the systemd patch-like approach for these recipes.
Agreed.
Ross