This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Systemtap's DTRACE_PROBE and clang


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)				      \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]