summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc
diff options
context:
space:
mode:
authorJiaying Song <jiaying.song.cn@windriver.com>2025-04-09 10:51:10 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-04-10 11:05:35 +0100
commitab7af060548b8de259dd0d9ff61819514b5e237a (patch)
treebc2a560a329f84f76de8e8af3f65844d923db7e3 /meta/recipes-devtools/gcc
parent36889582e406bd0d8fcafeafa8c78fb1cf5eda8e (diff)
downloadpoky-ab7af060548b8de259dd0d9ff61819514b5e237a.tar.gz
gcc: Undef _TIME_BITS in sanitizer_procmaps_solaris.cpp
gcc-sanitizers fail to build when both -D_TIME_BITS=64 and -D_FILE_OFFSET_BITS=64 are defined. This is because sanitizer_procmaps_solaris.cpp explicitly undefines _FILE_OFFSET_BITS before including any headers, which causes _TIME_BITS=64 to violate the requirement in glibc: /usr/include/features-time64.h:26:5: error: "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" Fixes a build failure on 32-bit Linux platforms when using both -D_TIME_BITS=64 and -D_FILE_OFFSET_BITS=64. (From OE-Core rev: 902085def653ca5194b28a4065043c73e54c9204) Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gcc')
-rw-r--r--meta/recipes-devtools/gcc/gcc-14.2.inc1
-rw-r--r--meta/recipes-devtools/gcc/gcc/0028-libsanitizer-undef-_TIME_BITS-in-solaris-procmaps.patch62
2 files changed, 63 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-14.2.inc b/meta/recipes-devtools/gcc/gcc-14.2.inc
index 3d65bed92a..ae2f8c0638 100644
--- a/meta/recipes-devtools/gcc/gcc-14.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-14.2.inc
@@ -71,6 +71,7 @@ SRC_URI = "${BASEURI} \
71 file://0026-gcc-Fix-c-tweak-for-Wrange-loop-construct.patch \ 71 file://0026-gcc-Fix-c-tweak-for-Wrange-loop-construct.patch \
72 file://0027-gcc-backport-patch-to-fix-data-relocation-to-ENDBR-s.patch \ 72 file://0027-gcc-backport-patch-to-fix-data-relocation-to-ENDBR-s.patch \
73 file://gcc.git-ab884fffe3fc82a710bea66ad651720d71c938b8.patch \ 73 file://gcc.git-ab884fffe3fc82a710bea66ad651720d71c938b8.patch \
74 file://0028-libsanitizer-undef-_TIME_BITS-in-solaris-procmaps.patch \
74" 75"
75 76
76S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}" 77S = "${TMPDIR}/work-shared/gcc-${PV}-${PR}/${SOURCEDIR}"
diff --git a/meta/recipes-devtools/gcc/gcc/0028-libsanitizer-undef-_TIME_BITS-in-solaris-procmaps.patch b/meta/recipes-devtools/gcc/gcc/0028-libsanitizer-undef-_TIME_BITS-in-solaris-procmaps.patch
new file mode 100644
index 0000000000..9426f5d221
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc/0028-libsanitizer-undef-_TIME_BITS-in-solaris-procmaps.patch
@@ -0,0 +1,62 @@
1From 883d5549dc959b736e3cb61b989272a9e6a42565 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
3Date: Thu, 3 Apr 2025 17:09:22 +0800
4Subject: [PATCH] libsanitizer: also undef _TIME_BITS in sanitizer_procmaps_solaris.cpp
5
6Upstream commit
7https://github.com/llvm/llvm-project/commit/26800a2c7e7996dc773b4e990dd5cca41c45e1a9
8of LLVM added a #undef _TIME_BITS in
9libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp to
10fix the build on 32-bit Linux platforms that have enabled 64-bit
11time_t using _TIME_BITS=64.
12
13Indeed, _TIME_BITS=64 can only be used when _FILE_OFFSET_BITS=64, but
14sanitizer_platform_limits_posix.cpp undefines _FILE_OFFSET_BITS before
15including any header file. To fix this, the upstream fix was to also
16undef _TIME_BITS.
17
18This commit simply does the same in sanitizer_procmaps_solaris.cpp,
19which also gets compiled under Linux (despite what the file name
20says). In practice on Linux hosts (where _TIME_BITS=64 matters),
21sanitizer_procmaps_solaris.cpp will expand to nothing, as pretty much
22the rest of the file is inside a #ifdef SANITIZER_SOLARIS...#endif. So
23the #undef _FILE_OFFSET_BITS and #undef _TIME_BITS are only here
24before including sanitizer_platform.h, which will set the
25SANITIZER_LINUX/SANITIZER_SOLARIS define depending on the platform.
26
27Fixes
28
29```
30/usr/include/features-time64.h:26:5: error: "_TIME_BITS=64 is allowed
31 only with _FILE_OFFSET_BITS=64"
32| # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
33| ^
34| 1 error generated.
35```
36Upstream-Status: Backport [https://github.com/gcc-mirror/gcc/commit/fa321004f3f6288d3ee2eefa6b02177131882dca]
37
38Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
39---
40 libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp | 5 +++++
41 1 file changed, 5 insertions(+)
42
43diff --git a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
44index eeb49e2af..f78558bed 100644
45--- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
46+++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
47@@ -10,7 +10,12 @@
48 //===----------------------------------------------------------------------===//
49
50 // Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
51+
52 #undef _FILE_OFFSET_BITS
53+
54+// Avoid conflict between `_TIME_BITS` defined vs. `_FILE_OFFSET_BITS`
55+// undefined in some Linux configurations.
56+#undef _TIME_BITS
57 #include "sanitizer_platform.h"
58 #if SANITIZER_SOLARIS
59 # include <fcntl.h>
60--
612.34.1
62