commit: f6da81d9f85e2223a469e043dc95fd6fc555409f Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Mon Oct 28 11:36:23 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Oct 28 11:38:18 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f6da81d9
sys-devel/mold: workaround linux-6.11 incompatibility Don't write to existing files, instead replace them. This fixes (or works around) an incompatibility with linux-6.11. Bug: https://github.com/rui314/mold/issues/1361 Bug: https://bugs.gentoo.org/938659 Closes: https://bugs.gentoo.org/941070 Thanks-to: Jinghao Jia <jinghao7 <AT> illinois.edu> Thanks-to: ernsteiswuerfel <erhard_f <AT> mailbox.org> Signed-off-by: Sam James <sam <AT> gentoo.org> sys-devel/mold/files/mold-2.34.1-linux-6.11.patch | 22 ++++++++++++++++++++++ .../{mold-9999.ebuild => mold-2.34.1-r1.ebuild} | 4 ++++ sys-devel/mold/mold-9999.ebuild | 4 ++++ 3 files changed, 30 insertions(+) diff --git a/sys-devel/mold/files/mold-2.34.1-linux-6.11.patch b/sys-devel/mold/files/mold-2.34.1-linux-6.11.patch new file mode 100644 index 000000000000..8540ec0cb246 --- /dev/null +++ b/sys-devel/mold/files/mold-2.34.1-linux-6.11.patch @@ -0,0 +1,22 @@ +https://lore.kernel.org/stable/cackh++yatemyu2ntluyfmxzogo37fqogkmdkbpddmnaz5he...@mail.gmail.com/T/#u +https://github.com/rui314/mold/issues/1361 +https://bugs.gentoo.org/941070 +--- a/src/output-file-unix.cc ++++ b/src/output-file-unix.cc +@@ -19,16 +19,6 @@ template <typename E> + static int + open_or_create_file(Context<E> &ctx, std::string path, std::string tmpfile, + int perm) { +- // Reuse an existing file if exists and writable because on Linux, +- // writing to an existing file is much faster than creating a fresh +- // file and writing to it. +- if (ctx.overwrite_output_file && rename(path.c_str(), tmpfile.c_str()) == 0) { +- i64 fd = ::open(tmpfile.c_str(), O_RDWR | O_CREAT, perm); +- if (fd != -1) +- return fd; +- unlink(tmpfile.c_str()); +- } +- + i64 fd = ::open(tmpfile.c_str(), O_RDWR | O_CREAT, perm); + if (fd == -1) + Fatal(ctx) << "cannot open " << tmpfile << ": " << errno_string(); diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-2.34.1-r1.ebuild similarity index 97% copy from sys-devel/mold/mold-9999.ebuild copy to sys-devel/mold/mold-2.34.1-r1.ebuild index 456f654912e4..e9cd29a7fe47 100644 --- a/sys-devel/mold/mold-9999.ebuild +++ b/sys-devel/mold/mold-2.34.1-r1.ebuild @@ -34,6 +34,10 @@ RDEPEND=" " DEPEND="${RDEPEND}" +PATCHES=( + "${FILESDIR}"/${PN}-2.34.1-linux-6.11.patch +) + pkg_pretend() { # Requires a c++20 compiler, see #831473 if [[ ${MERGE_TYPE} != binary ]]; then diff --git a/sys-devel/mold/mold-9999.ebuild b/sys-devel/mold/mold-9999.ebuild index 456f654912e4..e9cd29a7fe47 100644 --- a/sys-devel/mold/mold-9999.ebuild +++ b/sys-devel/mold/mold-9999.ebuild @@ -34,6 +34,10 @@ RDEPEND=" " DEPEND="${RDEPEND}" +PATCHES=( + "${FILESDIR}"/${PN}-2.34.1-linux-6.11.patch +) + pkg_pretend() { # Requires a c++20 compiler, see #831473 if [[ ${MERGE_TYPE} != binary ]]; then
