[packages/mold] up to 2.34.0

atler atler at pld-linux.org
Wed Sep 25 23:47:18 CEST 2024


commit 5f3c960e7778a676a65533febdf5618da71f70a8
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Sep 25 23:46:25 2024 +0200

    up to 2.34.0

 icf-all.patch        |  42 ---------------
 mold.spec            |  10 ++--
 retain_symbols.patch | 146 ---------------------------------------------------
 3 files changed, 3 insertions(+), 195 deletions(-)
---
diff --git a/mold.spec b/mold.spec
index 5a02096..cf27db3 100644
--- a/mold.spec
+++ b/mold.spec
@@ -4,14 +4,12 @@
 
 Summary:	mold: A Modern Linker
 Name:		mold
-Version:	2.33.0
-Release:	3
+Version:	2.34.0
+Release:	1
 License:	MIT
 Group:		Development/Libraries
 Source0:	https://github.com/rui314/mold/archive/v%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	3a860c9aabdf1a186cd0a0d084252105
-Patch0:		icf-all.patch
-Patch1:		retain_symbols.patch
+# Source0-md5:	b433924102c55a59b798388995a4540c
 URL:		https://github.com/rui314/mold
 BuildRequires:	blake3-devel
 BuildRequires:	cmake >= 3.14
@@ -40,8 +38,6 @@ especially in rapid debug-edit-rebuild cycles.
 
 %prep
 %setup -q
-%patch0 -p1
-%patch1 -p1
 
 %{__rm} -r third-party/{mimalloc,tbb}
 
diff --git a/icf-all.patch b/icf-all.patch
deleted file mode 100644
index 59b9560..0000000
--- a/icf-all.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 5a9919b43344b4fb92ea701f0b32a7e20857b9ca Mon Sep 17 00:00:00 2001
-From: Rui Ueyama <ruiu at cs.stanford.edu>
-Date: Fri, 9 Aug 2024 12:08:03 +0900
-Subject: [PATCH] Fix a crash bug
-
-Fixes https://github.com/rui314/mold/issues/1326
----
- elf/output-chunks.cc | 15 ++++++---------
- 1 file changed, 6 insertions(+), 9 deletions(-)
-
-diff --git a/elf/output-chunks.cc b/elf/output-chunks.cc
-index 74c054b8f4..cb246caeb2 100644
---- a/elf/output-chunks.cc
-+++ b/elf/output-chunks.cc
-@@ -1730,21 +1730,18 @@ ElfSym<E> to_output_esym(Context<E> &ctx, Symbol<E> &sym, u32 st_name,
-     esym.st_type = STT_FUNC;
-     esym.st_visibility = sym.visibility;
-     esym.st_value = sym.get_plt_addr(ctx);
--  } else if (!isec->output_section) {
-+  } else if ((isec->shdr().sh_flags & SHF_MERGE) &&
-+             !(isec->shdr().sh_flags & SHF_ALLOC)) {
-     // Symbol in a mergeable non-SHF_ALLOC section, such as .debug_str
--    assert(!(isec->shdr().sh_flags & SHF_ALLOC));
--    assert(isec->shdr().sh_flags & SHF_MERGE);
--    assert(!sym.file->is_dso);
--
-     ObjectFile<E> *file = (ObjectFile<E> *)sym.file;
--    MergeableSection<E> *m =
--      file->mergeable_sections[file->get_shndx(sym.esym())].get();
-+    MergeableSection<E> &m =
-+      *file->mergeable_sections[file->get_shndx(sym.esym())];
- 
-     SectionFragment<E> *frag;
-     i64 frag_addend;
--    std::tie(frag, frag_addend) = m->get_fragment(sym.esym().st_value);
-+    std::tie(frag, frag_addend) = m.get_fragment(sym.esym().st_value);
- 
--    shndx = m->parent.shndx;
-+    shndx = m.parent.shndx;
-     esym.st_visibility = sym.visibility;
-     esym.st_value = frag->get_addr(ctx) + frag_addend;
-   } else {
diff --git a/retain_symbols.patch b/retain_symbols.patch
deleted file mode 100644
index 45be8f6..0000000
--- a/retain_symbols.patch
+++ /dev/null
@@ -1,146 +0,0 @@
-From 0ee12e411593e092f76020da6bcdae5e651246ac Mon Sep 17 00:00:00 2001
-From: Rui Ueyama <ruiu at cs.stanford.edu>
-Date: Sat, 21 Sep 2024 16:41:17 +0900
-Subject: [PATCH] Do not strip linker-synthesized symbols when
- --retain-symbols-file is given
-
-This is an attempt to fix https://github.com/rui314/mold/issues/1346
----
- src/cmdline.cc              | 7 ++++---
- src/input-files.cc          | 6 ------
- src/main.cc                 | 7 ++++---
- src/mold.h                  | 2 +-
- src/output-chunks.cc        | 4 ++--
- src/passes.cc               | 8 +++-----
- test/retain-symbols-file.sh | 8 ++++----
- 7 files changed, 18 insertions(+), 24 deletions(-)
-
-diff --git a/elf/cmdline.cc b/elf/cmdline.cc
-index efb09d884a..6d10875a88 100644
---- a/elf/cmdline.cc
-+++ b/elf/cmdline.cc
-@@ -438,8 +438,7 @@ template <typename E>
- static void read_retain_symbols_file(Context<E> &ctx, std::string_view path) {
-   MappedFile *mf = must_open_file(ctx, std::string(path));
-   std::string_view data((char *)mf->data, mf->size);
--
--  ctx.arg.retain_symbols_file.reset(new std::unordered_set<std::string_view>);
-+  std::vector<Symbol<E> *> vec;
- 
-   while (!data.empty()) {
-     size_t pos = data.find('\n');
-@@ -455,8 +454,10 @@ static void read_retain_symbols_file(Context<E> &ctx, std::string_view path) {
- 
-     name = string_trim(name);
-     if (!name.empty())
--      ctx.arg.retain_symbols_file->insert(name);
-+      vec.push_back(get_symbol(ctx, name));
-   }
-+
-+  ctx.arg.retain_symbols_file = std::move(vec);
- }
- 
- static bool is_file(std::string_view path) {
-diff --git a/elf/input-files.cc b/elf/input-files.cc
-index e07ae1d63d..afe1fc1ec2 100644
---- a/elf/input-files.cc
-+++ b/elf/input-files.cc
-@@ -1103,9 +1103,6 @@ static bool should_write_to_local_symtab(Context<E> &ctx, Symbol<E> &sym) {
- 
- template <typename E>
- void ObjectFile<E>::compute_symtab_size(Context<E> &ctx) {
--  if (ctx.arg.strip_all)
--    return;
--
-   this->output_sym_indices.resize(this->elf_syms.size(), -1);
- 
-   auto is_alive = [&](Symbol<E> &sym) -> bool {
-@@ -1449,9 +1446,6 @@ bool SharedFile<E>::is_readonly(Symbol<E> *sym) {
- 
- template <typename E>
- void SharedFile<E>::compute_symtab_size(Context<E> &ctx) {
--  if (ctx.arg.strip_all)
--    return;
--
-   this->output_sym_indices.resize(this->elf_syms.size(), -1);
- 
-   // Compute the size of global symbols.
-diff --git a/elf/main.cc b/elf/main.cc
-index 3d94173926..8e7d45721a 100644
---- a/elf/main.cc
-+++ b/elf/main.cc
-@@ -392,8 +392,8 @@ int mold_main(int argc, char **argv) {
- 
-   // Handle --retain-symbols-file options if any.
-   if (ctx.arg.retain_symbols_file)
--    for (std::string_view name : *ctx.arg.retain_symbols_file)
--      get_symbol(ctx, name)->write_to_symtab = true;
-+    for (Symbol<E> *sym : *ctx.arg.retain_symbols_file)
-+      sym->write_to_symtab = true;
- 
-   for (std::string_view arg : ctx.arg.trace_symbol)
-     get_symbol(ctx, arg)->is_traced = true;
-@@ -610,7 +610,8 @@ int mold_main(int argc, char **argv) {
-   ctx.verneed->construct(ctx);
- 
-   // Compute .symtab and .strtab sizes for each file.
--  create_output_symtab(ctx);
-+  if (!ctx.arg.strip_all)
-+    create_output_symtab(ctx);
- 
-   // .eh_frame is a special section from the linker's point of view,
-   // as its contents are parsed and reconstructed by the linker,
-diff --git a/elf/mold.h b/elf/mold.h
-index a4a3bab2d8..dc0f7cd9a6 100644
---- a/elf/mold.h
-+++ b/elf/mold.h
-@@ -1990,7 +1990,7 @@ struct Context {
-     std::string soname;
-     std::string sysroot;
-     std::string_view emulation;
--    std::unique_ptr<std::unordered_set<std::string_view>> retain_symbols_file;
-+    std::optional<std::vector<Symbol<E> *>> retain_symbols_file;
-     std::unordered_map<std::string_view, u64> section_align;
-     std::unordered_map<std::string_view, u64> section_start;
-     std::unordered_set<std::string_view> ignore_ir_file;
-diff --git a/elf/output-chunks.cc b/elf/output-chunks.cc
-index 95c111619c..03bc4b0d74 100644
---- a/elf/output-chunks.cc
-+++ b/elf/output-chunks.cc
-@@ -477,7 +477,7 @@ void StrtabSection<E>::update_shdr(Context<E> &ctx) {
-   // affect correctness of the program but helps disassembler to
-   // disassemble machine code appropriately.
-   if constexpr (is_arm32<E>)
--    if (!ctx.arg.strip_all && !ctx.arg.retain_symbols_file)
-+    if (!ctx.arg.strip_all)
-       offset += sizeof("$a\0$t\0$d");
- 
-   for (Chunk<E> *chunk : ctx.chunks) {
-@@ -504,7 +504,7 @@ void StrtabSection<E>::copy_buf(Context<E> &ctx) {
-   buf[0] = '\0';
- 
-   if constexpr (is_arm32<E>)
--    if (!ctx.arg.strip_all && !ctx.arg.retain_symbols_file)
-+    if (!ctx.arg.strip_all)
-       memcpy(buf + 1, "$a\0$t\0$d", 9);
- }
- 
-diff --git a/elf/passes.cc b/elf/passes.cc
-index d9b8bcf7ba..7f215ebe2b 100644
---- a/elf/passes.cc
-+++ b/elf/passes.cc
-@@ -1744,11 +1744,9 @@ template <typename E>
- void create_output_symtab(Context<E> &ctx) {
-   Timer t(ctx, "compute_symtab_size");
- 
--  if (!ctx.arg.strip_all && !ctx.arg.retain_symbols_file) {
--    tbb::parallel_for_each(ctx.chunks, [&](Chunk<E> *chunk) {
--      chunk->compute_symtab_size(ctx);
--    });
--  }
-+  tbb::parallel_for_each(ctx.chunks, [&](Chunk<E> *chunk) {
-+    chunk->compute_symtab_size(ctx);
-+  });
- 
-   tbb::parallel_for_each(ctx.objs, [&](ObjectFile<E> *file) {
-     file->compute_symtab_size(ctx);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mold.git/commitdiff/5f3c960e7778a676a65533febdf5618da71f70a8



More information about the pld-cvs-commit mailing list