[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2024-06-23 Thread Sam James
commit: 2dfe689924334f967b31ba58961a5b2e08c97841
Author: Sam James  gentoo  org>
AuthorDate: Mon Jun 24 00:21:31 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Jun 24 00:21:31 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2dfe6899

sys-devel/mold: drop 2.4.0, 2.4.1

Signed-off-by: Sam James  gentoo.org>

 sys-devel/mold/Manifest  |   2 -
 sys-devel/mold/files/mold-2.3.0-no-pch.patch |  12 
 sys-devel/mold/mold-2.4.0.ebuild | 102 ---
 sys-devel/mold/mold-2.4.1.ebuild |  98 -
 4 files changed, 214 deletions(-)

diff --git a/sys-devel/mold/Manifest b/sys-devel/mold/Manifest
index aeabc142aef5..1c44c6c6396f 100644
--- a/sys-devel/mold/Manifest
+++ b/sys-devel/mold/Manifest
@@ -1,5 +1,3 @@
 DIST mold-2.1.0.tar.gz 9278811 BLAKE2B 
b31e13f92177553adf5069cf35c8c75c7bc28f0af4d1726cdc0c6abc1c9d3baaa5be512c3a8fb9bc3c3110096a79e1c6751c701171769595a2234fc1fa8c441a
 SHA512 
f1c98d349b35b4042109d71f7db6eb8d7d089dc3241735bbd7b5402d513dcc85ca17904828779e5fc8234650fa9fb97f47c3a2f3e89cc2fb3cb9e9110439e5a2
 DIST mold-2.30.0.tar.gz 9957539 BLAKE2B 
f45924598029dabfb2c02298e1f89aae848cd64e2e87dd80f500de323517db92e62df798feee8a2cd81cb930eff0640c2b9957808a4080f0027884015994ce64
 SHA512 
7cfba4f0fb332799ad267d3eafb8e2f0057af4484467b3e3fbaf8044220163a2c7e26cd1786510f250844c8b57e30c15167c8dd9688af1773abc580c5605abf3
 DIST mold-2.31.0.tar.gz 10031469 BLAKE2B 
338f516efcb430c8393fb0d6861b913fa1dd0095226e3d13018255da4f0b4affa168928b1e5cfbd0b5a4efcf840612675f04579f0c1d3c0e2b3c6815d6bef4c0
 SHA512 
343c62d8c67b74988f762c46999d2d866b2e9a0c69d2b910b12384ea5abc620b30468cd1b1bacfe41474d1c97c8ce2e49d55ca70479691238fb73d83d9adc683
-DIST mold-2.4.0.tar.gz 9974233 BLAKE2B 
0710d9ce0407b64b05a23e04db142d603b38d41cd9e5e322b650680ee2bd8684f57647e9a0b5efc23b2106eb1e38e38143be7d4b357b2d32e4fe0b6a99e41cca
 SHA512 
e332d027f783dfb0a4f48b1fb7daf98e11e830f8de82b971b58ee8a7bae59eaa30b8155e7491b6057f0ce8e0b09ddd0ab1d364f01ea15517e1d089fdb292a4e5
-DIST mold-2.4.1.tar.gz 9957259 BLAKE2B 
17aab84c0793dc305d53a3c2f372ddc92395b6941ffe372af55cf94f4dd65ea8d63d4e85dcdb3e76622811e5f95577d6f10612102c373835d6f75f2a3d0bcfed
 SHA512 
d61ee4306ecaa6ba5b4ce120636e70db081bb824a482bb3014429e13294134bc2560b1a9b477c47378f1062107f1c32dba2810e41be199cd6882cd1146971245

diff --git a/sys-devel/mold/files/mold-2.3.0-no-pch.patch 
b/sys-devel/mold/files/mold-2.3.0-no-pch.patch
deleted file mode 100644
index e61b5df01f54..
--- a/sys-devel/mold/files/mold-2.3.0-no-pch.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-We generally disable PCH in Gentoo because of how buggy it is.
 a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -400,7 +400,7 @@ endif()
- 
- # Add frequently included header files for pre-compiling.
- # target_precompile_headers is supported by CMake 3.16.0 or newer.
--if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
-+if(FALSE)
-   if(MOLD_IS_SOLD)
- target_precompile_headers(mold PRIVATE
-   "$<$:${CMAKE_SOURCE_DIR}/elf/mold.h>"

diff --git a/sys-devel/mold/mold-2.4.0.ebuild b/sys-devel/mold/mold-2.4.0.ebuild
deleted file mode 100644
index 3e0ec4a8..
--- a/sys-devel/mold/mold-2.4.0.ebuild
+++ /dev/null
@@ -1,102 +0,0 @@
-# Copyright 2021-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit cmake toolchain-funcs
-
-DESCRIPTION="A Modern Linker"
-HOMEPAGE="https://github.com/rui314/mold;
-if [[ ${PV} ==  ]] ; then
-   EGIT_REPO_URI="https://github.com/rui314/mold.git;
-   inherit git-r3
-else
-   SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
-   KEYWORDS="amd64 ~arm ~arm64 ~loong ~riscv ~sparc ~x86"
-fi
-
-# mold (MIT)
-#  - xxhash (BSD-2)
-LICENSE="MIT BSD-2"
-SLOT="0"
-
-RDEPEND="
-   app-arch/zstd:=
-   >=dev-cpp/tbb-2021.7.0-r1:=
-   dev-libs/blake3:=
-   sys-libs/zlib
-   !kernel_Darwin? (
-   >=dev-libs/mimalloc-2:=
-   )
-"
-DEPEND="${RDEPEND}"
-
-PATCHES=(
-   "${FILESDIR}"/${PN}-2.3.0-no-pch.patch
-)
-
-pkg_pretend() {
-   # Requires a c++20 compiler, see #831473
-   if [[ ${MERGE_TYPE} != binary ]]; then
-   if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
-   die "${PN} needs at least gcc 10"
-   elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
-   die "${PN} needs at least clang 12"
-   fi
-   fi
-}
-
-src_prepare() {
-   cmake_src_prepare
-
-   # Needs unpackaged dwarfdump
-   rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh 
|| die
-
-   # Heavy tests, need qemu
-   rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
-   rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
-
-   # Sandbox sadness
-   rm test/elf/run.sh || die
-   sed -i 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2024-04-30 Thread Sam James
commit: 907cb4aa2d36c14e559e2b7a81f1281c8810264f
Author: Sam James  gentoo  org>
AuthorDate: Tue Apr 30 07:02:15 2024 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Apr 30 07:02:15 2024 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=907cb4aa

sys-devel/mold: fix tests w/ gcc 14

Test-only change.

Bug: https://github.com/rui314/mold/issues/1244
Signed-off-by: Sam James  gentoo.org>

 sys-devel/mold/files/mold-2.30.0-gcc14.patch  | 76 +++
 sys-devel/mold/files/mold-2.30.0-which-hunt.patch | 31 +
 sys-devel/mold/mold-2.30.0.ebuild |  5 ++
 3 files changed, 112 insertions(+)

diff --git a/sys-devel/mold/files/mold-2.30.0-gcc14.patch 
b/sys-devel/mold/files/mold-2.30.0-gcc14.patch
new file mode 100644
index ..74e7f5081eeb
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.30.0-gcc14.patch
@@ -0,0 +1,76 @@
+https://github.com/rui314/mold/issues/1244
+https://github.com/rui314/mold/commit/002d619b11f38438514f4714f9eb89e8015ba1b6
+https://github.com/rui314/mold/commit/14952546a489c23236f50adc5ef9c8ada4f4e31a
+
+From 002d619b11f38438514f4714f9eb89e8015ba1b6 Mon Sep 17 00:00:00 2001
+From: Rui Ueyama 
+Date: Thu, 25 Apr 2024 16:58:09 +0900
+Subject: [PATCH] Attempt to fix a test failure
+
+I believe some version of objcopy corrupts an object file when
+renaming a section. In this change, I use sed instead of objcopy
+as a workaround.
+
+Fixes https://github.com/rui314/mold/issues/1244
+---
+ test/elf/exception-multiple-ehframe.sh | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh 
b/test/elf/exception-multiple-ehframe.sh
+index ca1d1a1c0..a9b360b09 100755
+--- a/test/elf/exception-multiple-ehframe.sh
 b/test/elf/exception-multiple-ehframe.sh
+@@ -28,9 +28,9 @@ int bar() {
+ }
+ EOF
+ 
+-$OBJCOPY --rename-section .eh_frame=.eh_frame2 $t/a.o
++sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
+ ./mold -r -o $t/c.o $t/a.o $t/b.o
+-$OBJCOPY --rename-section .eh_frame2=.eh_frame $t/c.o
++sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
+ 
+ cat <
+@@ -44,5 +44,4 @@ int main() {
+ EOF
+ 
+ $CXX -B. -o $t/exe1 $t/d.o $t/c.o
+-$QEMU $t/exe1
+ $QEMU $t/exe1 | grep -q '^1 3$'
+
+From 14952546a489c23236f50adc5ef9c8ada4f4e31a Mon Sep 17 00:00:00 2001
+From: Rui Ueyama 
+Date: Sun, 28 Apr 2024 13:04:43 +0900
+Subject: [PATCH] Do not edit binary files with sed
+
+Fixes https://github.com/rui314/mold/issues/1244
+---
+ test/elf/exception-multiple-ehframe.sh | 6 --
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh 
b/test/elf/exception-multiple-ehframe.sh
+index a9b360b09..8cc31624a 100755
+--- a/test/elf/exception-multiple-ehframe.sh
 b/test/elf/exception-multiple-ehframe.sh
+@@ -3,6 +3,8 @@
+ 
+ nm mold | grep -q '__tsan_init' && skip
+ 
++which perl > /dev/null || skip
++
+ [ $MACHINE = m68k ] && skip
+ [ $MACHINE = sh4 ] && skip
+ 
+@@ -28,9 +30,9 @@ int bar() {
+ }
+ EOF
+ 
+-sed -i 's/\.eh_frame/.EH_FRAME/g' $t/a.o
++perl -i -0777 -pe 's/\.eh_frame/.EH_FRAME/g' $t/a.o
+ ./mold -r -o $t/c.o $t/a.o $t/b.o
+-sed -i 's/\.EH_FRAME/.eh_frame/g' $t/c.o
++perl -i -0777 -pe 's/\.EH_FRAME/.eh_frame/g' $t/c.o
+ 
+ cat <

diff --git a/sys-devel/mold/files/mold-2.30.0-which-hunt.patch 
b/sys-devel/mold/files/mold-2.30.0-which-hunt.patch
new file mode 100644
index ..d8558091c4bc
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.30.0-which-hunt.patch
@@ -0,0 +1,31 @@
+https://github.com/rui314/mold/pull/1246
+
+From ec0a9d09ddff8b1796ff1822d5381442cd28acb1 Mon Sep 17 00:00:00 2001
+From: Sam James 
+Date: Tue, 30 Apr 2024 07:54:40 +0100
+Subject: [PATCH] test: use `command -v`, not non-portable `which`
+
+`which` isn't in POSIX and several Linux distributions are trying to
+remove it from their base system, see e.g. https://lwn.net/Articles/874049/.
+
+Just use `command -v` which is POSIX.
+
+Signed-off-by: Sam James 
+---
+ test/elf/exception-multiple-ehframe.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/elf/exception-multiple-ehframe.sh 
b/test/elf/exception-multiple-ehframe.sh
+index 8cc31624a..1b9f434a4 100755
+--- a/test/elf/exception-multiple-ehframe.sh
 b/test/elf/exception-multiple-ehframe.sh
+@@ -3,7 +3,7 @@
+ 
+ nm mold | grep -q '__tsan_init' && skip
+ 
+-which perl > /dev/null || skip
++command -v perl > /dev/null || skip
+ 
+ [ $MACHINE = m68k ] && skip
+ [ $MACHINE = sh4 ] && skip
+

diff --git a/sys-devel/mold/mold-2.30.0.ebuild 
b/sys-devel/mold/mold-2.30.0.ebuild
index a121f5ffefba..cce55d1650c9 100644
--- a/sys-devel/mold/mold-2.30.0.ebuild
+++ b/sys-devel/mold/mold-2.30.0.ebuild
@@ -31,6 +31,11 @@ RDEPEND="
 "
 DEPEND="${RDEPEND}"
 
+PATCHES=(
+   "${FILESDIR}"/${P}-gcc14.patch
+   "${FILESDIR}"/${PN}-2.30.0-which-hunt.patch
+)
+
 pkg_pretend() {
# Requires a c++20 compiler, see #831473
if [[ ${MERGE_TYPE} != binary ]]; then



[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2023-11-12 Thread Sam James
commit: 2fc10cbc98bebe136012849b28f6969327d6613b
Author: Sam James  gentoo  org>
AuthorDate: Mon Nov 13 02:10:14 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Nov 13 02:10:14 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fc10cbc

sys-devel/mold: backport symbol interposition fix (e.g. mimalloc/musl segfault)

Closes: https://bugs.gentoo.org/917089
Signed-off-by: Sam James  gentoo.org>

 ...d-2.3.2-mimalloc-visibility-interposition.patch | 495 +
 sys-devel/mold/mold-2.3.2-r1.ebuild|  96 
 2 files changed, 591 insertions(+)

diff --git 
a/sys-devel/mold/files/mold-2.3.2-mimalloc-visibility-interposition.patch 
b/sys-devel/mold/files/mold-2.3.2-mimalloc-visibility-interposition.patch
new file mode 100644
index ..e569bfaf3013
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.3.2-mimalloc-visibility-interposition.patch
@@ -0,0 +1,495 @@
+https://bugs.gentoo.org/917089
+https://github.com/microsoft/mimalloc/issues/360
+https://github.com/rui314/mold/issues/1071
+https://github.com/rui314/mold/commit/da3f5dd4ecf4faaba466ba41c7c30ba4f8f73bfd
+
+From da3f5dd4ecf4faaba466ba41c7c30ba4f8f73bfd Mon Sep 17 00:00:00 2001
+From: Rui Ueyama 
+Date: Sat, 11 Nov 2023 17:59:54 +0900
+Subject: [PATCH] Fix --dynamic-list for DSOs
+
+--dynamic-list, --export-dynamic-symbol and --export-dynamic-symbol-list
+have different semantics for executables and DSOs. If the output is an
+executable, they specify a list of symbols that are to be exported.
+If the output is a shared object, they specify the list of symbols that
+are to be interposable.
+
+mold havne't implemented the latter semantics. This commit fixes that
+issue.
+
+Fixes https://github.com/rui314/mold/issues/1071
+---
+ elf/cmdline.cc  |  25 +++-
+ elf/linker-script.cc|  35 ++-
+ elf/main.cc |  16 -
+ elf/mold.h  |  17 +++--
+ elf/output-chunks.cc|   8 ++-
+ elf/passes.cc   | 122 +---
+ test/elf/dynamic-list4.sh   |  44 +
+ test/elf/version-script6.sh |   4 +-
+ 8 files changed, 194 insertions(+), 77 deletions(-)
+ create mode 100755 test/elf/dynamic-list4.sh
+
+diff --git a/elf/cmdline.cc b/elf/cmdline.cc
+index 6bc13a300..6c06b4b14 100644
+--- a/elf/cmdline.cc
 b/elf/cmdline.cc
+@@ -1104,21 +1104,21 @@ std::vector 
parse_nonpositional_args(Context ) {
+ } else if (read_flag("no-keep-memory")) {
+ } else if (read_arg("max-cache-size")) {
+ } else if (read_arg("version-script")) {
+-  // --version-script, --dynamic-list and --export-dynamic-symbol[-list]
+-  // are treated as positional arguments even though they are actually not
+-  // positional. This is because linker scripts (a positional argument)
+-  // can also specify a version script, and it's better to consolidate
+-  // parsing in read_input_files. In particular, version scripts can
+-  // modify ctx.default_version which we initialize *after* parsing
+-  // non-positional args, so the parsing cannot be done right here.
++  // --version-script is treated as positional arguments even though
++  // they are actually not positional. This is because linker scripts
++  // (a positional argument) can also specify a version script, and
++  // it's better to consolidate parsing in read_input_files. In
++  // particular, version scripts can modify ctx.default_version which
++  // we initialize *after* parsing non-positional args, so the parsing
++  // cannot be done right here.
+   remaining.push_back("--version-script=" + std::string(arg));
+ } else if (read_arg("dynamic-list")) {
+   ctx.arg.Bsymbolic = true;
+-  remaining.push_back("--dynamic-list=" + std::string(arg));
++  append(ctx.dynamic_list_patterns, parse_dynamic_list(ctx, arg));
+ } else if (read_arg("export-dynamic-symbol")) {
+-  remaining.push_back("--export-dynamic-symbol=" + std::string(arg));
++  ctx.dynamic_list_patterns.push_back({arg, ""});
+ } else if (read_arg("export-dynamic-symbol-list")) {
+-  remaining.push_back("--export-dynamic-symbol-list=" + std::string(arg));
++  append(ctx.dynamic_list_patterns, parse_dynamic_list(ctx, arg));
+ } else if (read_flag("as-needed")) {
+   remaining.push_back("--as-needed");
+ } else if (read_flag("no-as-needed")) {
+@@ -1228,11 +1228,6 @@ std::vector 
parse_nonpositional_args(Context ) {
+   if (char *env = getenv("MOLD_REPRO"); env && env[0])
+ ctx.arg.repro = true;
+ 
+-  if (ctx.arg.shared || ctx.arg.export_dynamic)
+-ctx.default_version = VER_NDX_GLOBAL;
+-  else
+-ctx.default_version = VER_NDX_LOCAL;
+-
+   if (ctx.arg.default_symver) {
+ std::string ver = ctx.arg.soname.empty() ?
+   filepath(ctx.arg.output).filename().string() : 
std::string(ctx.arg.soname);
+diff --git a/elf/linker-script.cc b/elf/linker-script.cc
+index 

[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2023-07-28 Thread Sam James
commit: 11f5aee9517614ad79d5bf9aae5d9e7a165ac6ab
Author: Sam James  gentoo  org>
AuthorDate: Sat Jul 29 04:28:38 2023 +
Commit: Sam James  gentoo  org>
CommitDate: Sat Jul 29 04:28:38 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=11f5aee9

sys-devel/mold: backport musl test fix

Signed-off-by: Sam James  gentoo.org>

 .../mold/files/mold-2.0.0-reloc-test-fix.patch | 58 ++
 sys-devel/mold/mold-2.0.0-r1.ebuild| 93 ++
 2 files changed, 151 insertions(+)

diff --git a/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch 
b/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch
new file mode 100644
index ..8e6e04f5d535
--- /dev/null
+++ b/sys-devel/mold/files/mold-2.0.0-reloc-test-fix.patch
@@ -0,0 +1,58 @@
+https://github.com/rui314/mold/issues/1067
+https://github.com/rui314/mold/commit/1582b720d58df61bc4c0ae39fa269e3b250b94df
+
+From 1582b720d58df61bc4c0ae39fa269e3b250b94df Mon Sep 17 00:00:00 2001
+From: Rui Ueyama 
+Date: Fri, 28 Jul 2023 14:58:57 +0900
+Subject: [PATCH] Weak undefs should not keep DSOs alive
+
+Fixes https://github.com/rui314/mold/issues/1067
+--- a/elf/input-files.cc
 b/elf/input-files.cc
+@@ -1396,7 +1396,8 @@ SharedFile::mark_live_objects(Context ,
+ if (sym.is_traced)
+   print_trace_symbol(ctx, *this, esym, sym);
+ 
+-if (esym.is_undef() && sym.file && !sym.file->is_alive.test_and_set()) {
++if (esym.is_undef() && !esym.is_weak() && sym.file &&
++!sym.file->is_alive.test_and_set()) {
+   feeder(sym.file);
+ 
+   if (sym.is_traced)
+--- /dev/null
 b/test/elf/as-needed-dso2.sh
+@@ -0,0 +1,33 @@
++#!/bin/bash
++. $(dirname $0)/common.inc
++
++cat < $t/log
++! grep libfoo.so $t/log || false
++grep -q libbar.so $t/log
+

diff --git a/sys-devel/mold/mold-2.0.0-r1.ebuild 
b/sys-devel/mold/mold-2.0.0-r1.ebuild
new file mode 100644
index ..6d863f669627
--- /dev/null
+++ b/sys-devel/mold/mold-2.0.0-r1.ebuild
@@ -0,0 +1,93 @@
+# Copyright 2021-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake toolchain-funcs
+
+DESCRIPTION="A Modern Linker"
+HOMEPAGE="https://github.com/rui314/mold;
+if [[ ${PV} ==  ]] ; then
+   EGIT_REPO_URI="https://github.com/rui314/mold.git;
+   inherit git-r3
+else
+   SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
+   KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+fi
+
+# mold (MIT)
+#  - xxhash (BSD-2)
+LICENSE="MIT BSD-2"
+SLOT="0"
+
+RDEPEND="
+   app-arch/zstd:=
+   >=dev-cpp/tbb-2021.7.0-r1:=
+   sys-libs/zlib
+   !kernel_Darwin? (
+   >=dev-libs/mimalloc-2:=
+   dev-libs/openssl:=
+   )
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+   "${FILESDIR}"/${P}-reloc-test-fix.patch
+)
+
+pkg_pretend() {
+   # Requires a c++20 compiler, see #831473
+   if [[ ${MERGE_TYPE} != binary ]]; then
+   if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+   die "${PN} needs at least gcc 10"
+   elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+   die "${PN} needs at least clang 12"
+   fi
+   fi
+}
+
+src_prepare() {
+   cmake_src_prepare
+
+   # Needs unpackaged dwarfdump
+   rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh 
|| die
+
+   # Heavy tests, need qemu
+   rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
+   rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
+
+   # Sandbox sadness
+   rm test/elf/run.sh || die
+   sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
+   test/elf/mold-wrapper{,2}.sh || die
+
+   # static-pie tests require glibc built with static-pie support
+   if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
+   rm test/elf/{,ifunc-}static-pie.sh || die
+   fi
+}
+
+src_configure() {
+   local mycmakeargs=(
+   -DMOLD_ENABLE_QEMU_TESTS=OFF
+   -DMOLD_LTO=OFF # Should be up to the user to decide this with 
CXXFLAGS.
+   -DMOLD_USE_SYSTEM_MIMALLOC=ON
+   -DMOLD_USE_SYSTEM_TBB=ON
+   )
+   cmake_src_configure
+}
+
+src_install() {
+   dobin "${BUILD_DIR}"/${PN}
+
+   # https://bugs.gentoo.org/872773
+   insinto /usr/$(get_libdir)/mold
+   doins "${BUILD_DIR}"/${PN}-wrapper.so
+
+   dodoc docs/{design,execstack}.md
+   doman docs/${PN}.1
+
+   dosym ${PN} /usr/bin/ld.${PN}
+   dosym ${PN} /usr/bin/ld64.${PN}
+   dosym ../../../usr/bin/${PN} /usr/libexec/${PN}/ld
+}



[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2022-07-28 Thread Sam James
commit: b53e78583cc4390f7660936543b7417af040e141
Author: Han Gao  gmail  com>
AuthorDate: Thu Jul 28 09:32:30 2022 +
Commit: Sam James  gentoo  org>
CommitDate: Thu Jul 28 10:13:19 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b53e7858

sys-devel/mold: fix riscv R_RISCV_SET32 in EhFrameSection

Bug: https://bugs.gentoo.org/861488
Signed-off-by: Han Gao  gmail.com>
Signed-off-by: Sam James  gentoo.org>

 .../mold/files/mold-1.3.1-fix-riscv-set32.patch| 25 ++
 sys-devel/mold/mold-1.3.1-r1.ebuild| 99 ++
 2 files changed, 124 insertions(+)

diff --git a/sys-devel/mold/files/mold-1.3.1-fix-riscv-set32.patch 
b/sys-devel/mold/files/mold-1.3.1-fix-riscv-set32.patch
new file mode 100644
index ..5613d8ddc003
--- /dev/null
+++ b/sys-devel/mold/files/mold-1.3.1-fix-riscv-set32.patch
@@ -0,0 +1,25 @@
+From https://github.com/rui314/mold/pull/590
+From 68bd00caa7c7946f380f72a5dd263e7c1d436e9f Mon Sep 17 00:00:00 2001
+From: Alex Fan 
+Date: Thu, 28 Jul 2022 14:04:21 +1000
+Subject: [PATCH] [ELF][RISCV] add missing R_RISCV_SET32 in EhFrameSection
+
+Signed-off-by: Alex Fan 
+---
+ elf/arch-riscv64.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/elf/arch-riscv64.cc b/elf/arch-riscv64.cc
+index 8761c6ac..0c589118 100644
+--- a/elf/arch-riscv64.cc
 b/elf/arch-riscv64.cc
+@@ -183,6 +183,9 @@ void EhFrameSection::apply_reloc(Context , const 
ElfRel ,
+   case R_RISCV_SET16:
+ *(ul16 *)loc = val;
+ return;
++  case R_RISCV_SET32:
++*(ul32 *)loc = val;
++return;
+   case R_RISCV_32_PCREL:
+ *(ul32 *)loc = val - this->shdr.sh_addr - offset;
+ return;

diff --git a/sys-devel/mold/mold-1.3.1-r1.ebuild 
b/sys-devel/mold/mold-1.3.1-r1.ebuild
new file mode 100644
index ..b4a955bb2dea
--- /dev/null
+++ b/sys-devel/mold/mold-1.3.1-r1.ebuild
@@ -0,0 +1,99 @@
+# Copyright 2021-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="A Modern Linker"
+HOMEPAGE="https://github.com/rui314/mold;
+if [[ ${PV} ==  ]] ; then
+   EGIT_REPO_URI="https://github.com/rui314/mold.git;
+   inherit git-r3
+else
+   SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
+   KEYWORDS="~amd64 ~riscv"
+fi
+
+LICENSE="AGPL-3"
+SLOT="0"
+
+RDEPEND=">=dev-cpp/tbb-2021.4.0:=
+   sys-libs/zlib
+   !kernel_Darwin? (
+   >=dev-libs/mimalloc-2:=
+   dev-libs/openssl:=
+   )"
+# As of 1.1, xxhash is now a header-only dep, but it's now bundled :(
+# TODO: restore SYSTEM_XXHASH upstream?
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+   # Bug #841575
+   "${FILESDIR}"/${PN}-1.2.1-install-nopython.patch
+   "${FILESDIR}"/${PN}-1.3.0-openssl-pkgconfig.patch
+   # Bug #861488
+   "${FILESDIR}"/${PN}-1.3.1-fix-riscv-set32.patch
+)
+
+pkg_pretend() {
+   # Requires a c++20 compiler, see #831473
+   if [[ ${MERGE_TYPE} != binary ]]; then
+   if tc-is-gcc && [[ $(gcc-major-version) -lt 10 ]]; then
+   die "${PN} needs at least gcc 10"
+   elif tc-is-clang && [[ $(clang-major-version) -lt 12 ]]; then
+   die "${PN} needs at least clang 12"
+   fi
+   fi
+}
+
+src_prepare() {
+   default
+
+   # Needs unpackaged dwarfdump
+   rm test/elf/{{dead,compress}-debug-sections,compressed-debug-info}.sh 
|| die
+
+   # Heavy tests, need qemu
+   rm test/elf/gdb-index-{compress-output,dwarf{2,3,4,5}}.sh || die
+   rm test/elf/lto-{archive,dso,gcc,llvm,version-script}.sh || die
+
+   # Sandbox sadness
+   rm test/elf/run.sh || die
+   sed -i 's|`pwd`/mold-wrapper.so|"& ${LD_PRELOAD}"|' \
+   test/elf/mold-wrapper{,2}.sh || die
+
+   # static-pie tests require glibc built with static-pie support
+   if ! has_version -d 'sys-libs/glibc[static-pie(+)]'; then
+   rm test/elf/{,ifunc-}static-pie.sh || die
+   fi
+}
+
+src_compile() {
+   tc-export CC CXX
+
+   emake \
+   CFLAGS="${CFLAGS}" \
+   CXXFLAGS="${CXXFLAGS}" \
+   SYSTEM_TBB=1 \
+   SYSTEM_MIMALLOC=1 \
+   STRIP="true" \
+   LIBDIR="${EPREFIX}/usr/$(get_libdir)"
+}
+
+src_test() {
+   emake \
+   SYSTEM_TBB=1 \
+   SYSTEM_MIMALLOC=1 \
+   check
+}
+
+src_install() {
+   emake \
+   SYSTEM_TBB=1 \
+   SYSTEM_MIMALLOC=1 \
+   DESTDIR="${D}" \
+   PREFIX="${EPREFIX}/usr" \
+   LIBDIR="${EPREFIX}/usr/$(get_libdir)" \
+   STRIP="true" \
+   install
+}



[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2021-12-19 Thread Sam James
commit: 7de18053c3711a2ded06d55c4523305eb2ba4bd0
Author: Sam James  gentoo  org>
AuthorDate: Mon Dec 20 05:08:24 2021 +
Commit: Sam James  gentoo  org>
CommitDate: Mon Dec 20 05:08:29 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7de18053

sys-devel/mold: drop 0.9.6-r3

Signed-off-by: Sam James  gentoo.org>

 sys-devel/mold/Manifest|  1 -
 .../mold/files/mold-0.9.6-fix-libdir-wrapper.patch | 26 --
 .../mold/files/mold-0.9.6-respect-flags.patch  | 49 ---
 sys-devel/mold/mold-0.9.6-r3.ebuild| 98 --
 4 files changed, 174 deletions(-)

diff --git a/sys-devel/mold/Manifest b/sys-devel/mold/Manifest
index c1c71b4a9882..a5d35e75f69c 100644
--- a/sys-devel/mold/Manifest
+++ b/sys-devel/mold/Manifest
@@ -1,2 +1 @@
-DIST mold-0.9.6.tar.gz 3378698 BLAKE2B 
1352e4f2bc018b53f6f18f6412c4747660a808a896d0c5c620db64babe42a6a949ca444f14a426a41202c8e26ff5973996819c6e4778eeaff6cb20b5746deb0d
 SHA512 
d3de30b371413e974728fba03958d6043026f59aead8371058a0b1dc672e2675e169a1def3afd3751058f529d6ec80ff78c773d2718c1d9f0bdea74d9f13bc2e
 DIST mold-1.0.0.tar.gz 3482927 BLAKE2B 
56ebc267370548a2f91a71ebeed87871cede6f564c29dc7d44a499b95fe570f6e9c8a717baf2d9e235c7057c41e735b315493bd23d3b44574d2a44b14aaf5ef8
 SHA512 
99ffd0b9e2ff7157cc8b26808675c9d3147bf88961155ae19ed9b0ac647b7ec31ee78d05062decc6d41e66d99aa0fdc398d119803929b8dbff51eb3d077c

diff --git a/sys-devel/mold/files/mold-0.9.6-fix-libdir-wrapper.patch 
b/sys-devel/mold/files/mold-0.9.6-fix-libdir-wrapper.patch
deleted file mode 100644
index d8155cde8f58..
--- a/sys-devel/mold/files/mold-0.9.6-fix-libdir-wrapper.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Should be fixed with a LIBDIR variable in the next release.
-
-https://bugs.gentoo.org/823653
-https://github.com/rui314/mold/issues/127
 a/elf/subprocess.cc
-+++ b/elf/subprocess.cc
-@@ -267,18 +267,7 @@
- 
- template 
- std::string find_dso(Context , const std::string ) {
--  // Look for mold-wrapper.so from the same directory as the executable is.
--  std::string path = std::string(path_dirname(self)) + "/mold-wrapper.so";
--  if (is_regular_file(path))
--return path;
--
--  // If not exist, mold might be installed as $PREFIX/bin/mold and the
--  // DSO as $PREFIX/lib/mold/mold-wrapper.so.
--  path = path_clean(self + "/../../lib/mold/mold-wrapper.so");
--  if (is_regular_file(path))
--return path;
--
--  Fatal(ctx) << "mold-wrapper.so is missing";
-+  return "/usr/lib64/mold/mold-wrapper.so";
- }
- 
- template 

diff --git a/sys-devel/mold/files/mold-0.9.6-respect-flags.patch 
b/sys-devel/mold/files/mold-0.9.6-respect-flags.patch
deleted file mode 100644
index 270a28988f9d..
--- a/sys-devel/mold/files/mold-0.9.6-respect-flags.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From: Sam James 
-Date: Fri, 29 Oct 2021 22:50:40 +0100
-Subject: [PATCH] Respect *FLAGS
-
 a/Makefile
-+++ b/Makefile
-@@ -10,10 +10,11 @@ GIT_HASH ?= $(shell [ -d .git ] && git rev-parse HEAD)
- 
- OS ?= $(shell uname -s)
- 
--CPPFLAGS = -g -pthread -std=c++20 -fPIE \
--   -DMOLD_VERSION=\"0.9.6\" \
--   -DGIT_HASH=\"$(GIT_HASH)\" \
-- $(EXTRA_CPPFLAGS)
-+CFLAGS = -pthread -fPIE $(EXTRA_CFLAGS)
-+CXXFLAGS = -pthread -std=c++20 -fPIE $(EXTRA_CXXFLAGS)
-+CPPFLAGS = -DMOLD_VERSION=\"0.9.6\" \
-+  -DGIT_HASH=\"$(GIT_HASH)\" \
-+  $(EXTRA_CPPFLAGS)
- LDFLAGS += $(EXTRA_LDFLAGS)
- LIBS = -pthread -lz -lxxhash -ldl -lm
- 
-@@ -28,12 +29,6 @@ LTO ?= 0
- ASAN ?= 0
- TSAN ?= 0
- 
--ifeq ($(DEBUG), 1)
--  CPPFLAGS += -O0
--else
--  CPPFLAGS += -O2
--endif
--
- ifeq ($(LTO), 1)
-   CPPFLAGS += -flto -O3
-   LDFLAGS  += -flto
-@@ -73,11 +68,11 @@ endif
- all: mold mold-wrapper.so
- 
- mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB)
--  $(CXX) $(CXXFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
-+  $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
-   ln -sf mold ld
- 
- mold-wrapper.so: elf/mold-wrapper.c Makefile
--  $(CC) -fPIC -shared -o $@ $< -ldl
-+  $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -o $@ $(LDFLAGS) $< -ldl
- 
- $(OBJS): $(HEADERS) Makefile
- 

diff --git a/sys-devel/mold/mold-0.9.6-r3.ebuild 
b/sys-devel/mold/mold-0.9.6-r3.ebuild
deleted file mode 100644
index 3baea582d9ec..
--- a/sys-devel/mold/mold-0.9.6-r3.ebuild
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright 2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-
-inherit toolchain-funcs
-
-DESCRIPTION="A Modern Linker"
-HOMEPAGE="https://github.com/rui314/mold;
-if [[ ${PV} ==  ]] ; then
-   EGIT_REPO_URI="https://github.com/rui314/mold.git;
-   inherit git-r3
-else
-   SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
-   KEYWORDS="~amd64"
-fi
-
-LICENSE="AGPL-3"
-SLOT="0"
-
-# Try again after 0.9.6
-RESTRICT="test"
-
-RDEPEND=">=dev-cpp/tbb-2021.4.0:=
-   

[gentoo-commits] repo/gentoo:master commit in: sys-devel/mold/files/, sys-devel/mold/

2021-12-14 Thread Sam James
commit: cb38ac7fc6ad1953967241e3520eb754f263840e
Author: Sam James  gentoo  org>
AuthorDate: Tue Dec 14 11:13:03 2021 +
Commit: Sam James  gentoo  org>
CommitDate: Tue Dec 14 11:14:02 2021 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cb38ac7f

sys-devel/mold: add live ebuild

Signed-off-by: Sam James  gentoo.org>

 .../files/mold--build-respect-user-FLAGS.patch | 83 ++
 .../files/mold--don-t-compress-man-page.patch  | 22 ++
 sys-devel/mold/mold-0.9.6-r2.ebuild| 10 ++-
 .../{mold-0.9.6-r2.ebuild => mold-.ebuild} | 49 +
 4 files changed, 130 insertions(+), 34 deletions(-)

diff --git a/sys-devel/mold/files/mold--build-respect-user-FLAGS.patch 
b/sys-devel/mold/files/mold--build-respect-user-FLAGS.patch
new file mode 100644
index ..ac218201b902
--- /dev/null
+++ b/sys-devel/mold/files/mold--build-respect-user-FLAGS.patch
@@ -0,0 +1,83 @@
+https://github.com/rui314/mold/pull/135
+
+From: Sam James 
+Date: Tue, 14 Dec 2021 10:53:44 +
+Subject: [PATCH 1/2] build: respect user *FLAGS
+
+- Respect user CXXFLAGS
+- Rename CPPFLAGS (previously used in the sense of "flags for the C++ 
compiler") -> CXXFLAGS
+- CPPFLAGS is generally used for "flags for the C(++) preprocessor.", so let's
+  use it for that
+- Respect user LDFLAGS
+  (In one instance, we were respecting LDFLAGS, but doing it too late.
+  We need to pass LDFLAGS _before_ any objects in order for -Wl,--as-needed
+  to work correctly.)
+
+Signed-off-by: Sam James 
+--- a/Makefile
 b/Makefile
+@@ -17,10 +17,15 @@ STRIP ?= strip
+ 
+ OS ?= $(shell uname -s)
+ 
+-CPPFLAGS = -pthread -std=c++20 -fPIE -DMOLD_VERSION=\"0.9.6\" \
+- -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables \
+- -DLIBDIR="\"$(LIBDIR)\"" $(EXTRA_CPPFLAGS)
+-LDFLAGS += $(EXTRA_LDFLAGS)
++# Used for both C and C++
++COMMON_FLAGS = -pthread -fPIE -fno-exceptions -fno-unwind-tables 
-fno-asynchronous-unwind-tables
++
++CFLAGS ?= -O2
++CFLAGS += $(COMMON_FLAGS)
++
++CXXFLAGS ?= -O2
++CXXFLAGS += $(COMMON_FLAGS) -std=c++20
++CPPFLAGS += -DMOLD_VERSION=\"0.9.6\" -DLIBDIR="\"$(LIBDIR)\""
+ LIBS = -pthread -lz -lxxhash -ldl -lm
+ 
+ SRCS=$(wildcard *.cc elf/*.cc macho/*.cc)
+@@ -38,21 +43,19 @@ ifneq ($(GIT_HASH),)
+ endif
+ 
+ ifeq ($(DEBUG), 1)
+-  CPPFLAGS += -O0 -g
+-else
+-  CPPFLAGS += -O2
++  CXXFLAGS += -O0 -g
+ endif
+ 
+ ifeq ($(LTO), 1)
+-  CPPFLAGS += -flto -O3
++  CXXFLAGS += -flto -O3
+   LDFLAGS  += -flto
+ endif
+ 
+ ifeq ($(ASAN), 1)
+-  CPPFLAGS += -fsanitize=address
++  CXXFLAGS += -fsanitize=address
+   LDFLAGS  += -fsanitize=address
+ else ifeq ($(TSAN), 1)
+-  CPPFLAGS += -fsanitize=thread
++  CXXFLAGS += -fsanitize=thread
+   LDFLAGS  += -fsanitize=thread
+ else ifneq ($(OS), Darwin)
+   # By default, we want to use mimalloc as a memory allocator.
+@@ -89,15 +92,15 @@ endif
+ all: mold mold-wrapper.so
+ 
+ mold: $(OBJS) $(MIMALLOC_LIB) $(TBB_LIB)
+-  $(CXX) $(CPPFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)
++  $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ $(LIBS)
+   ln -sf mold ld
+   ln -sf mold ld64.mold
+ 
+ mold-wrapper.so: elf/mold-wrapper.c Makefile
+-  $(CC) -fPIC -shared -o $@ $< -ldl
++  $(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -shared -o $@ $(LDFLAGS) $< -ldl
+ 
+ out/%.o: %.cc $(HEADERS) Makefile out/elf/.keep out/macho/.keep
+-  $(CXX) $(CPPFLAGS) -c -o $@ $<
++  $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
+ 
+ out/elf/.keep:
+   mkdir -p out/elf

diff --git a/sys-devel/mold/files/mold--don-t-compress-man-page.patch 
b/sys-devel/mold/files/mold--don-t-compress-man-page.patch
new file mode 100644
index ..23dd705b553a
--- /dev/null
+++ b/sys-devel/mold/files/mold--don-t-compress-man-page.patch
@@ -0,0 +1,22 @@
+https://github.com/rui314/mold/pull/135
+
+From: Sam James 
+Date: Tue, 14 Dec 2021 11:01:19 +
+Subject: [PATCH 2/2] build: don't compress man page
+
+Negligible saving and downstream, distributions usually recompress or
+compress with their own specific options. Unconditionally compressing
+man pages, while well intended, usually creates more hassle there.
+
+Signed-off-by: Sam James 
+--- a/Makefile
 b/Makefile
+@@ -140,8 +140,6 @@ install: all
+ 
+   install -m 755 -d $D$(MANDIR)/man1
+   install -m 644 docs/mold.1 $D$(MANDIR)/man1
+-  rm -f $D$(MANDIR)/man1/mold.1.gz
+-  gzip -9 $D$(MANDIR)/man1/mold.1
+ 
+   ln -sf mold $D$(BINDIR)/ld.mold
+   ln -sf mold $D$(BINDIR)/ld64.mold

diff --git a/sys-devel/mold/mold-0.9.6-r2.ebuild 
b/sys-devel/mold/mold-0.9.6-r2.ebuild
index a8bb3b7a4246..ceaaeaf2af4f 100644
--- a/sys-devel/mold/mold-0.9.6-r2.ebuild
+++ b/sys-devel/mold/mold-0.9.6-r2.ebuild
@@ -7,11 +7,17 @@ inherit toolchain-funcs
 
 DESCRIPTION="A Modern Linker"
 HOMEPAGE="https://github.com/rui314/mold;
-SRC_URI="https://github.com/rui314/mold/archive/refs/tags/v${PV}.tar.gz -> 
${P}.tar.gz"
+if