Thread (16 messages) flat view 16 messages, 5 authors, 2021-02-15

Re: [tip: objtool/urgent] objtool: Fix seg fault with Clang non-section symbols

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2021-02-15 21:23:17
Also in: lkml
Subsystem: the rest · Maintainer: Linus Torvalds

On Mon, 15 Feb 2021 09:58:06 -0600
Josh Poimboeuf [off-list ref] wrote:
On Mon, Feb 15, 2021 at 09:53:07AM -0500, Steven Rostedt wrote:
quoted
On Sun, 14 Feb 2021 09:51:47 -0600
Josh Poimboeuf [off-list ref] wrote:
  
quoted
Steve, looks like recordmcount avoids referencing weak symbols directly
by their function symbol.  Maybe it can just skip weak symbols which
don't have a section symbol, since this seems like a rare scenario.  
When does the .text.unlikely section disappear? During the creation of the
object, or later in the linker stage?  
The section is there, but the symbol associated with the section
(".text.unlikely" symbol) isn't generated by the assembler.
Greg,

Does this fix the issue with you? It appears to fix it for my arch linux
VM that I created that uses binutils 2.36-3.

-- Steve
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index f9b19524da11..558b67f8364e 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -562,7 +562,7 @@ static char const * __has_rel_mcount(Elf_Shdr const *const relhdr, /* reltype */
 	if (w(txthdr->sh_type) != SHT_PROGBITS ||
 	    !(_w(txthdr->sh_flags) & SHF_EXECINSTR))
 		return NULL;
-	return txtname;
+	return shdr0->sh_size ? txtname : NULL;
 }
 
 static char const *has_rel_mcount(Elf_Shdr const *const relhdr,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help