diff --git a/meta-digi-dey/recipes-devtools/orc/orc-0.4.39/0001-x86-work-around-old-GCC-versions-pre-9.0-having-brok.patch b/meta-digi-dey/recipes-devtools/orc/orc-0.4.39/0001-x86-work-around-old-GCC-versions-pre-9.0-having-brok.patch new file mode 100644 index 000000000..c1ede1531 --- /dev/null +++ b/meta-digi-dey/recipes-devtools/orc/orc-0.4.39/0001-x86-work-around-old-GCC-versions-pre-9.0-having-brok.patch @@ -0,0 +1,62 @@ +From e184d18fd6e4fa18178b30871903cdaa839093fe Mon Sep 17 00:00:00 2001 +From: "L. E. Segovia" +Date: Fri, 19 Jul 2024 11:40:28 -0300 +Subject: [PATCH] x86: work around old GCC versions (pre 9.0) having broken + xgetbv implementations + +See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71659 + +Part-of: +Upstream-Status: Backport +--- + orc/orccpu-x86.c | 25 +++++++++++++++++++++---- + 1 file changed, 21 insertions(+), 4 deletions(-) + +diff --git a/orc/orccpu-x86.c b/orc/orccpu-x86.c +index 742fa1f28d6c..315f04eed287 100644 +--- a/orc/orccpu-x86.c ++++ b/orc/orccpu-x86.c +@@ -34,6 +34,19 @@ + + #ifdef _MSC_VER + # include ++#elif defined(__GNUC__) ++#if __GNUC__ >= 8 && __GNUC__ < 9 ++// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71659 ++# include ++#elif __GNUC__ < 8 ++# define ORC_NEEDS_ASM_XSAVE 1 ++#endif ++#endif ++ ++#if !defined(_MSC_VER) || defined(__clang__) ++#define ORC_TARGET_XSAVE __attribute__((target("xsave"))) ++#else ++#define ORC_TARGET_XSAVE + #endif + + #include +@@ -304,15 +317,19 @@ orc_x86_cpuid_get_branding_string (void) + // Checks if XMM and YMM state are enabled in XCR0. + // See 14.3 DETECTION OF INTEL® AVX INSTRUCTIONS on the + // Intel® 64 and IA-32 Architectures Software Developer’s Manual +-#if !defined(_MSC_VER) || defined(__clang__) +-#define ORC_TARGET_XSAVE __attribute__((target("xsave"))) ++#ifdef ORC_NEEDS_ASM_XSAVE ++static orc_bool check_xcr0_ymm() ++{ ++ uint32_t xcr0; ++ __asm__ ("xgetbv" : "=a" (xcr0) : "c" (0) : "%edx" ); ++ return ((xcr0 & 6U) == 6U); ++} + #else +-#define ORC_TARGET_XSAVE +-#endif + static orc_bool ORC_TARGET_XSAVE check_xcr0_ymm() + { + return (_xgetbv(0) & 6U) != 0U; + } ++#endif + + static void + orc_x86_cpuid_handle_standard_flags (void) diff --git a/meta-digi-dey/recipes-devtools/orc/orc_0.4.39.bbappend b/meta-digi-dey/recipes-devtools/orc/orc_0.4.39.bbappend new file mode 100644 index 000000000..02741d972 --- /dev/null +++ b/meta-digi-dey/recipes-devtools/orc/orc_0.4.39.bbappend @@ -0,0 +1,5 @@ +# Copyright (C) 2024, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BP}:" + +SRC_URI:append:class-native = " file://0001-x86-work-around-old-GCC-versions-pre-9.0-having-brok.patch"