commit: 921da9f661e80c8ef3c07b51b4fb6acee38f62aa Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Sun Dec 5 13:41:04 2021 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Sun Dec 5 13:41:04 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=921da9f6
sys-devel/gcc-11.2.0: add patch for Solaris Package-Manager: Portage-3.0.21-prefix, Repoman-3.0.3 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> .../gcc/files/gcc-11-illumnos-o_directory.patch | 65 ++++++++++++++++++++++ sys-devel/gcc/gcc-11.2.0.ebuild | 2 + 2 files changed, 67 insertions(+) diff --git a/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch new file mode 100644 index 0000000000..fd212e5f47 --- /dev/null +++ b/sys-devel/gcc/files/gcc-11-illumnos-o_directory.patch @@ -0,0 +1,65 @@ +fix build on non Solaris 11 (including derivatives) + +Solaris 11 got post-release O_DIRECTORY added, so derivatives like +Illumnos-based don't have this yet. Nor does Solaris 10. +Use posix_madvise instead of madvise, because the latter isn't declared +on Solaris. + +--- a/c++tools/resolver.cc ++++ b/c++tools/resolver.cc +@@ -58,6 +58,10 @@ + #define O_CLOEXEC 0 + #endif + ++#ifndef O_DIRECTORY ++# define O_DIRECTORY 0 ++#endif ++ + #ifndef DIR_SEPARATOR + #define DIR_SEPARATOR '/' + #endif +--- a/libcody/resolver.cc ++++ b/libcody/resolver.cc +@@ -22,6 +22,10 @@ + #define HAVE_FSTATAT 0 + #endif + ++#ifndef O_DIRECTORY ++# define O_DIRECTORY 0 ++#endif ++ + // Resolver code + + #if __windows__ +--- a/libsanitizer/sanitizer_common/sanitizer_linux.cpp ++++ b/libsanitizer/sanitizer_common/sanitizer_linux.cpp +@@ -900,6 +900,9 @@ + #endif // !SANITIZER_SOLARIS + + #if !SANITIZER_NETBSD ++#ifndef O_DIRECTORY ++# define O_DIRECTORY 0 ++#endif + // ThreadLister implementation. + ThreadLister::ThreadLister(pid_t pid) : pid_(pid), buffer_(4096) { + char task_directory_path[80]; +--- a/gcc/cp/module.cc ++++ b/gcc/cp/module.cc +@@ -1631,7 +1631,7 @@ + set_error (errno); + else + { +- if (madvise (mapping, hdr.pos, MADV_RANDOM)) ++ if (posix_madvise (mapping, hdr.pos, MADV_RANDOM)) + goto fail; + + /* These buffers are never NULL in this case. */ +@@ -1742,7 +1742,7 @@ + } + /* We'll be hopping over this randomly. Some systems declare the + first parm as char *, and other declare it as void *. */ +- if (madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM)) ++ if (posix_madvise (reinterpret_cast <char *> (mapping), size, MADV_RANDOM)) + goto fail; + + hdr.buffer = (char *)mapping; diff --git a/sys-devel/gcc/gcc-11.2.0.ebuild b/sys-devel/gcc/gcc-11.2.0.ebuild index 05c511d65c..7a6f5581fe 100644 --- a/sys-devel/gcc/gcc-11.2.0.ebuild +++ b/sys-devel/gcc/gcc-11.2.0.ebuild @@ -61,6 +61,8 @@ src_prepare() { eapply -p1 "${FILESDIR}"/${PN}-10.2.0-xcode-12.5.patch # allow building with macOS 12 eapply -p1 "${FILESDIR}"/${PN}-10.3.0-monterey.patch + # allow building on Solaris derivatives + eapply "${FILESDIR}"/${PN}-11-illumnos-o_directory.patch } src_configure() {