diff --git a/backport-Fix-spurious-dupilcate-symbol-error-for-LTO.patch b/backport-Fix-spurious-dupilcate-symbol-error-for-LTO.patch new file mode 100644 index 0000000000000000000000000000000000000000..b75220a2336dd36f3089c0b68d0d03c1bccb1f21 --- /dev/null +++ b/backport-Fix-spurious-dupilcate-symbol-error-for-LTO.patch @@ -0,0 +1,51 @@ +From c95476d2fe549a275210a8b3d87ae75d98233140 Mon Sep 17 00:00:00 2001 +From: Rui Ueyama +Date: Fri, 7 Mar 2025 13:17:34 +0900 +Subject: [PATCH] Fix spurious "dupilcate symbol" error for LTO + +Fixes https://github.com/rui314/mold/issues/1421 +--- + src/passes.cc | 3 +++ + test/lto-archive3.sh | 19 +++++++++++++++++++ + 2 files changed, 22 insertions(+) + create mode 100755 test/lto-archive3.sh + +diff --git a/src/passes.cc b/src/passes.cc +index d259cca010..9c3cf4beea 100644 +--- a/src/passes.cc ++++ b/src/passes.cc +@@ -1036,6 +1036,9 @@ void check_duplicate_symbols(Context &ctx) { + Timer t(ctx, "check_duplicate_symbols"); + + tbb::parallel_for_each(ctx.objs, [&](ObjectFile *file) { ++ if (!file->is_reachable) ++ return; ++ + for (i64 i = file->first_global; i < file->elf_syms.size(); i++) { + const ElfSym &esym = file->elf_syms[i]; + Symbol &sym = *file->symbols[i]; +diff --git a/test/lto-archive3.sh b/test/lto-archive3.sh +new file mode 100755 +index 0000000000..09bc3baafc +--- /dev/null ++++ b/test/lto-archive3.sh +@@ -0,0 +1,19 @@ ++#!/bin/bash ++. $(dirname $0)/common.inc ++ ++test_cflags -flto=auto || skip ++ ++cat <= 10 BuildRequires: python3 grep cmake openssl-devel @@ -29,6 +28,8 @@ Patch0: 0001-Use-system-compatible-include-path-for-xxhash.h.patch # Build blake3 as static Patch1: 0002-build-blake3-as-static.patch +Patch6001: backport-Fix-spurious-dupilcate-symbol-error-for-LTO.patch + %define build_args -DMOLD_USE_MIMALLOC=OFF -DMOLD_USE_SYSTEM_TBB=ON -DMOLD_LTO=ON %description @@ -78,6 +79,9 @@ fi %{_mandir}/man1/mold.1* %changelog +* Thu Mar 06 2025 Funda Wang - 2.37.0-1 +- update to 2.37.0 + * Thu Jan 09 2025 Funda Wang - 2.36.0-1 - update to 2.36.0