Stable Archive on
 help / color / Atom feed
* [PATCH v2 1/2] tracepoint: mark __tracepoint_string's __used
       [not found] <>
@ 2020-07-30 22:45 ` Nick Desaulniers
  0 siblings, 0 replies; only message in thread
From: Nick Desaulniers @ 2020-07-30 22:45 UTC (permalink / raw)
  To: Steven Rostedt, Ingo Molnar
  Cc: clang-built-linux, linux-kernel, Miguel Ojeda, Nick Desaulniers,
	stable, Tim Murray, Simon MacMullen, Greg Hackmann

__tracepoint_string's have their string data stored in .rodata, and an
address to that data stored in the "__tracepoint_str" section. Functions
that refer to those strings refer to the symbol of the address. Compiler
optimization can replace those address references with references
directly to the string data. If the address doesn't appear to have other
uses, then it appears dead to the compiler and is removed. This can
break the /tracing/printk_formats sysfs node which iterates the
addresses stored in the "__tracepoint_str" section.

Like other strings stored in custom sections in this header, mark these
__used to inform the compiler that there are other non-obvious users of
the address, so they should still be emitted.

Reported-by: Tim Murray <>
Reported-by: Simon MacMullen <>
Suggested-by: Greg Hackmann <>
Signed-off-by: Nick Desaulniers <>
No change V1 -> V2.

 include/linux/tracepoint.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index a1fecf311621..3a5b717d92e8 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -361,7 +361,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 		static const char *___tp_str __tracepoint_string = str; \
 		___tp_str;						\
-#define __tracepoint_string	__attribute__((section("__tracepoint_str")))
+#define __tracepoint_string	__attribute__((section("__tracepoint_str"), used))
  * tracepoint_string() is used to save the string address for userspace

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2020-07-30 22:45 ` [PATCH v2 1/2] tracepoint: mark __tracepoint_string's __used Nick Desaulniers

Stable Archive on

Archives are clonable:
	git clone --mirror stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ \
	public-inbox-index stable

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone