git: 46898c7c8ef2 - main - Mk/Features/lto.mk: Add checks for powerpc64 and riscv64

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Fri, 30 Sep 2022 10:12:32 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=46898c7c8ef27efe58374f3079417d2391dcf339

commit 46898c7c8ef27efe58374f3079417d2391dcf339
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2022-09-30 10:03:17 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2022-09-30 10:12:18 +0000

    Mk/Features/lto.mk: Add checks for powerpc64 and riscv64
    
    Add checks for powerpc64 and riscv64 since they won't work with LTO.
    
    This is a bit crude on powerpc64 but can be improved upon later.
    LTO does work on this platform using GCC but will fail using lld.
    
    This commit also introduces LTO_DISABLE_CHECK which can be used to
    override.
    
    Reviewed by:    pkubaj (private email)
---
 Mk/Features/lto.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Mk/Features/lto.mk b/Mk/Features/lto.mk
index 75935b52ca89..0a5056e8c12f 100644
--- a/Mk/Features/lto.mk
+++ b/Mk/Features/lto.mk
@@ -7,8 +7,10 @@
 _LTO_MK_INCLUDED=	yes
 LTO_Include_MAINTAINER=	pkubaj@FreeBSD.org
 
-.  if !defined(LTO_UNSAFE)
-.    if defined(_INCLUDE_USES_CARGO_MK)
+.  if !defined(LTO_UNSAFE) || defined(LTO_DISABLE_CHECK)
+.    if "${ARCH}" == "powerpc64" || "${ARCH}" == "riscv64" && !defined(LTO_DISABLE_CHECK)
+       IGNORE=	LTO is currently broken on ${ARCH}, to override set LTO_DISABLE_CHECK=yes
+.    elif defined(_INCLUDE_USES_CARGO_MK)
    CARGO_ENV+=	CARGO_PROFILE_RELEASE_LTO="true" \
 		CARGO_PROFILE_RELEASE_PANIC="abort" \
 		CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1