public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* DTRACE_PROBE macro fails to compile with Clang++
@ 2013-09-11 17:32 Martin Martin
  2013-09-11 17:38 ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Martin @ 2013-09-11 17:32 UTC (permalink / raw)
  To: systemtap

The following code:

#include <sys/sdt.h>

int main() {
    DTRACE_PROBE(a, b);
}

compiles with with G++, but when compiled with clang++ 3.3 gives:

clang++ dtrace_probe.cpp
dtrace_probe.cpp:4:5: error: unknown flag
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:36:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:43:31: note: expanded from macro '_SDT_ASM_3'
# define _SDT_ASM_3(a, b, c)            _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:9:2: note: expanded from here
".pushsection .note.stapsdt"
 ^
<inline asm>:2:31: note: instantiated into assembly here
.pushsection .note.stapsdt,"?","note"
                              ^
dtrace_probe.cpp:4:5: error: .popsection without corresponding .pushsection
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:36:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:41:26: note: expanded from macro '_SDT_ASM_1'
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:29:2: note: expanded from here
".popsection"
 ^
<inline asm>:14:12: note: instantiated into assembly here
.popsection
           ^
dtrace_probe.cpp:4:5: error: expected '@' or '%' before type
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:38:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:45:36: note: expanded from macro '_SDT_ASM_5'
# define _SDT_ASM_5(a, b, c, d, e)      _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:32:2: note: expanded from here
".pushsection .stapsdt.base"
 ^
<inline asm>:2:33: note: instantiated into assembly here
.pushsection .stapsdt.base,"aG","progbits",.stapsdt.base,comdat
                                ^
dtrace_probe.cpp:4:5: error: .popsection without corresponding .pushsection
    DTRACE_PROBE(a, b);
    ^
/usr/include/sys/sdt.h:362:3: note: expanded from macro 'DTRACE_PROBE'
  STAP_PROBE(provider,probe)
  ^
/usr/include/sys/sdt.h:254:3: note: expanded from macro 'STAP_PROBE'
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/include/sys/sdt.h:38:27: note: expanded from macro '_SDT_PROBE'
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
note: (skipping 1 expansions in backtrace; use
-fmacro-backtrace-limit=0 to see all)
/usr/include/sys/sdt.h:41:26: note: expanded from macro '_SDT_ASM_1'
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
/usr/include/sys/sdt.h:40:22: note: expanded from macro '_SDT_S'
# define _SDT_S(x)                      #x
                                        ^
<scratch space>:42:2: note: expanded from here
".popsection"
 ^
<inline asm>:7:12: note: instantiated into assembly here
.popsection
           ^
4 errors generated.

$ clang++ --version
clang version 3.3 (tags/RELEASE_33/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DTRACE_PROBE macro fails to compile with Clang++
  2013-09-11 17:32 DTRACE_PROBE macro fails to compile with Clang++ Martin Martin
@ 2013-09-11 17:38 ` Daniel P. Berrange
  2013-09-11 17:45   ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2013-09-11 17:38 UTC (permalink / raw)
  To: Martin Martin; +Cc: systemtap

On Wed, Sep 11, 2013 at 01:32:15PM -0400, Martin Martin wrote:
> The following code:
> 
> #include <sys/sdt.h>
> 
> int main() {
>     DTRACE_PROBE(a, b);
> }
> 
> compiles with with G++, but when compiled with clang++ 3.3 gives:

That's a known issue - there's some info (but no solution yet ) in this
bug report too:

  https://bugzilla.redhat.com/show_bug.cgi?id=999419


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: DTRACE_PROBE macro fails to compile with Clang++
  2013-09-11 17:38 ` Daniel P. Berrange
@ 2013-09-11 17:45   ` Mark Wielaard
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Wielaard @ 2013-09-11 17:45 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: Martin Martin, systemtap

On Wed, 2013-09-11 at 18:38 +0100, Daniel P. Berrange wrote:
> On Wed, Sep 11, 2013 at 01:32:15PM -0400, Martin Martin wrote:
> > The following code:
> > 
> > #include <sys/sdt.h>
> > 
> > int main() {
> >     DTRACE_PROBE(a, b);
> > }
> > 
> > compiles with with G++, but when compiled with clang++ 3.3 gives:
> 
> That's a known issue - there's some info (but no solution yet ) in this
> bug report too:
> 
>   https://bugzilla.redhat.com/show_bug.cgi?id=999419

Yeah, seems to be some unknown deficiency in clang (plus mixing two
system compilers on one system doesn't seem to be a good idea - the open
question seems to be whether clang can be configured to use the normal
gas assembler). See also
https://sourceware.org/bugzilla/show_bug.cgi?id=13974

Cheers,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-11 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-11 17:32 DTRACE_PROBE macro fails to compile with Clang++ Martin Martin
2013-09-11 17:38 ` Daniel P. Berrange
2013-09-11 17:45   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).