Re: [PATCH v4 14/22] objtool: Reuse string references

Josh Poimboeuf <[email protected]>
Newsgroups org.kernel.vger.live-patching,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <anu8su4kuf3eUF3c@jpoimboe>
On Tue, Aug 11, 2026 at 04:52:51PM -0700, Song Liu wrote:
> > -unsigned int elf_add_string(struct elf *elf, struct section *strtab, const char *str)
> > +int elf_find_string(struct elf *elf, struct section *strtab, const char *str)
> >  {
> 
> elf_find_string() returns -1 for error and positive number for addend.
> It is a good idea to add some comments for this behavior.

Ok, will add a small comment above the function:

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index f6219f495efdc..f9a4226f115ef 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -1410,6 +1410,11 @@ int elf_find_string(struct elf *elf, struct section *strtab, const char *str)
 	return -1;
 }
 
+/*
+ * Add a static string to the strtab section.
+ *
+ * Returns positive string offset on success, -1 on error.
+ */
 int elf_add_string(struct elf *elf, struct section *strtab, const char *str)
 {
 	void *data;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.