diff --git a/0001-Use-system-compatible-include-path-for-xxhash.h.patch b/0001-Use-system-compatible-include-path-for-xxhash.h.patch index 3750217..a571c3d 100644 --- a/0001-Use-system-compatible-include-path-for-xxhash.h.patch +++ b/0001-Use-system-compatible-include-path-for-xxhash.h.patch @@ -1,8 +1,8 @@ -From db11436c0ccbfee0f617ae7498c25fb2f4e76626 Mon Sep 17 00:00:00 2001 -Message-Id: +From 73862d08e89da6b2c72eabbf3f61d612974e2ee0 Mon Sep 17 00:00:00 2001 +Message-Id: <73862d08e89da6b2c72eabbf3f61d612974e2ee0.1668329176.git.github@sicherha.de> From: Christoph Erhardt -Date: Tue, 27 Sep 2022 13:32:57 +0200 -Subject: [PATCH 1/2] Use system-compatible include path for `xxhash.h` +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, @@ -10,37 +10,24 @@ not in an `xxhash` subdirectory. Adjust the include path and the `#include` directive accordingly. --- CMakeLists.txt | 2 ++ - Makefile | 1 + mold.h | 2 +- - 3 files changed, 4 insertions(+), 1 deletion(-) + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt -index 79c035d5..520c7bdf 100644 +index 3c14940c..23e1d712 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -126,6 +126,8 @@ else() +@@ -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") - message(FATAL_ERROR -diff --git a/Makefile b/Makefile -index 2d14c85f..40fa5aab 100644 ---- a/Makefile -+++ b/Makefile -@@ -59,6 +59,7 @@ CXXFLAGS = -O2 - - MOLD_CXXFLAGS := -std=c++20 -fno-exceptions -fno-unwind-tables \ - -fno-asynchronous-unwind-tables \ -+ -Ithird-party/xxhash \ - -Wno-sign-compare -Wno-unused-function \ - -DMOLD_VERSION=\"$(VERSION)\" -DLIBDIR="\"$(LIBDIR)\"" - diff --git a/mold.h b/mold.h -index b1b859bd..c8dbfcf2 100644 +index 6f9fe2e8..5ebad268 100644 --- a/mold.h +++ b/mold.h @@ -32,7 +32,7 @@ @@ -53,5 +40,5 @@ index b1b859bd..c8dbfcf2 100644 #ifdef NDEBUG # define unreachable() __builtin_unreachable() -- -2.37.3 +2.38.1 diff --git a/0002-ELF-i386-Allow-R_386_PC32-after-R_386_TLS_-GD-LDM.patch b/0002-ELF-i386-Allow-R_386_PC32-after-R_386_TLS_-GD-LDM.patch deleted file mode 100644 index 8ff0bde..0000000 --- a/0002-ELF-i386-Allow-R_386_PC32-after-R_386_TLS_-GD-LDM.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 2f5b3be6214d8157736e60f68693352a3ffd5a47 Mon Sep 17 00:00:00 2001 -Message-Id: <2f5b3be6214d8157736e60f68693352a3ffd5a47.1666197268.git.github@sicherha.de> -In-Reply-To: <6c0c571d629d924e3f59d8710de6589848204e17.1666197268.git.github@sicherha.de> -References: <6c0c571d629d924e3f59d8710de6589848204e17.1666197268.git.github@sicherha.de> -From: Rui Ueyama -Date: Wed, 19 Oct 2022 19:33:18 +0800 -Subject: [PATCH 2/3] [ELF][i386] Allow R_386_PC32 after R_386_TLS_{GD,LDM} - -I don't know why GCC sometimes creates a PC32 relocation instead of -PLT32 after a TLS_GD/TLS_LDM. I believe it's strictly speaking a -violation of the psABI. But we need to handle such input. - -Fixes https://github.com/rui314/mold/issues/794 ---- - elf/arch-i386.cc | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/elf/arch-i386.cc b/elf/arch-i386.cc -index 46391844..20563faa 100644 ---- a/elf/arch-i386.cc -+++ b/elf/arch-i386.cc -@@ -485,7 +485,8 @@ void InputSection::scan_relocations(Context &ctx) { - Fatal(ctx) << *this << ": TLS_GD reloc must be followed by PLT or GOT32"; - - if (u32 ty = rels[i + 1].r_type; -- ty != R_386_PLT32 && ty != R_386_GOT32 && ty != R_386_GOT32X) -+ ty != R_386_PLT32 && ty != R_386_PC32 && -+ ty != R_386_GOT32 && ty != R_386_GOT32X) - Fatal(ctx) << *this << ": TLS_GD reloc must be followed by PLT or GOT32"; - - if (relax_tlsgd(ctx, sym)) -@@ -498,7 +499,8 @@ void InputSection::scan_relocations(Context &ctx) { - Fatal(ctx) << *this << ": TLS_LDM reloc must be followed by PLT or GOT32"; - - if (u32 ty = rels[i + 1].r_type; -- ty != R_386_PLT32 && ty != R_386_GOT32 && ty != R_386_GOT32X) -+ ty != R_386_PLT32 && ty != R_386_PC32 && -+ ty != R_386_GOT32 && ty != R_386_GOT32X) - Fatal(ctx) << *this << ": TLS_LDM reloc must be followed by PLT or GOT32"; - - if (relax_tlsld(ctx)) --- -2.37.3 - diff --git a/0003-ELF-i386-Fix-assertion-failure.patch b/0003-ELF-i386-Fix-assertion-failure.patch deleted file mode 100644 index 2ce9d75..0000000 --- a/0003-ELF-i386-Fix-assertion-failure.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b6d3255e1a498d5a966bd303eb09390aa24ef596 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: <6c0c571d629d924e3f59d8710de6589848204e17.1666197268.git.github@sicherha.de> -References: <6c0c571d629d924e3f59d8710de6589848204e17.1666197268.git.github@sicherha.de> -From: Rui Ueyama -Date: Wed, 19 Oct 2022 20:14:53 +0800 -Subject: [PATCH 3/3] [ELF][i386] Fix assertion failure - -https://github.com/rui314/mold/issues/794 ---- - elf/arch-i386.cc | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/elf/arch-i386.cc b/elf/arch-i386.cc -index 20563faa..87524fd1 100644 ---- a/elf/arch-i386.cc -+++ b/elf/arch-i386.cc -@@ -234,7 +234,8 @@ void InputSection::apply_reloc_alloc(Context &ctx, u8 *base) { - } else { - // Relax GD to LE - switch (rels[i + 1].r_type) { -- case R_386_PLT32: { -+ case R_386_PLT32: -+ case R_386_PC32: { - static const u8 insn[] = { - 0x65, 0xa1, 0, 0, 0, 0, // mov %gs:0, %eax - 0x81, 0xe8, 0, 0, 0, 0, // add $val, %eax -@@ -266,7 +267,8 @@ void InputSection::apply_reloc_alloc(Context &ctx, u8 *base) { - } else { - // Relax LD to LE - switch (rels[i + 1].r_type) { -- case R_386_PLT32: { -+ case R_386_PLT32: -+ case R_386_PC32: { - static const u8 insn[] = { - 0x31, 0xc0, // xor %eax, %eax - 0x65, 0x8b, 0x00, // mov %gs:(%eax), %eax --- -2.37.3 - diff --git a/0004-Fix-name-lookup-for-section-symbols-when-st_shndx-SH.patch b/0004-Fix-name-lookup-for-section-symbols-when-st_shndx-SH.patch deleted file mode 100644 index 54d5859..0000000 --- a/0004-Fix-name-lookup-for-section-symbols-when-st_shndx-SH.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 8bfdf07e71706162ab98159bf1a412d31ff31e0e Mon Sep 17 00:00:00 2001 -Message-Id: <8bfdf07e71706162ab98159bf1a412d31ff31e0e.1666443387.git.github@sicherha.de> -In-Reply-To: <6c0c571d629d924e3f59d8710de6589848204e17.1666443387.git.github@sicherha.de> -References: <6c0c571d629d924e3f59d8710de6589848204e17.1666443387.git.github@sicherha.de> -From: Christoph Erhardt -Date: Sat, 22 Oct 2022 14:41:42 +0200 -Subject: [PATCH 4/4] Fix name lookup for section symbols when `st_shndx == - SHN_XINDEX` - -When the section-header index has the escape value `SHN_XINDEX`, the -actual index must be looked up in the separate `SHT_SYMTAB_SHNDX` table. -Trying to use `SHN_XINDEX` (= 0xffff) as an index results in an -out-of-bounds read. The error can be observed when running the -`x86_64_many-sections.sh` test on RHEL 8 or 9 (but not on Fedora, -because there the assembler doesn't emit section symbols). - -Instead of using `st_shndx` directly, call the pre-existing helper -method `get_shndx()` to get the correct behaviour. - -Signed-off-by: Christoph Erhardt ---- - elf/input-files.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/elf/input-files.cc b/elf/input-files.cc -index 15ccd634..3c5ca619 100644 ---- a/elf/input-files.cc -+++ b/elf/input-files.cc -@@ -439,7 +439,7 @@ void ObjectFile::initialize_symbols(Context &ctx) { - - std::string_view name; - if (esym.st_type == STT_SECTION) -- name = this->shstrtab.data() + this->elf_sections[esym.st_shndx].sh_name; -+ name = this->shstrtab.data() + this->elf_sections[get_shndx(esym)].sh_name; - else - name = this->symbol_strtab.data() + esym.st_name; - --- -2.37.3 - diff --git a/mold.spec b/mold.spec index c8e6959..3f40276 100644 --- a/mold.spec +++ b/mold.spec @@ -1,5 +1,8 @@ +# Force out-of-source build (needed on el8) +%undefine __cmake_in_source_build + Name: mold -Version: 1.6.0 +Version: 1.7.0 Release: 1%{?dist} Summary: A Modern Linker @@ -17,13 +20,6 @@ Patch0: tbb-strip-werror.patch # Allow building against the system-provided `xxhash.h` Patch2: 0001-Use-system-compatible-include-path-for-xxhash.h.patch -# Fix test failure on i386 (https://github.com/rui314/mold/issues/794) -Patch3: 0002-ELF-i386-Allow-R_386_PC32-after-R_386_TLS_-GD-LDM.patch -Patch4: 0003-ELF-i386-Fix-assertion-failure.patch - -# Fix test failure on epel8/epel9 (https://github.com/rui314/mold/pull/809) -Patch5: 0004-Fix-name-lookup-for-section-symbols-when-st_shndx-SH.patch - # mold can currently produce native binaries for these architectures only ExclusiveArch: %{ix86} x86_64 %{arm32} aarch64 %{power64} %{riscv32} %{riscv64} s390x sparc64 sparc64v @@ -111,6 +107,10 @@ fi %{_mandir}/man1/mold.1* %changelog +* Fri Nov 18 2022 Christoph Erhardt - 1.7.0-1 +- Bump version to 1.7.0 +- Drop upstreamed patches + * Sat Oct 22 2022 Christoph Erhardt - 1.6.0-1 - Bump version to 1.6.0 - Add new supported architectures diff --git a/sources b/sources index 99d30c6..257b50d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (mold-1.6.0.tar.gz) = dcb498da95ee02a08b175861ae24f3793705671670f6f3487eebd3aab2487fd2163fc1747c9ca2fd1c3570a5f1f0bcfd7d4d91bf6a904a1ba098be6cbbe8c857 +SHA512 (mold-1.7.0.tar.gz) = 9af87b85cc5dc6f46cec9b74effaee55332c789f0673c4e93367e8f6be3fbf3aaca5d9f5be6e4e47294e10cb1f7321a5a4fa28500bc7da7531bbe7424c9d8799