public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [Bug translator/13974] New: sdt.h is incompatible with clang
@ 2012-04-12 17:36 jistone at redhat dot com
  2012-04-12 17:45 ` [Bug translator/13974] " jistone at redhat dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: jistone at redhat dot com @ 2012-04-12 17:36 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=13974

             Bug #: 13974
           Summary: sdt.h is incompatible with clang
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: jistone@redhat.com
    Classification: Unclassified


A simple sdt test with clang fails to build:

$ cat foosdt.c 
#include <sys/sdt.h>
void foo(void)
{
    STAP_PROBE(foo, foo);
}

$ clang -c foosdt.c 
foosdt.c:4:6: error: unknown flag
    STAP_PROBE(foo, foo);
    ^
In file included from foosdt.c:1:
/usr/local/include/sys/sdt.h:254:3: note: instantiated from:
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/local/include/sys/sdt.h:36:27: note: instantiated from:
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
/usr/local/include/sys/sdt.h:176:3: note: instantiated from:
  _SDT_ASM_3(           .pushsection .note.stapsdt,_SDT_ASM_AUTOGROUP,"note") \
  ^
/usr/local/include/sys/sdt.h:43:31: note: instantiated from:
# define _SDT_ASM_3(a, b, c)            _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
<scratch space>:4:2: note: instantiated from:
".pushsection .note.stapsdt"
 ^
<inline asm>:2:31: note: instantiated into assembly here
.pushsection .note.stapsdt,"?","note"
                              ^
foosdt.c:4:6: error: .popsection without corresponding .pushsection
    STAP_PROBE(foo, foo);
    ^
In file included from foosdt.c:1:
/usr/local/include/sys/sdt.h:254:3: note: instantiated from:
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/local/include/sys/sdt.h:36:27: note: instantiated from:
    __asm__ __volatile__ (_SDT_ASM_BODY(provider, name, _SDT_ASM_ARGS, (n)) \
                          ^
/usr/local/include/sys/sdt.h:188:3: note: instantiated from:
  _SDT_ASM_1(           .popsection)
  ^
/usr/local/include/sys/sdt.h:41:26: note: instantiated from:
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
<scratch space>:24:2: note: instantiated from:
".popsection"
 ^
<inline asm>:14:12: note: instantiated into assembly here
.popsection
           ^
foosdt.c:4:6: error: expected '@' or '%' before type
    STAP_PROBE(foo, foo);
    ^
In file included from foosdt.c:1:
/usr/local/include/sys/sdt.h:254:3: note: instantiated from:
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/local/include/sys/sdt.h:38:27: note: instantiated from:
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
/usr/local/include/sys/sdt.h:192:3: note: instantiated from:
  _SDT_ASM_5(           .pushsection .stapsdt.base,"aG","progbits",           \
  ^
/usr/local/include/sys/sdt.h:45:36: note: instantiated from:
# define _SDT_ASM_5(a, b, c, d, e)      _SDT_S(a) "," _SDT_S(b) "," \
                                        ^
<scratch space>:27:2: note: instantiated from:
".pushsection .stapsdt.base"
 ^
<inline asm>:2:33: note: instantiated into assembly here
.pushsection .stapsdt.base,"aG","progbits",.stapsdt.base,comdat
                                ^
foosdt.c:4:6: error: .popsection without corresponding .pushsection
    STAP_PROBE(foo, foo);
    ^
In file included from foosdt.c:1:
/usr/local/include/sys/sdt.h:254:3: note: instantiated from:
  _SDT_PROBE(provider, name, 0, ())
  ^
/usr/local/include/sys/sdt.h:38:27: note: instantiated from:
    __asm__ __volatile__ (_SDT_ASM_BASE);                                   \
                          ^
/usr/local/include/sys/sdt.h:198:3: note: instantiated from:
  _SDT_ASM_1(           .popsection)                                          \
  ^
/usr/local/include/sys/sdt.h:41:26: note: instantiated from:
# define _SDT_ASM_1(x)                  _SDT_S(x) "\n"
                                        ^
<scratch space>:37:2: note: instantiated from:
".popsection"
 ^
<inline asm>:7:12: note: instantiated into assembly here
.popsection
           ^
4 errors generated.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
@ 2012-04-12 17:45 ` jistone at redhat dot com
  2013-07-23  7:20 ` timo.lindfors at iki dot fi
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: jistone at redhat dot com @ 2012-04-12 17:45 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=13974

--- Comment #1 from Josh Stone <jistone at redhat dot com> 2012-04-12 17:44:50 UTC ---
(In reply to comment #0)
> foosdt.c:4:6: error: unknown flag
[...]
> <inline asm>:2:31: note: instantiated into assembly here
> .pushsection .note.stapsdt,"?","note"
>                               ^

This error is due to our compiler-dependent test for sdt-config.h:

> /* includes/sys/sdt-config.h.  Generated from sdt-config.h.in by configure.
> 
>    This file just defines _SDT_ASM_SECTION_AUTOGROUP_SUPPORT to 0 or 1 to
>    indicate whether the assembler supports "?" in .pushsection directives.  */
>
> #define _SDT_ASM_SECTION_AUTOGROUP_SUPPORT 1

My installed header was created for gcc, which does support this flag, but
clearly clang does not.  I'm not sure how we could deal with multiple system
compilers in general.  Perhaps we'd have to add #ifdef to sdt-config.h to match
the compiler which was tested, and assume 0 if encountering something else?

With sdt-config.h configured directly with clang, there's a different error at
the same place, and the rest of the errors are still the same.

> foosdt.c:4:6: error: expected '@' or '%' before type
[...]
> <inline asm>:2:31: note: instantiated into assembly here
> .pushsection .note.stapsdt,"","note"
>                               ^

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
  2012-04-12 17:45 ` [Bug translator/13974] " jistone at redhat dot com
@ 2013-07-23  7:20 ` timo.lindfors at iki dot fi
  2013-09-11 18:05 ` mjw at redhat dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: timo.lindfors at iki dot fi @ 2013-07-23  7:20 UTC (permalink / raw)
  To: systemtap

http://sourceware.org/bugzilla/show_bug.cgi?id=13974

Timo Juhani Lindfors <timo.lindfors at iki dot fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timo.lindfors at iki dot fi

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
  2012-04-12 17:45 ` [Bug translator/13974] " jistone at redhat dot com
  2013-07-23  7:20 ` timo.lindfors at iki dot fi
@ 2013-09-11 18:05 ` mjw at redhat dot com
  2013-09-21  0:19 ` jistone at redhat dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: mjw at redhat dot com @ 2013-09-11 18:05 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=13974

Mark Wielaard <mjw at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mjw at redhat dot com

--- Comment #2 from Mark Wielaard <mjw at redhat dot com> ---
BTW. It might a good idea to add some configure check before using a feature
like SDT probes. Even really old g++ versions have been observed to have
trouble with using probe macros in C++ contructors or destructors for example.

This configure snippet seems to find all troubling C++ compilers (for C any gcc
version seems to be fine, only clang seems to have issues):

dnl ===================================================================
dnl Check if SDT probes (for systemtap, gdb, dtrace) are available
dnl ===================================================================

# We need at least the sys/sdt.h include header.
AC_CHECK_HEADER([sys/sdt.h], [SDT_H_FOUND='TRUE'], [SDT_H_FOUND='FALSE'])
if test "$SDT_H_FOUND" = "TRUE"; then
  # Found sys/sdt.h header, now make sure the c++ compiler works.
  # Old g++ versions had problems with probes in constructors/destructors.
  AC_MSG_CHECKING([working sys/sdt.h and c++ support])
  AC_LANG_PUSH([C++])
  AC_LINK_IFELSE([AC_LANG_PROGRAM([[
    #include <sys/sdt.h>
    class ProbeClass
    {
    private:
      int& ref;
      const char *name;

    public:
      ProbeClass(int& v, const char *n) : ref(v), name(n)
      {
        DTRACE_PROBE2(_test_, cons, name, ref);
      }

      void method(int min)
      {
        DTRACE_PROBE3(_test_, meth, name, ref, min);
        ref -= min;
      }

      ~ProbeClass()
      {
        DTRACE_PROBE2(_test_, dest, name, ref);
      }
    };
  ]],[[
    int i = 64;
    DTRACE_PROBE1(_test_, call, i);
    ProbeClass inst = ProbeClass(i, "call");
    inst.method(24);
  ]])], [AC_MSG_RESULT([yes]); AC_DEFINE([USE_SDT_PROBES])],
        [AC_MSG_RESULT([no, sdt.h or c++ compiler too old])])
  AC_LANG_POP([C++])
fi
AC_CONFIG_HEADERS([config_probes.h])

Where config_probes.h.in might be something like:

#ifndef CONFIG_PROBES_H
#define CONFIG_PROBES_H

/* Whether we have and can use sys/sdt.h for probes.  */
#define USE_SDT_PROBES 0

#endif

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
                   ` (2 preceding siblings ...)
  2013-09-11 18:05 ` mjw at redhat dot com
@ 2013-09-21  0:19 ` jistone at redhat dot com
  2013-09-26 19:43 ` jistone at redhat dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: jistone at redhat dot com @ 2013-09-21  0:19 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=13974

Josh Stone <jistone at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Josh Stone <jistone at redhat dot com> ---
Martin C. Martin filed a couple bugs with LLVM:
  http://llvm.org/bugs/show_bug.cgi?id=17198
  http://llvm.org/bugs/show_bug.cgi?id=17270

The first is now fixed with llvm-mc gaining support for the "?" flag.

The second gave us a hint that led me to use %note instead of "note", with
%%-quoting as needed for operand expansion.  This is pushed in commit a31190f5.

So I think we can call this FIXED, but let's keep a careful eye on that %note
form to make sure it doesn't create problems anywhere else...

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
                   ` (3 preceding siblings ...)
  2013-09-21  0:19 ` jistone at redhat dot com
@ 2013-09-26 19:43 ` jistone at redhat dot com
  2014-02-16 17:44 ` jackie.rosen at hushmail dot com
  2014-05-28 19:42 ` schwab at sourceware dot org
  6 siblings, 0 replies; 9+ messages in thread
From: jistone at redhat dot com @ 2013-09-26 19:43 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=13974

--- Comment #4 from Josh Stone <jistone at redhat dot com> ---
(In reply to Josh Stone from comment #3)
> The second gave us a hint that led me to use %note instead of "note", with
> %%-quoting as needed for operand expansion.  This is pushed in commit
> a31190f5.

I'm actually going to revert this.  The difficulty of '%' is that it must be
escaped for asm() blocks that have operands, but must not be escaped in asm()
blocks without operands, nor for pure ASM source files.  But we have a
SDT_PROBE_ASM construct available for others to use in their own asm(), where
we have no idea if escaping is needed.  It turns out glibc uses this, and we
broke their build on Fedora rawhide due to bad %-escaping.

We can't use @note because GAS says that's a comment on ARM, so we're left back
at "note" being the most straightforward.  I'll revert the change, but at least
now we have some documented justification for the chosen syntax.

Besides, LLVM finished up 17270 with support for the "note" syntax, so anyone
interested in SDT there can use an LLVM snapshot or wait for their next
release.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
                   ` (4 preceding siblings ...)
  2013-09-26 19:43 ` jistone at redhat dot com
@ 2014-02-16 17:44 ` jackie.rosen at hushmail dot com
  2014-02-17 19:04   ` Josh Stone
  2014-05-28 19:42 ` schwab at sourceware dot org
  6 siblings, 1 reply; 9+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 17:44 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=13974

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #5 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

* Re: [Bug translator/13974] sdt.h is incompatible with clang
  2014-02-16 17:44 ` jackie.rosen at hushmail dot com
@ 2014-02-17 19:04   ` Josh Stone
  0 siblings, 0 replies; 9+ messages in thread
From: Josh Stone @ 2014-02-17 19:04 UTC (permalink / raw)
  To: systemtap

On 02/16/2014 09:44 AM, jackie.rosen at hushmail dot com wrote:
> --- Comment #5 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
> *** Bug 260998 has been marked as a duplicate of this bug. ***
> Seen from the domain [SPAM]
> Page where seen: [SPAM]
> Marked for reference. Resolved as fixed @bugzilla.

I count 235 such spams on both open and closed bugs.
Can we purge these, or at least hide them from public view?

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

* [Bug translator/13974] sdt.h is incompatible with clang
  2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
                   ` (5 preceding siblings ...)
  2014-02-16 17:44 ` jackie.rosen at hushmail dot com
@ 2014-05-28 19:42 ` schwab at sourceware dot org
  6 siblings, 0 replies; 9+ messages in thread
From: schwab at sourceware dot org @ 2014-05-28 19:42 UTC (permalink / raw)
  To: systemtap

https://sourceware.org/bugzilla/show_bug.cgi?id=13974

Andreas Schwab <schwab at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jackie.rosen at hushmail dot com   |

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

end of thread, other threads:[~2014-05-28 19:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 17:36 [Bug translator/13974] New: sdt.h is incompatible with clang jistone at redhat dot com
2012-04-12 17:45 ` [Bug translator/13974] " jistone at redhat dot com
2013-07-23  7:20 ` timo.lindfors at iki dot fi
2013-09-11 18:05 ` mjw at redhat dot com
2013-09-21  0:19 ` jistone at redhat dot com
2013-09-26 19:43 ` jistone at redhat dot com
2014-02-16 17:44 ` jackie.rosen at hushmail dot com
2014-02-17 19:04   ` Josh Stone
2014-05-28 19:42 ` schwab at sourceware dot org

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