[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/

2023-11-24 Thread Ulrich Müller
commit: 7e79d9f089364a8d1ae9d95f03fd6e5ecae2920b
Author: Michael Mair-Keimberger  levelnine  at>
AuthorDate: Thu Nov 23 17:18:26 2023 +
Commit: Ulrich Müller  gentoo  org>
CommitDate: Fri Nov 24 17:36:25 2023 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e79d9f0

sys-devel/mold: remove unused patches

Signed-off-by: Michael Mair-Keimberger  levelnine.at>
Signed-off-by: Ulrich Müller  gentoo.org>

 .../mold/files/mold-2.0.0-DT_RELR-dependency.patch | 161 -
 .../mold/files/mold-2.0.0-reloc-test-fix.patch |  58 
 2 files changed, 219 deletions(-)

diff --git a/sys-devel/mold/files/mold-2.0.0-DT_RELR-dependency.patch 
b/sys-devel/mold/files/mold-2.0.0-DT_RELR-dependency.patch
deleted file mode 100644
index 267afde230d2..
--- a/sys-devel/mold/files/mold-2.0.0-DT_RELR-dependency.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-https://bugs.gentoo.org/911591
-https://bugzilla.mozilla.org/show_bug.cgi?id=1847697
-https://github.com/rui314/mold/issues/653#event-10041847648
-https://github.com/rui314/mold/commit/f467ad1add2ab6e381e0e458f026df197e63d487
-
-From f467ad1add2ab6e381e0e458f026df197e63d487 Mon Sep 17 00:00:00 2001
-From: Rui Ueyama 
-Date: Wed, 9 Aug 2023 11:40:09 +0900
-Subject: [PATCH] Create a symbol version dependency to GLIBC_ABI_DT_RELR
-
-Fixes https://github.com/rui314/mold/issues/653

- elf/cmdline.cc |  2 ++
- elf/mold.h |  1 +
- elf/output-chunks.cc   | 44 +-
- test/elf/z-pack-relative-relocs.sh | 16 +++
- 4 files changed, 56 insertions(+), 7 deletions(-)
- create mode 100755 test/elf/z-pack-relative-relocs.sh
-
-diff --git a/elf/cmdline.cc b/elf/cmdline.cc
-index c568ce086..82a0e6869 100644
 a/elf/cmdline.cc
-+++ b/elf/cmdline.cc
-@@ -875,8 +875,10 @@ std::vector 
parse_nonpositional_args(Context ) {
-   ctx.arg.z_nodefaultlib = true;
- } else if (read_z_flag("pack-relative-relocs")) {
-   ctx.arg.pack_dyn_relocs_relr = true;
-+  ctx.arg.z_pack_relative_relocs = true;
- } else if (read_z_flag("nopack-relative-relocs")) {
-   ctx.arg.pack_dyn_relocs_relr = false;
-+  ctx.arg.z_pack_relative_relocs = false;
- } else if (read_z_flag("separate-loadable-segments")) {
-   z_separate_code = SEPARATE_LOADABLE_SEGMENTS;
- } else if (read_z_flag("separate-code")) {
-diff --git a/elf/mold.h b/elf/mold.h
-index e5532211c..3a027f1e9 100644
 a/elf/mold.h
-+++ b/elf/mold.h
-@@ -1831,6 +1831,7 @@ struct Context {
- bool z_nodefaultlib = false;
- bool z_now = false;
- bool z_origin = false;
-+bool z_pack_relative_relocs = false;
- bool z_relro = true;
- bool z_sectionheader = true;
- bool z_shstk = false;
-diff --git a/elf/output-chunks.cc b/elf/output-chunks.cc
-index 726a4da2b..3896a2991 100644
 a/elf/output-chunks.cc
-+++ b/elf/output-chunks.cc
-@@ -2373,12 +2373,13 @@ void VerneedSection::construct(Context ) {
-std::tuple(((SharedFile *)b->file)->soname, b->ver_idx);
-   });
- 
--  // Resize of .gnu.version
-+  // Resize .gnu.version
-   ctx.versym->contents.resize(ctx.dynsym->symbols.size(), 1);
-   ctx.versym->contents[0] = 0;
- 
-   // Allocate a large enough buffer for .gnu.version_r.
--  contents.resize((sizeof(ElfVerneed) + sizeof(ElfVernaux)) * 
syms.size());
-+  contents.resize((sizeof(ElfVerneed) + sizeof(ElfVernaux)) *
-+  (syms.size() + 1));
- 
-   // Fill .gnu.version_r.
-   u8 *buf = (u8 *)[0];
-@@ -2394,14 +2395,14 @@ void VerneedSection::construct(Context ) {
-   verneed->vn_next = ptr - (u8 *)verneed;
- 
- verneed = (ElfVerneed *)ptr;
--ptr += sizeof(*verneed);
-+ptr += sizeof(ElfVerneed);
- verneed->vn_version = 1;
- verneed->vn_file = ctx.dynstr->find_string(((SharedFile 
*)file)->soname);
- verneed->vn_aux = sizeof(ElfVerneed);
- aux = nullptr;
-   };
- 
--  auto add_entry = [&](Symbol *sym) {
-+  auto add_entry = [&](std::string_view verstr) {
- verneed->vn_cnt++;
- 
- if (aux)
-@@ -2409,23 +2410,52 @@ void VerneedSection::construct(Context ) {
- aux = (ElfVernaux *)ptr;
- ptr += sizeof(*aux);
- 
--std::string_view verstr = sym->get_version();
- aux->vna_hash = elf_hash(verstr);
- aux->vna_other = ++veridx;
- aux->vna_name = ctx.dynstr->add_string(verstr);
-   };
- 
-+  // Create version entries.
-   for (i64 i = 0; i < syms.size(); i++) {
- if (i == 0 || syms[i - 1]->file != syms[i]->file) {
-   start_group(syms[i]->file);
--  add_entry(syms[i]);
-+  add_entry(syms[i]->get_version());
- } else if (syms[i - 1]->ver_idx != syms[i]->ver_idx) {
--  add_entry(syms[i]);
-+  add_entry(syms[i]->get_version());
- }
- 
- ctx.versym->contents[syms[i]->get_dynsym_idx(ctx)] = veridx;
-   }
- 
-+  if (ctx.arg.z_pack_relative_relocs) {
-+// If `-z pack-relative-relocs` is specified, we'll create a .relr.dyn
-+// 

[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/

2022-10-15 Thread Conrad Kostecki
commit: 061ba141084aa969d84fe96913a1c8f6bd6b183b
Author: Michael Mair-Keimberger  levelnine  at>
AuthorDate: Fri Oct  7 20:27:24 2022 +
Commit: Conrad Kostecki  gentoo  org>
CommitDate: Sat Oct 15 19:33:41 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=061ba141

sys-devel/mold: remove unused patch

Signed-off-by: Michael Mair-Keimberger  levelnine.at>
Closes: https://github.com/gentoo/gentoo/pull/27688
Signed-off-by: Conrad Kostecki  gentoo.org>

 sys-devel/mold/files/mold-1.4.1-glob-tests.patch | 296 ---
 1 file changed, 296 deletions(-)

diff --git a/sys-devel/mold/files/mold-1.4.1-glob-tests.patch 
b/sys-devel/mold/files/mold-1.4.1-glob-tests.patch
deleted file mode 100644
index ad9dda565323..
--- a/sys-devel/mold/files/mold-1.4.1-glob-tests.patch
+++ /dev/null
@@ -1,296 +0,0 @@
-From 60070e0c1352a1cc6b02a0d1a30c657368a033c3 Mon Sep 17 00:00:00 2001
-From: Rui Ueyama 
-Date: Fri, 19 Aug 2022 20:05:26 +0800
-Subject: [PATCH] Simplify
-

- test/elf/CMakeLists.txt   | 265 +-
- test/macho/CMakeLists.txt | 100 +-
- 2 files changed, 6 insertions(+), 359 deletions(-)
-
-diff --git a/test/elf/CMakeLists.txt b/test/elf/CMakeLists.txt
-index 5d15d6cb..138e8205 100644
 a/test/elf/CMakeLists.txt
-+++ b/test/elf/CMakeLists.txt
-@@ -1,269 +1,12 @@
--set(MOLD_ELF_TESTS
--  absolute-symbols
--  allow-multiple-definition
--  ar-alignment
--  arm32-thumb-interwork
--  as-needed
--  as-needed-weak
--  as-needed2
--  auxiliary
--  basic
--  bno-symbolic
--  bsymbolic
--  bsymbolic-functions
--  bug178
--  build-id
--  canonical-plt
--  cmdline
--  color-diagnostics
--  comment
--  common
--  common-archive
--  common-ref
--  compress-debug-sections
--  compressed-debug-info
--  compressed-debug-info-gnu
--  copyrel
--  copyrel-protected
--  copyrel-relro
--  dead-debug-sections
--  debug-macro-section
--  default-symver
--  defsym
--  defsym2
--  demangle
--  demangle-rust
--  dependency-file
--  disable-new-dtags
--  discard
--  dso-undef
--  dt-init
--  dt-needed
--  duplicate-error
--  dynamic
--  dynamic-dt-debug
--  dynamic-linker
--  dynamic-list
--  dynamic-list2
--  dynamic-list3
--  emit-relocs
--  empty-file
--  empty-input
--  empty-version
--  emulation-deduction
--  entry
--  exception
--  exception-mcmodel-large
--  exclude-libs
--  exclude-libs2
--  exclude-libs3
--  execstack
--  execstack-if-needed
--  export-dynamic
--  export-from-exe
--  fatal-warnings
--  filler
--  filter
--  func-addr
--  gc-sections
--  gdb-index-compress-output
--  gdb-index-dwarf2
--  gdb-index-dwarf3
--  gdb-index-dwarf4
--  gdb-index-dwarf5
--  gdb-index-empty
--  glibc-2.22-bug
--  gnu-hash
--  gnu-linkonce
--  gnu-retain
--  gnu-unique
--  gnu-warning
--  hello-dynamic
--  hello-static
--  help
--  hidden-undef
--  icf
--  icf-small
--  ifunc-dso
--  ifunc-dynamic
--  ifunc-export
--  ifunc-static
--  ifunc-static-pie
--  image-base
--  incompatible-libs
--  incompatible-libs2
--  incompatible-obj
--  init
--  init-array
--  init-array-priorities
--  init-array-readonly
--  init-in-dso
--  initfirst
--  interpose
--  invalid-version-script
--  large-alignment
--  large-alignment-dso
--  link-order
--  linker-script
--  linker-script-defsym
--  linker-script2
--  linker-script3
--  linker-script4
--  lto-archive
--  lto-dso
--  lto-gcc
--  lto-llvm
--  lto-version-script
--  many-sections
--  mergeable-records
--  mergeable-strings
--  missing-but-ok
--  missing-error
--  mold-wrapper
--  mold-wrapper2
--  no-quick-exit
--  nocopyreloc
--  noinhibit-exec
--  non-canonical-plt
--  nostdlib
--  note
--  note-property
--  note2
--  now
--  oformat-binary
--  omagic
--  pack-dyn-relocs-relr
--  package-metadata
--  pie
--  plt
--  plt-dso
--  pltgot
--  preinit-array
--  print-dependencies
--  protected
--  protected-dynsym
--  push-pop-state
--  relax
--  reloc
--  reloc-overflow
--  reloc-rodata
--  reloc-zero
--  relocatable
--  relocatable-archive
--  relro
--  repro
--  require-defined
--  response-file
--  retain-symbols-file
--  reverse-sections
--  rodata-name
--  rosegment
--  rpath
--  run
--  run-clang
--  section-alignment
--  section-name
--  section-start
--  shared
--  shuffle-sections
--  shuffle-sections-seed
--  soname
--  start-lib
--  start-stop-symbol
--  static-archive
--  static-pie
--  stdout
--  strip
--  symbol-rank
--  symbol-version
--  symbol-version2
--  symbol-version3
--  symtab
--  symtab-dso
--  symtab-section-symbols
--  synthetic-symbols
--  sysroot
--  sysroot-linker-script
--  sysroot2
--  thin-archive
--  thread-count
--  tls-common
--  tls-dso
--  tls-gd
--  tls-gd-mcmodel-large
--  tls-gd-noplt
--  tls-gd2
--  tls-ie
--  tls-large-tbss
--  tls-ld
--  tls-ld-mcmodel-large
--  tls-ld-noplt
--  tls-le
--  tls-module-base
--  tls-nopic
--  tls-pic
--  tlsdesc
--  tlsdesc-import
--  tlsdesc-static
--  trace
--  trace-symbol
--  undefined
--  unique
--  

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

2022-09-30 Thread Matthew Smith
commit: a16af49612406ad7be6f1eecf077939f962988b6
Author: Michael Mair-Keimberger  levelnine  at>
AuthorDate: Wed Sep 14 06:45:30 2022 +
Commit: Matthew Smith  gentoo  org>
CommitDate: Fri Sep 30 08:09:29 2022 +
URL:https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a16af496

sys-devel/mold: remove unused patches

Signed-off-by: Michael Mair-Keimberger  levelnine.at>
Portage 3.0.35 / pkgdev 0.2.1 / pkgcheck 0.10.14
Closes: https://github.com/gentoo/gentoo/pull/27244
Signed-off-by: Matthew Smith  gentoo.org>

 .../mold/files/mold-1.2.1-install-nopython.patch   | 34 --
 .../mold/files/mold-1.3.0-openssl-pkgconfig.patch  | 28 --
 .../mold/files/mold-1.3.1-fix-riscv-set32.patch| 25 
 3 files changed, 87 deletions(-)

diff --git a/sys-devel/mold/files/mold-1.2.1-install-nopython.patch 
b/sys-devel/mold/files/mold-1.2.1-install-nopython.patch
deleted file mode 100644
index 661d3dcf392f..
--- a/sys-devel/mold/files/mold-1.2.1-install-nopython.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From 4fb6d4208cfb20bad4a3491a18e78409b5a8183f Mon Sep 17 00:00:00 2001
-From: Matthew Smith 
-Date: Sat, 30 Apr 2022 07:42:50 +0100
-Subject: [PATCH] Don't invoke Python to create libexec/mold/ld symlink
-
-Reverts commits 8073a92614fb59f59570031badab5dd4bc3b4f7f and
-5803c3c200f301adc3abdb66df16d3d669712d70.
-
-Bug #841575

- Makefile | 7 +--
- 1 file changed, 1 insertion(+), 6 deletions(-)
-
-diff --git a/Makefile b/Makefile
-index d1abc850..10e053a9 100644
 a/Makefile
-+++ b/Makefile
-@@ -204,12 +204,7 @@ install: all
-   $(STRIP) $D$(LIBDIR)/mold/mold-wrapper.so
- 
-   $(INSTALL) -d $D$(LIBEXECDIR)/mold
--
--# We want to make a symblink with a relative path, so that users can
--# move the entire directory to other place without breaking the reference.
--# GNU ln supports `--relative` to do that, but that's not supported by
--# non-GNU systems. So we use Python to compute a relative path.
--  ln -sf `python3 -c "import os.path; 
print(os.path.relpath('$(BINDIR)/mold', '$(LIBEXECDIR)/mold'))"` 
$D$(LIBEXECDIR)/mold/ld
-+  ln -sf $(BINDIR)/mold $D$(LIBEXECDIR)/mold/ld
- 
-   $(INSTALL) -d $D$(MANDIR)/man1
-   $(INSTALL_DATA) docs/mold.1 $D$(MANDIR)/man1
--- 
-2.35.3
-

diff --git a/sys-devel/mold/files/mold-1.3.0-openssl-pkgconfig.patch 
b/sys-devel/mold/files/mold-1.3.0-openssl-pkgconfig.patch
deleted file mode 100644
index d2ed0af47b41..
--- a/sys-devel/mold/files/mold-1.3.0-openssl-pkgconfig.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From a4fde946f49cddf4f7c1eceb3b86ca38375cec1d Mon Sep 17 00:00:00 2001
-From: Matthew Smith 
-Date: Sun, 26 Jun 2022 13:44:36 +0100
-Subject: [PATCH] Revert "Do not use pkg-config"
-
-This reverts commit 4ef90d4316bbba3a4b8902e38bf5f68171cc6ab7.
 a/Makefile
-+++ b/Makefile
-@@ -18,6 +18,9 @@ ifeq ($(origin CXX), default)
-   CXX = c++
- endif
- 
-+# Allow overriding pkg-config binary
-+PKG_CONFIG = pkg-config
-+
- # If you want to keep symbols in the installed binary, run make with
- # `STRIP=true` to run /bin/true instead of the strip command.
- STRIP = strip
-@@ -100,7 +103,8 @@ ifeq ($(OS), Darwin)
- endif
- 
- ifeq ($(NEEDS_LIBCRYPTO), 1)
--  MOLD_LDFLAGS += -lcrypto
-+  MOLD_CXXFLAGS += $(shell $(PKG_CONFIG) --cflags-only-I openssl)
-+  MOLD_LDFLAGS += $(shell $(PKG_CONFIG) --libs-only-L openssl) -lcrypto
- endif
- 
- # '-latomic' flag is needed building on riscv64 system.

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
deleted file mode 100644
index 5613d8ddc003..
--- a/sys-devel/mold/files/mold-1.3.1-fix-riscv-set32.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-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;



[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