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;

Reply via email to