mingw-w64: Check for __builtin_ia32_rdtsc
PATCH 1/1 mingw-w64: Check for __builtin_ia32_rdtsc
Signed-off-by Khem Raj <[email protected]>
--- ...rincs-Check-for-__builtin_ia32_rdtsc.patch | 33 +++++++++++++++++++ .../nativesdk-mingw-w64-runtime_7.0.0.bb | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 recipes-devtools/mingw-w64/files/0001-intrincs-Check-for-__builtin_ia32_rdtsc.patch
recipes-devtools/mingw-w64/files/0001-intrincs-Check-for-__builtin_ia32_rdtsc.patch new file +33 -0
@@ -0,0 +1,33 @@ +From 346de7591f58015d111f4d4f3b001382c04d5557 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 13 Apr 2021 18:44:25 -0700 +Subject: [PATCH] intrincs: Check for __builtin_ia32_rdtsc + +on modern gcc ( >=4.6 ) __rdtsc function is implemented using +special builtin function called __builtin_ia32_rdtsc, its actually +a define in gcc, so __has_builtin check fails for __rdtsc even +though it is defined to imply __builtin_ia32_rdtsc(), therefore +check for existence of __builtin_ia32_rdtsc as well + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + mingw-w64-crt/intrincs/rdtsc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mingw-w64-crt/intrincs/rdtsc.c b/mingw-w64-crt/intrincs/rdtsc.c +index bf9c03b..df04711 100644 +--- a/mingw-w64-crt/intrincs/rdtsc.c ++++ b/mingw-w64-crt/intrincs/rdtsc.c +@@ -11,7 +11,7 @@ + #define __has_builtin(x) 0 + #endif + +-#if !__has_builtin(__rdtsc) ++#if !__has_builtin(__rdtsc) && !__has_builtin(__builtin_ia32_rdtsc) + unsigned __int64 __rdtsc(void) + { + #ifdef _WIN64 +-- +2.31.1 +
recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_7.0.0.bb +2 -0
@@ -2,6 +2,8 @@ DESCRIPTION = "Runtime libraries from MinGW-w64 project" require mingw-w64.inc +SRC_URI += "file://0001-intrincs-Check-for-__builtin_ia32_rdtsc.patch;striplevel=2" + S = "${WORKDIR}/mingw-w64-v${PV}/mingw-w64-crt" B = "${WORKDIR}/build-${TARGET_SYS}"
Signature · 1 line
2.31.1
ping^1
Quoted 63 lines · Khem Raj
Signed-off-by Khem Raj <[email protected]>--- ...rincs-Check-for-__builtin_ia32_rdtsc.patch | 33 +++++++++++++++++++ .../nativesdk-mingw-w64-runtime_7.0.0.bb | 2 ++ 2 files changed, 35 insertions(+) create mode 100644 recipes-devtools/mingw-w64/files/0001-intrincs-Check-for-__builtin_ia32_rdtsc.patchrecipes-devtools/mingw-w64/files/0001-intrincs-Check-for-__builtin_ia32_rdtsc.patch new file +33
-0@@ -0,0 +1,33 @@ +From 346de7591f58015d111f4d4f3b001382c04d5557 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Tue, 13 Apr 2021 18:44:25 -0700 +Subject: [PATCH] intrincs: Check for __builtin_ia32_rdtsc + +on modern gcc ( >=4.6 ) __rdtsc function is implemented using +special builtin function called __builtin_ia32_rdtsc, its actually +a define in gcc, so __has_builtin check fails for __rdtsc even +though it is defined to imply __builtin_ia32_rdtsc(), therefore +check for existence of __builtin_ia32_rdtsc as well + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + mingw-w64-crt/intrincs/rdtsc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mingw-w64-crt/intrincs/rdtsc.c b/mingw-w64-crt/intrincs/rdtsc.c +index bf9c03b..df04711 100644 +--- a/mingw-w64-crt/intrincs/rdtsc.c ++++ b/mingw-w64-crt/intrincs/rdtsc.c +@@ -11,7 +11,7 @@ + #define __has_builtin(x) 0 + #endif + +-#if !__has_builtin(__rdtsc) ++#if !__has_builtin(__rdtsc) && !__has_builtin(__builtin_ia32_rdtsc) + unsigned __int64 __rdtsc(void) + { + #ifdef _WIN64 +-- +2.31.1 +recipes-devtools/mingw-w64/nativesdk-mingw-w64-runtime_7.0.0.bb +2
-1@@ -2,6 +2,8 @@ DESCRIPTION = "Runtime libraries from MinGW-w64 project" require mingw-w64.inc +SRC_URI += "file://0001-intrincs-Check-for-__builtin_ia32_rdtsc.patch;striplevel=2" + S = "${WORKDIR}/mingw-w64-v${PV}/mingw-w64-crt" B = "${WORKDIR}/build-${TARGET_SYS}" --2.31.1