Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: sys-devel/gcc/, sys-devel/gcc/files/
Date: Sun, 05 Dec 2021 13:47:38
Message-Id: 1638711664.921da9f661e80c8ef3c07b51b4fb6acee38f62aa.grobian@gentoo
1 commit: 921da9f661e80c8ef3c07b51b4fb6acee38f62aa
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Sun Dec 5 13:41:04 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Sun Dec 5 13:41:04 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=921da9f6
7
8 sys-devel/gcc-11.2.0: add patch for Solaris
9
10 Package-Manager: Portage-3.0.21-prefix, Repoman-3.0.3
11 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
12
13 .../gcc/files/gcc-11-illumnos-o_directory.patch | 65 ++++++++++++++++++++++
14 sys-devel/gcc/gcc-11.2.0.ebuild | 2 +
15 2 files changed, 67 insertions(+)
16
17 diff --git a/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch
18 new file mode 100644
19 index 0000000000..fd212e5f47
20 --- /dev/null
21 +++ b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch
22 @@ -0,0 +1,65 @@
23 +fix build on non Solaris 11 (including derivatives)
24 +
25 +Solaris 11 got post-release O_DIRECTORY added, so derivatives like
26 +Illumnos-based don't have this yet. Nor does Solaris 10.
27 +Use posix_madvise instead of madvise, because the latter isn't declared
28 +on Solaris.
29 +
30 +--- a/c++tools/resolver.cc
31 ++++ b/c++tools/resolver.cc
32 +@@ -58,6 +58,10 @@
33 + #define O_CLOEXEC 0
34 + #endif
35 +
36 ++#ifndef O_DIRECTORY
37 ++# define O_DIRECTORY 0
38 ++#endif
39 ++
40 + #ifndef DIR_SEPARATOR
41 + #define DIR_SEPARATOR '/'
42 + #endif
43 +--- a/libcody/resolver.cc
44 ++++ b/libcody/resolver.cc
45 +@@ -22,6 +22,10 @@
46 + #define HAVE_FSTATAT 0
47 + #endif
48 +
49 ++#ifndef O_DIRECTORY
50 ++# define O_DIRECTORY 0
51 ++#endif
52 ++
53 + // Resolver code
54 +
55 + #if __windows__
56 +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cpp
57 ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cpp
58 +@@ -900,6 +900,9 @@
59 + #endif // !SANITIZER_SOLARIS
60 +
61 + #if !SANITIZER_NETBSD
62 ++#ifndef O_DIRECTORY
63 ++# define O_DIRECTORY 0
64 ++#endif
65 + // ThreadLister implementation.
66 + ThreadLister::ThreadLister(pid_t pid) : pid_(pid), buffer_(4096) {
67 + char task_directory_path[80];
68 +--- a/gcc/cp/module.cc
69 ++++ b/gcc/cp/module.cc
70 +@@ -1631,7 +1631,7 @@
71 + set_error (errno);
72 + else
73 + {
74 +- if (madvise (mapping, hdr.pos, MADV_RANDOM))
75 ++ if (posix_madvise (mapping, hdr.pos, MADV_RANDOM))
76 + goto fail;
77 +
78 + /* These buffers are never NULL in this case. */
79 +@@ -1742,7 +1742,7 @@
80 + }
81 + /* We'll be hopping over this randomly. Some systems declare the
82 + first parm as char *, and other declare it as void *. */
83 +- if (madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM))
84 ++ if (posix_madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM))
85 + goto fail;
86 +
87 + hdr.buffer = (char *)mapping;
88
89 diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild
90 index 05c511d65c..7a6f5581fe 100644
91 --- a/sys-devel/gcc/gcc-11.2.0.ebuild
92 +++ b/sys-devel/gcc/gcc-11.2.0.ebuild
93 @@ -61,6 +61,8 @@ src_prepare() {
94 eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch
95 # allow building with macOS 12
96 eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch
97 + # allow building on Solaris derivatives
98 + eapply "${FILESDIR}"/${PN}-11-illumnos-o_directory.patch
99 }
100
101 src_configure() {