This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Systemtap's DTRACE_PROBE and clang
- From: Josh Stone <jistone at redhat dot com>
- To: Martin Martin <martin at infinio dot com>
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>, systemtap at sourceware dot org
- Date: Fri, 20 Sep 2013 13:02:19 -0700
- Subject: Re: Systemtap's DTRACE_PROBE and clang
- Authentication-results: sourceware.org; auth=none
- References: <CAAQ0mPj9t_TtzsnoaNPO5U8sTtfg2NQYjEzkZUwP3P7q5_dE7Q at mail dot gmail dot com> <y0mtxhfjp48 dot fsf at fche dot csb>
On 09/20/2013 11:59 AM, Frank Ch. Eigler wrote:
>
> martin wrote:
>
>> [...]
>> How onerous is it to change the code here? [...]
>> Workaround for now, it does work if you change it to:
>> .pushsection .note.stapsdt,"?",@note
>
> I don't recall any deep discusson on that topic. It could be
> just to immunize it from being misinterpreted as a comment
> (see the @-comment-on-arm line on the same AS doc page).
Based on that, I'm experimenting with %note instead. It's a little more
complicated since that has to be escaped to %%note for C probes, but not
escaped for probes in pure ASM source files. But that's just an #ifdef
__ASSEMBLER__, and so far this seems to work.
I'd appreciate if you can confirm it with your "?"-patched clang.
Thanks,
Josh
diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
index ba04c12..fbf5bc3 100644
--- a/includes/sys/sdt.h
+++ b/includes/sys/sdt.h
@@ -171,9 +171,20 @@ __extension__ extern unsigned long long __sdt_unsp;
# define _SDT_ASM_AUTOGROUP ""
#endif
+/* We used to have just "note", but some assemblers don't support that.
+ * GAS documents that it should be @note, but since ARM uses @ for
+ * comments, it also supports %note. It appears we can get away with
+ * the latter everywhere, so long as we escape it depending on mode. */
+#ifdef __ASSEMBLER__
+#define _SDT_ASM_NOTE %note
+#else
+#define _SDT_ASM_NOTE %%note
+#endif
+
#define _SDT_ASM_BODY(provider, name, pack_args, args) \
_SDT_ASM_1(990: _SDT_NOP) \
- _SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \
+ _SDT_ASM_3( .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP, \
+ _SDT_ASM_NOTE) \
_SDT_ASM_1( .balign 4) \
_SDT_ASM_3( .4byte 992f-991f, 994f-993f, _SDT_NOTE_TYPE) \
_SDT_ASM_1(991: .asciz _SDT_NOTE_NAME) \