Compare commits

..

No commits in common. "rawhide" and "f34" have entirely different histories.
rawhide ... f34

8 changed files with 237 additions and 161 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
/mold-*.tar.gz
/mold-1.2.1.tar.gz

View File

@ -0,0 +1,41 @@
From 339ce3afe5ebbcc924df431153a0b8fc549b9dd8 Mon Sep 17 00:00:00 2001
Message-Id: <339ce3afe5ebbcc924df431153a0b8fc549b9dd8.1651330992.git.github@sicherha.de>
From: Rui Ueyama <ruiu@cs.stanford.edu>
Date: Sat, 30 Apr 2022 12:06:39 +0800
Subject: [PATCH 1/3] [ELF][LTO] Fix LTO on 32-bit hosts
`off_t` is either an alias for `off32_t` or for `off64_t` on a 32-bit
machine. `off32_t` is the default. But it looks like LLVM gold plugin
is always compiled with `off64_t`.
Because of this difference, the offset of the `handle` member in
`PluginInputFile` differed between mold and LLVMgold.so. mold thought
that the member was at offset 16 of the struct, while LLVMgold.so
thought that it's at offset 24.
That caused a mysterious crash when LLVMgold tries to access the
`handle` member.
Fixes https://github.com/rui314/mold/issues/483
---
lto.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lto.h b/lto.h
index c7a73698..03ab340f 100644
--- a/lto.h
+++ b/lto.h
@@ -73,8 +73,8 @@ enum PluginOutputFileType {
struct PluginInputFile {
const char *name;
int fd;
- off_t offset;
- off_t filesize;
+ uint64_t offset;
+ uint64_t filesize;
void *handle;
};
--
2.35.1

View File

@ -1,44 +0,0 @@
From 73862d08e89da6b2c72eabbf3f61d612974e2ee0 Mon Sep 17 00:00:00 2001
Message-Id: <73862d08e89da6b2c72eabbf3f61d612974e2ee0.1668329176.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 6 Aug 2022 09:18:54 +0200
Subject: [PATCH] Use system-compatible include path for `xxhash.h`
Distributors that build mold against the system-provided xxHash package
expect its header file `xxhash.h` in the top-level include directory,
not in an `xxhash` subdirectory. Adjust the include path and the
`#include` directive accordingly.
---
CMakeLists.txt | 2 ++
mold.h | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c14940c..23e1d712 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -191,6 +191,8 @@ else()
mold_add_tbb()
endif()
+target_include_directories(mold PRIVATE third-party/xxhash)
+
# We always use Clang to build mold on Windows. MSVC can't compile mold.
if(WIN32)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
diff --git a/mold.h b/mold.h
index 6f9fe2e8..5ebad268 100644
--- a/mold.h
+++ b/mold.h
@@ -32,7 +32,7 @@
#endif
#define XXH_INLINE_ALL 1
-#include "third-party/xxhash/xxhash.h"
+#include <xxhash.h>
#ifdef NDEBUG
# define unreachable() __builtin_unreachable()
--
2.38.1

View File

@ -1,45 +0,0 @@
From a2c7ad822b75bba41c0de6ad02eef2cbae09f252 Mon Sep 17 00:00:00 2001
Message-Id: <a2c7ad822b75bba41c0de6ad02eef2cbae09f252.1668864292.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Sat, 19 Nov 2022 14:01:52 +0100
Subject: [PATCH] Fix out-of-bounds error on aarch64 with `_GLIBCXX_ASSERTIONS`
enabled (again)
The square-bracket operator of `std::span` has undefined behaviour for
out-of-bounds element accesses. Resorting to iterators yields defined
behaviour.
This issue (originally described in #298) had been fixed in the past by
commit 03ba8f93255055adaf69984c17bcfea3b22340db, but it has since
resurfaced with commit 193c245781df18e3c7d96efc1ea03e9760175681.
Signed-off-by: Christoph Erhardt <github@sicherha.de>
---
elf/thunks.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/elf/thunks.cc b/elf/thunks.cc
index 89063757..7dff795a 100644
--- a/elf/thunks.cc
+++ b/elf/thunks.cc
@@ -222,7 +222,7 @@ void create_range_extension_thunks(Context<E> &ctx, OutputSection<E> &osec) {
thunk.offset = offset;
// Scan relocations between B and C to collect symbols that need thunks.
- tbb::parallel_for_each(&m[b], &m[c], [&](InputSection<E> *isec) {
+ tbb::parallel_for_each(m.begin() + b, m.begin() + c, [&](InputSection<E> *isec) {
scan_rels(ctx, *isec, thunk);
});
@@ -244,7 +244,7 @@ void create_range_extension_thunks(Context<E> &ctx, OutputSection<E> &osec) {
}
// Scan relocations again to fix symbol offsets in the last thunk.
- tbb::parallel_for_each(&m[b], &m[c], [&](InputSection<E> *isec) {
+ tbb::parallel_for_each(m.begin() + b, m.begin() + c, [&](InputSection<E> *isec) {
std::span<Symbol<E> *> syms = isec->file.symbols;
std::span<const ElfRel<E>> rels = isec->get_rels(ctx);
std::span<RangeExtensionRef> range_extn = isec->extra.range_extn;
--
2.38.1

View File

@ -0,0 +1,41 @@
From 9a48159c5aa7c79fc7d4ac41fa94c1ccd3708ea6 Mon Sep 17 00:00:00 2001
Message-Id: <9a48159c5aa7c79fc7d4ac41fa94c1ccd3708ea6.1651330992.git.github@sicherha.de>
In-Reply-To: <339ce3afe5ebbcc924df431153a0b8fc549b9dd8.1651330992.git.github@sicherha.de>
References: <339ce3afe5ebbcc924df431153a0b8fc549b9dd8.1651330992.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Thu, 28 Apr 2022 23:48:29 +0200
Subject: [PATCH 2/3] Skip `-static-pie` tests on i686, not just on i386
Signed-off-by: Christoph Erhardt <github@sicherha.de>
---
test/elf/hello-static-pie.sh | 1 +
test/elf/ifunc-static-pie.sh | 1 +
2 files changed, 2 insertions(+)
diff --git a/test/elf/hello-static-pie.sh b/test/elf/hello-static-pie.sh
index 0921a876..6970ef9d 100755
--- a/test/elf/hello-static-pie.sh
+++ b/test/elf/hello-static-pie.sh
@@ -16,6 +16,7 @@ mkdir -p $t
# We need to implement R_386_GOT32X relaxation to support PIE on i386
[ $MACHINE = i386 ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
[ $MACHINE = aarch64 ] && { echo skipped; exit; }
diff --git a/test/elf/ifunc-static-pie.sh b/test/elf/ifunc-static-pie.sh
index 4edcfabe..5977ee53 100755
--- a/test/elf/ifunc-static-pie.sh
+++ b/test/elf/ifunc-static-pie.sh
@@ -16,6 +16,7 @@ mkdir -p $t
# We need to implement R_386_GOT32X relaxation to support PIE on i386
[ $MACHINE = i386 ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
# RISCV64 does not support IFUNC yet
[ $MACHINE = riscv64 ] && { echo skipped; exit; }
--
2.35.1

View File

@ -0,0 +1,129 @@
From 7cfbb9c4895e51ab8673b6a3f14c82be49b023c8 Mon Sep 17 00:00:00 2001
Message-Id: <7cfbb9c4895e51ab8673b6a3f14c82be49b023c8.1651339128.git.github@sicherha.de>
From: Christoph Erhardt <github@sicherha.de>
Date: Fri, 29 Apr 2022 21:44:33 +0200
Subject: [PATCH] Skip tests that fail on i686 and armv7l
---
test/elf/exception.sh | 2 ++
test/elf/gdb-index-compress-output.sh | 3 +++
test/elf/gdb-index-dwarf2.sh | 3 +++
test/elf/gdb-index-dwarf3.sh | 3 +++
test/elf/gdb-index-dwarf4.sh | 3 +++
test/elf/gdb-index-dwarf5.sh | 3 +++
test/elf/hello-static.sh | 2 ++
test/elf/ifunc-static.sh | 2 ++
8 files changed, 21 insertions(+)
diff --git a/test/elf/exception.sh b/test/elf/exception.sh
index 5df54b14..a4138103 100755
--- a/test/elf/exception.sh
+++ b/test/elf/exception.sh
@@ -14,6 +14,8 @@ mold="$(pwd)/mold"
t=out/test/elf/$testname
mkdir -p $t
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+
cat <<EOF | $CXX -c -o $t/a.o -xc++ -fPIC -
int main() {
try {
diff --git a/test/elf/gdb-index-compress-output.sh b/test/elf/gdb-index-compress-output.sh
index 05bfabd2..c22792ae 100755
--- a/test/elf/gdb-index-compress-output.sh
+++ b/test/elf/gdb-index-compress-output.sh
@@ -16,6 +16,9 @@ mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
+
which gdb >& /dev/null || { echo skipped; exit; }
cat <<EOF | $CC -c -o $t/a.o -fPIC -g -ggnu-pubnames -gdwarf-4 -xc - -ffunction-sections
diff --git a/test/elf/gdb-index-dwarf2.sh b/test/elf/gdb-index-dwarf2.sh
index 8e15c8e8..b6e6297e 100755
--- a/test/elf/gdb-index-dwarf2.sh
+++ b/test/elf/gdb-index-dwarf2.sh
@@ -16,6 +16,9 @@ mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
+
which gdb >& /dev/null || { echo skipped; exit; }
echo 'int main() {}' | $CC -o /dev/null -xc -gdwarf-2 -g - >& /dev/null ||
diff --git a/test/elf/gdb-index-dwarf3.sh b/test/elf/gdb-index-dwarf3.sh
index 727dfcbe..466f9597 100755
--- a/test/elf/gdb-index-dwarf3.sh
+++ b/test/elf/gdb-index-dwarf3.sh
@@ -16,6 +16,9 @@ mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
+
which gdb >& /dev/null || { echo skipped; exit; }
echo 'int main() {}' | $CC -o /dev/null -xc -gdwarf-3 -g - >& /dev/null ||
diff --git a/test/elf/gdb-index-dwarf4.sh b/test/elf/gdb-index-dwarf4.sh
index 79ae5d1a..5512cd27 100755
--- a/test/elf/gdb-index-dwarf4.sh
+++ b/test/elf/gdb-index-dwarf4.sh
@@ -16,6 +16,9 @@ mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
+
which gdb >& /dev/null || { echo skipped; exit; }
echo 'int main() {}' | $CC -o /dev/null -xc -gdwarf-4 -g - >& /dev/null ||
diff --git a/test/elf/gdb-index-dwarf5.sh b/test/elf/gdb-index-dwarf5.sh
index 02c0249d..09d20907 100755
--- a/test/elf/gdb-index-dwarf5.sh
+++ b/test/elf/gdb-index-dwarf5.sh
@@ -16,6 +16,9 @@ mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+[ $MACHINE = i686 ] && { echo skipped; exit; }
+
which gdb >& /dev/null || { echo skipped; exit; }
echo 'int main() {}' | $CC -o /dev/null -xc -gdwarf-5 -g - >& /dev/null ||
diff --git a/test/elf/hello-static.sh b/test/elf/hello-static.sh
index 5780b88b..05c60f91 100755
--- a/test/elf/hello-static.sh
+++ b/test/elf/hello-static.sh
@@ -14,6 +14,8 @@ mold="$(pwd)/mold"
t=out/test/elf/$testname
mkdir -p $t
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+
cat <<EOF | $CC -o $t/a.o -c -xc -
#include <stdio.h>
diff --git a/test/elf/ifunc-static.sh b/test/elf/ifunc-static.sh
index e7b0b8c8..150dc921 100755
--- a/test/elf/ifunc-static.sh
+++ b/test/elf/ifunc-static.sh
@@ -17,6 +17,8 @@ mkdir -p $t
# IFUNC is not supported on RISC-V yet
[ $MACHINE = riscv64 ] && { echo skipped; exit; }
+[ $MACHINE = armv7l ] && { echo skipped; exit; }
+
# Skip if libc is musl because musl does not support GNU FUNC
echo 'int main() {}' | $CC -o $t/exe -xc -
readelf --dynamic $t/exe | grep -q ld-musl && { echo OK; exit; }
--
2.35.1

View File

@ -1,12 +1,9 @@
# Force out-of-source build (needed on el8)
%undefine __cmake_in_source_build
Name: mold
Version: 1.7.1
Version: 1.2.1
Release: 1%{?dist}
Summary: A Modern Linker
License: AGPL-3.0-or-later AND (Apache-2.0 OR MIT)
License: AGPLv3+
URL: https://github.com/rui314/mold
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
@ -17,31 +14,29 @@ Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
# in the Fedora tbb package)
Patch0: tbb-strip-werror.patch
# Allow building against the system-provided `xxhash.h`
Patch1: 0001-Use-system-compatible-include-path-for-xxhash.h.patch
# Fix LTO on 32-bit hosts
Patch1: 0001-ELF-LTO-Fix-LTO-on-32-bit-hosts.patch
# Fix out-of-bounds error on ARM (https://github.com/rui314/mold/pull/877)
Patch2: 0002-Fix-out-of-bounds-error-on-aarch64-with-_GLIBCXX_ASS.patch
# Skip failing tests on i686 and armv7l
Patch2: 0002-Skip-static-pie-tests-on-i686-not-just-on-i386.patch
Patch3: 0003-Skip-tests-that-fail-on-i686-and-armv7l.patch
# mold currently cannot produce native binaries for MIPS
ExcludeArch: %{mips}
# mold can currently produce native binaries for these architectures only
ExclusiveArch: %{ix86} x86_64 %{arm} aarch64 riscv64
BuildRequires: cmake
%if 0%{?el8}
BuildRequires: gcc-toolset-12
BuildRequires: gcc-toolset-10-toolchain
%else
BuildRequires: gcc
BuildRequires: gcc-c++ >= 10
%endif
BuildRequires: libzstd-devel
BuildRequires: mimalloc-devel
BuildRequires: openssl-devel
BuildRequires: python3
BuildRequires: xxhash-devel
BuildRequires: zlib-devel
# Required by bundled oneTBB
BuildRequires: hwloc-devel
# The following packages are only required for executing the tests
BuildRequires: clang
BuildRequires: gdb
@ -54,6 +49,7 @@ BuildRequires: libdwarf-tools
%endif
BuildRequires: libstdc++-static
BuildRequires: llvm
BuildRequires: perl
Requires(post): %{_sbindir}/alternatives
Requires(preun): %{_sbindir}/alternatives
@ -62,6 +58,8 @@ Requires(preun): %{_sbindir}/alternatives
# https://bugzilla.redhat.com/show_bug.cgi?id=2036372
Provides: bundled(tbb) = 2021.5
%define build_args PREFIX=%{_prefix} LIBDIR=%{_libdir} CFLAGS="%{build_cflags}" CXXFLAGS="%{build_cxxflags} -Wno-sign-compare" LDFLAGS="%{build_ldflags}" STRIP=echo SYSTEM_MIMALLOC=1
%description
mold is a faster drop-in replacement for existing Unix linkers.
It is several times faster than the LLVM lld linker.
@ -70,17 +68,17 @@ build time, especially in rapid debug-edit-rebuild cycles.
%prep
%autosetup -p1
rm -r third-party/{mimalloc,xxhash,zlib,zstd}
rm -r third-party/{mimalloc,xxhash}
%build
%if 0%{?el8}
. /opt/rh/gcc-toolset-12/enable
. /opt/rh/gcc-toolset-10/enable
%endif
%cmake -DMOLD_USE_SYSTEM_MIMALLOC=ON
%cmake_build
%make_build %{build_args}
%install
%cmake_install
%make_install %{build_args}
chmod +x %{buildroot}%{_libdir}/mold/mold-wrapper.so
%post
if [ "$1" = 1 ]; then
@ -94,67 +92,23 @@ fi
%check
%if 0%{?el8}
. /opt/rh/gcc-toolset-12/enable
. /opt/rh/gcc-toolset-10/enable
%endif
%ctest
%make_build -j1 %{build_args} test
%files
%license %{_docdir}/mold/LICENSE
%license LICENSE
%ghost %{_bindir}/ld
%{_bindir}/mold
%{_bindir}/ld.mold
%{_bindir}/ld64.mold
%{_libdir}/mold
%{_libdir}/mold/mold-wrapper.so
%{_libexecdir}/mold
%{_libexecdir}/mold/ld
%{_mandir}/man1/ld.mold.1*
%{_mandir}/man1/mold.1*
%changelog
* Sat Nov 19 2022 Christoph Erhardt <fedora@sicherha.de> - 1.7.1-1
- Bump version to 1.7.1
* Fri Nov 18 2022 Christoph Erhardt <fedora@sicherha.de> - 1.7.0-1
- Bump version to 1.7.0
- Drop upstreamed patches
- Move from `ExclusiveArch` to `ExcludeArch` as only MIPS remains unsupported
- Build with GCC 12 on el8
* Sat Oct 22 2022 Christoph Erhardt <fedora@sicherha.de> - 1.6.0-1
- Bump version to 1.6.0
- Add new supported architectures
- Drop upstreamed patch
* Thu Sep 29 2022 Christoph Erhardt <fedora@sicherha.de> - 1.5.1-1
- Bump version to 1.5.1 (#2130132)
- Switch to CMake build
- Remove obsolete dependencies
- Add new supported architectures
- Refresh patch
* Sun Sep 04 2022 Christoph Erhardt <fedora@sicherha.de> - 1.4.2-1
- Bump version to 1.4.2
- Refresh patch
* Thu Aug 18 2022 Christoph Erhardt <fedora@sicherha.de> - 1.4.1-1
- Bump version to 1.4.1 (#2119324)
- Refresh patch
- Remove superfluous directory entries from `%%files`
* Sun Aug 07 2022 Christoph Erhardt <fedora@sicherha.de> - 1.4.0-1
- Bump version to 1.4.0 (#2116004)
- Refresh patch
- Use SPDX notation for `License:` field
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sun Jul 03 2022 Christoph Erhardt <fedora@sicherha.de> - 1.3.1-1
- Bump version to 1.3.1 (#2103365)
* Sat Jun 18 2022 Christoph Erhardt <fedora@sicherha.de> - 1.3.0-1
- Bump version to 1.3.0 (#2098316)
- Drop upstreamed patches
* Sat Apr 30 2022 Christoph Erhardt <fedora@sicherha.de> - 1.2.1-1
- Bump version to 1.2.1
- Drop upstreamed patch

View File

@ -1 +1 @@
SHA512 (mold-1.7.1.tar.gz) = 2e1b6203591718976a3b6c22cb9cdc4037efd101ecb520b809aaa242ee758ee24ed98d0b53012fa8423725fd9b89da94e67603af57b9de1dfb3189a096e1ae5b
SHA512 (mold-1.2.1.tar.gz) = fc39674b00119d09b3275ed7232356f0b25dad1a0f3a498f9db1a4835b6d4f9ea637ca9a643a05591ea895e8751d9bee43cdcb42303beb082462e76ddb42a0f1