lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <168629684841.404.10488527727887221050.tip-bot2@tip-bot2>
Date:   Fri, 09 Jun 2023 07:47:28 -0000
From:   "tip-bot2 for Josh Poimboeuf" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: [tip: objtool/core] objtool: Shrink reloc->sym_reloc_entry

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     890f10a433f51f95eccaec13d46dde769ccc113b
Gitweb:        https://git.kernel.org/tip/890f10a433f51f95eccaec13d46dde769ccc113b
Author:        Josh Poimboeuf <jpoimboe@...nel.org>
AuthorDate:    Tue, 30 May 2023 10:21:10 -07:00
Committer:     Josh Poimboeuf <jpoimboe@...nel.org>
CommitterDate: Wed, 07 Jun 2023 10:03:25 -07:00

objtool: Shrink reloc->sym_reloc_entry

Convert it to a singly-linked list.

With allyesconfig + CONFIG_DEBUG_INFO:

- Before: peak heap memory consumption: 38.64G
- After:  peak heap memory consumption: 36.89G

Link: https://lore.kernel.org/r/a51f0a6f9bbf2494d5a3a449807307e78a940988.1685464332.git.jpoimboe@kernel.org
Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
---
 tools/objtool/elf.c                 |  9 +++++----
 tools/objtool/include/objtool/elf.h |  4 ++--
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index 16e019a..4b0de0e 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -356,7 +356,6 @@ static void elf_add_symbol(struct elf *elf, struct symbol *sym)
 	struct rb_node *pnode;
 	struct symbol *iter;
 
-	INIT_LIST_HEAD(&sym->reloc_list);
 	INIT_LIST_HEAD(&sym->pv_target);
 	sym->alias = sym;
 
@@ -540,7 +539,7 @@ static int elf_update_sym_relocs(struct elf *elf, struct symbol *sym)
 {
 	struct reloc *reloc;
 
-	list_for_each_entry(reloc, &sym->reloc_list, sym_reloc_entry) {
+	for (reloc = sym->relocs; reloc; reloc = reloc->sym_next_reloc) {
 		reloc->rel.r_info = GELF_R_INFO(reloc->sym->idx, reloc_type(reloc));
 		if (elf_write_reloc(elf, reloc))
 			return -1;
@@ -841,8 +840,9 @@ static struct reloc *elf_init_reloc(struct elf *elf, struct section *rsec,
 	if (elf_write_reloc(elf, reloc))
 		return NULL;
 
-	list_add_tail(&reloc->sym_reloc_entry, &sym->reloc_list);
 	elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc));
+	reloc->sym_next_reloc = sym->relocs;
+	sym->relocs = reloc;
 
 	return reloc;
 }
@@ -960,8 +960,9 @@ static int read_relocs(struct elf *elf)
 				return -1;
 			}
 
-			list_add_tail(&reloc->sym_reloc_entry, &sym->reloc_list);
 			elf_hash_add(reloc, &reloc->hash, reloc_hash(reloc));
+			reloc->sym_next_reloc = sym->relocs;
+			sym->relocs = reloc;
 
 			nr_reloc++;
 		}
diff --git a/tools/objtool/include/objtool/elf.h b/tools/objtool/include/objtool/elf.h
index 60686f7..7b808ac 100644
--- a/tools/objtool/include/objtool/elf.h
+++ b/tools/objtool/include/objtool/elf.h
@@ -63,7 +63,7 @@ struct symbol {
 	u8 profiling_func    : 1;
 	u8 warned	     : 1;
 	struct list_head pv_target;
-	struct list_head reloc_list;
+	struct reloc *relocs;
 };
 
 struct reloc {
@@ -74,7 +74,7 @@ struct reloc {
 	};
 	struct section *sec;
 	struct symbol *sym;
-	struct list_head sym_reloc_entry;
+	struct reloc *sym_next_reloc;
 };
 
 struct elf {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ